diff options
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/snmp.php | 26 |
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'; | |||
| 7 | require_once 'inc/collectd.inc.php'; | 7 | require_once 'inc/collectd.inc.php'; |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | $obj = new Type_Default($CONFIG); | 10 | switch(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 | ||
| 17 | collectd_flush($obj->identifiers); | 35 | collectd_flush($obj->identifiers); |
| 18 | $obj->rrd_graph(); | 36 | $obj->rrd_graph(); |
