Skip to content

Commit

Permalink
Add possibility to have a p-pi.json definition and add postfix def
Browse files Browse the repository at this point in the history
  • Loading branch information
Poil committed Sep 15, 2014
1 parent 70547d9 commit 74b53ce
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 6 deletions.
27 changes: 22 additions & 5 deletions graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

$s_id_user=filter_var($_SESSION['S_ID_USER'],FILTER_SANITIZE_NUMBER_INT);
$plugin = validate_get(GET('p'), 'plugin');
$plugininstance = validate_get(GET('pi'), 'plugininstance');
$type = validate_get(GET('t'), 'type');
$width = GET('x') ? filter_input(INPUT_GET, 'x', FILTER_VALIDATE_INT, array(
'min_range' => 10,
Expand Down Expand Up @@ -59,15 +60,23 @@
}

# plugin json
if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) {
$json = file_get_contents('plugin/'.$plugin.'.json');
if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'-'.$plugininstance.'.json')) {
$json = file_get_contents('plugin/'.$plugin.'-'.$plugininstance.'.json');
$plugin_json = json_decode($json, true);

if (is_null($plugin_json))
$log->write('CGP Error: invalid json in plugin/'.$plugin.'.json');
} else {
$log->write(sprintf('CGRAPHZ ERROR: plugin "%s" is not available', $plugin));
error_image('Unknown graph type :'.$plugin.' '.PHP_EOL.str_replace('&',PHP_EOL,$_SERVER['QUERY_STRING']));
if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) {
$json = file_get_contents('plugin/'.$plugin.'.json');
$plugin_json = json_decode($json, true);

if (is_null($plugin_json))
$log->write('CGP Error: invalid json in plugin/'.$plugin.'.json');
} else {
$log->write(sprintf('CGRAPHZ ERROR: plugin "%s" is not available', $plugin));
error_image('Unknown graph type :'.$plugin.' '.PHP_EOL.str_replace('&',PHP_EOL,$_SERVER['QUERY_STRING']));
}
}

if (!isset($plugin_json[$type]['type']))
Expand All @@ -90,6 +99,14 @@
require_once 'type/Uptime.class.php';
$obj = new Type_Uptime($CONFIG, $_GET);
break;
case 'iowpm':
require_once 'type/GenericIOWPM.class.php';
$obj = new Type_GenericIOWPM($CONFIG, $_GET);
break;
case 'aggregation':
require_once 'type/GenericAggregation.class.php';
$obj = new Type_GenericAggregation($CONFIG, $_GET);
break;
default:
require_once 'type/Default.class.php';
$obj = new Type_Default($CONFIG, $_GET);
Expand Down
95 changes: 95 additions & 0 deletions plugin/tail-postfix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"counter": {
"title": "{{PI}} {{TC}} on {{HOST}}",
"type": "stacked",
"vertical": "Conn/s",
"legend": {
"connection-in-TLS-established": {
"name": "TLS Established"
},
"connection-in-TLS-setup": {
"name": "TLS Setup"
},
"connection-in-close": {
"name": "Close"
},
"connection-in-lost": {
"name": "Lost"
},
"connection-in-open": {
"name": "Open"
},
"connection-out-TLS-established": {
"name": "TLS Established"
},
"connection-out-TLS-setup": {
"name": "TLS Setup"
},
"connection-in-timeout": {
"name": "Timeout"
},
"rejected": {
"name": "Rejected"
},
"rejected-host_not_found": {
"name": "Host not found"
},
"rejected-no_dns_entry": {
"name": "No DNS Entry"
},
"rejected-spam_or_forged": {
"name": "Spam or Forged"
},
"status-bounced": {
"name": "Bounced"
},
"status-deferred": {
"name": "Deferred"
},
"status-forwarded": {
"name": "Forwarded"
},
"status-reject": {
"name": "Reject"
},
"status-sent": {
"name": "Sent"
},
"status-softbounce": {
"name": "Soft Bounce"
}
}
},
"gauge": {
"title": "{{PI}} {{TC}} on {{HOST}}",
"type": "default",
"vertical": "ms",
"legend": {
"delay": {
"name": "Total"
},
"delay-before_queue_mgr": {
"name": "Time before queue manager"
},
"delay-in_queue_mgr": {
"name": "Time in queue manager"
},
"delay-setup_time": {
"name": "Conn setup (DNS HELO TLS)"
},
"delay-trans_time": {
"name": "Message transmission time"
}
}
},
"ipt_bytes": {
"title": "{{PI}} message size on {{HOST}}",
"type": "stack",
"vertical": "Bytes",
"legend": {
"size": {
"name": "Size"
}
}
}
}
3 changes: 2 additions & 1 deletion plugin/tail.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}

0 comments on commit 74b53ce

Please sign in to comment.