aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/snmp.php
blob: 4fbebbb232001024a1ae777d11e5c0f5d1debfa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

# Collectd snmp plugin

require_once 'conf/common.inc.php';


switch(GET('t')) {
	case 'if_octets':
		require_once 'type/GenericIO.class.php';
		$obj = new Type_GenericIO($CONFIG, $_GET);
		$obj->data_sources = array('rx', 'tx');
		$obj->legend = array(
			'rx' => 'Receive',
			'tx' => 'Transmit',
		);
		$obj->colors = array(
			'rx' => '0000ff',
			'tx' => '00b000',
		);
		$obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']);
		$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
		$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
	break;
	default:
		require_once 'type/Default.class.php';
		$obj = new Type_Default($CONFIG, $_GET);
		$obj->rrd_title = sprintf('SNMP: %s (%s)', $obj->args['type'], $obj->args['tinstance']);
	break;
}

$obj->rrd_format = '%5.1lf%s';

$obj->rrd_graph();