Skip to content

Commit

Permalink
snmp: see if this works with our snmp types
Browse files Browse the repository at this point in the history
  • Loading branch information
stackmagic committed Mar 5, 2014
1 parent 8b80b93 commit 68edff3
Showing 1 changed file with 105 additions and 2 deletions.
107 changes: 105 additions & 2 deletions plugin/snmp.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,108 @@


switch(GET('t')) {
case 'net_if_octets':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInOctets', 'ifOutOctets');
$obj->ds_names = array(
'ifInOctets' => 'Receive',
'ifOutOctets' => 'Transmit',
);
$obj->colors = array(
'ifInOctets' => '0000ff',
'ifOutOctets' => '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;

case 'net_if_errors':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInErrors', 'ifOutErrors');
$obj->ds_names = array(
'ifInErrors' => 'Receive',
'ifOutErrors' => 'Transmit',
);
$obj->colors = array(
'ifInErrors' => '0000ff',
'ifOutErrors' => '00b000',
);
$obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']);
$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
break;

case 'net_if_discards':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInDiscards', 'ifOutDiscards');
$obj->ds_names = array(
'ifInDiscards' => 'Receive',
'ifOutDiscards' => 'Transmit',
);
$obj->colors = array(
'ifInDiscards' => '0000ff',
'ifOutDiscards' => '00b000',
);
$obj->rrd_title = sprintf('Interface Discards (%s)', $obj->args['tinstance']);
$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
break;

case 'net_if_unicast_pkts':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInUcastPkts', 'ifOutUcastPkts');
$obj->ds_names = array(
'ifInUcastPkts' => 'Receive',
'ifOutUcastPkts' => 'Transmit',
);
$obj->colors = array(
'ifInUcastPkts' => '0000ff',
'ifOutUcastPkts' => '00b000',
);
$obj->rrd_title = sprintf('Interface Unicast Packets (%s)', $obj->args['tinstance']);
$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
break;

case 'net_if_broadcast_pkts':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInBroadcastPkts', 'ifOutBroadcastPkts');
$obj->ds_names = array(
'ifInBroadcastPkts' => 'Receive',
'ifOutBroadcastPkts' => 'Transmit',
);
$obj->colors = array(
'ifInBroadcastPkts' => '0000ff',
'ifOutBroadcastPkts' => '00b000',
);
$obj->rrd_title = sprintf('Interface Broadcast Packets (%s)', $obj->args['tinstance']);
$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
break;

case 'net_if_multicast_pkts':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
$obj->data_sources = array('ifInMulticastPkts', 'ifOutMulticastPkts');
$obj->ds_names = array(
'ifInMulticastPkts' => 'Receive',
'ifOutMulticastPkts' => 'Transmit',
);
$obj->colors = array(
'ifInMulticastPkts' => '0000ff',
'ifOutMulticastPkts' => '00b000',
);
$obj->rrd_title = sprintf('Interface Multicast Packets (%s)', $obj->args['tinstance']);
$obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize']));
$obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
break;

case 'if_octets':
require_once 'type/GenericIO.class.php';
$obj = new Type_GenericIO($CONFIG);
Expand All @@ -22,12 +124,13 @@
$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;
break;

default:
require_once 'type/Default.class.php';
$obj = new Type_Default($CONFIG);
$obj->rrd_title = sprintf('SNMP: %s (%s)', $obj->args['type'], $obj->args['tinstance']);
return;
return;
}

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

0 comments on commit 68edff3

Please sign in to comment.