From 74b53ce5e0305208bcd2476cd0f55e137d564508 Mon Sep 17 00:00:00 2001 From: Poil Date: Mon, 15 Sep 2014 21:43:37 +0200 Subject: [PATCH] Add possibility to have a p-pi.json definition and add postfix def --- graph.php | 27 +++++++++--- plugin/tail-postfix.json | 95 ++++++++++++++++++++++++++++++++++++++++ plugin/tail.json | 3 +- 3 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 plugin/tail-postfix.json diff --git a/graph.php b/graph.php index d37f08ee..368bbaa8 100644 --- a/graph.php +++ b/graph.php @@ -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, @@ -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'])) @@ -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); diff --git a/plugin/tail-postfix.json b/plugin/tail-postfix.json new file mode 100644 index 00000000..18518aa6 --- /dev/null +++ b/plugin/tail-postfix.json @@ -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" + } + } + } +} diff --git a/plugin/tail.json b/plugin/tail.json index 0967ef42..2c63c085 100644 --- a/plugin/tail.json +++ b/plugin/tail.json @@ -1 +1,2 @@ -{} +{ +}