aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2012-09-05 16:41:17 +0200
committerPim van den Berg2012-09-05 16:48:32 +0200
commitb5f789c1cc37ee317164b3a629f1ee93199dd22a (patch)
tree8ebdb2f79dd4b6003b4fcddc56ea1688a83c8334
parentapply datasize (bytes/bits) only to network related data (diff)
downloadapt-panopticon_cgp-b5f789c1cc37ee317164b3a629f1ee93199dd22a.zip
apt-panopticon_cgp-b5f789c1cc37ee317164b3a629f1ee93199dd22a.tar.gz
apt-panopticon_cgp-b5f789c1cc37ee317164b3a629f1ee93199dd22a.tar.bz2
apt-panopticon_cgp-b5f789c1cc37ee317164b3a629f1ee93199dd22a.tar.xz
plugin/snmp: add support for if_octets
The types used in the SNMP plugin aren't user defined, but defined in types.db. Because of the assumption that they were user defined, the patch supplied by Neptune Ning wasn't accepted. His patch has now been merged with this commit. A little fallback has been added to catch types that aren't defined in our code yet. Reference: https://github.com/pommi/CGP/pull/1 Contributed-by: Neptune Ning (Plan) <frostyplanet@gmail.com>
Diffstat (limited to '')
-rw-r--r--plugin/snmp.php26
1 files changed, 22 insertions, 4 deletions
diff --git a/plugin/snmp.php b/plugin/snmp.php
index 8f3260d..476f4ed 100644
--- a/plugin/snmp.php
+++ b/plugin/snmp.php
@@ -7,12 +7,30 @@ require_once 'type/Default.class.php';
7require_once 'inc/collectd.inc.php'; 7require_once 'inc/collectd.inc.php';
8 8
9 9
10$obj = new Type_Default($CONFIG); 10switch(GET('t')) {
11$obj->width = $width; 11 case 'if_octets':
12$obj->heigth = $heigth; 12 $obj->data_sources = array('rx', 'tx');
13 $obj->ds_names = array(
14 'rx' => 'Receive',
15 'tx' => 'Transmit',
16 );
17 $obj->colors = array(
18 'rx' => '0000ff',
19 'tx' => '00b000',
20 );
21 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']);
22 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
23 $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
24 break;
25 default:
26 $obj = new Type_Default($CONFIG);
27 $obj->rrd_title = sprintf('SNMP: %s (%s)', $obj->args['type'], $obj->args['tinstance']);
28 return;
29}
13 30
14$obj->rrd_title = sprintf('SNMP: %s (%s)', $obj->args['type'], $obj->args['tinstance']);
15$obj->rrd_format = '%5.1lf%s'; 31$obj->rrd_format = '%5.1lf%s';
32$obj->width = $width;
33$obj->heigth = $heigth;
16 34
17collectd_flush($obj->identifiers); 35collectd_flush($obj->identifiers);
18$obj->rrd_graph(); 36$obj->rrd_graph();