2010-07-28 12:59:59 +00:00
|
|
|
<?php
|
|
|
|
|
2011-03-16 01:11:27 +00:00
|
|
|
if ($device['os'] != "Snom")
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
echo(" ICMP");
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2012-05-25 12:24:34 +00:00
|
|
|
// Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$oids = array('icmpInMsgs','icmpOutMsgs','icmpInErrors','icmpOutErrors','icmpInEchos','icmpOutEchos','icmpInEchoReps',
|
|
|
|
'icmpOutEchoReps','icmpInDestUnreachs','icmpOutDestUnreachs','icmpInParmProbs','icmpInTimeExcds',
|
|
|
|
'icmpInSrcQuenchs','icmpInRedirects','icmpInTimestamps','icmpInTimestampReps','icmpInAddrMasks',
|
|
|
|
'icmpInAddrMaskReps','icmpOutTimeExcds','icmpOutParmProbs','icmpOutSrcQuenchs','icmpOutRedirects',
|
|
|
|
'icmpOutTimestamps','icmpOutTimestampReps','icmpOutAddrMasks','icmpOutAddrMaskReps');
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
unset($snmpstring, $rrdupdate, $snmpdata, $snmpdata_cmd, $rrd_create);
|
|
|
|
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-icmp.rrd";
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2012-04-20 17:37:58 +00:00
|
|
|
$rrd_create = $config['rrd_rra'];
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
foreach ($oids as $oid)
|
|
|
|
{
|
|
|
|
$oid_ds = truncate($oid, 19, '');
|
|
|
|
$rrd_create .= " DS:$oid_ds:COUNTER:600:U:100000000000";
|
|
|
|
$snmpstring .= " $oid.0";
|
|
|
|
}
|
2011-03-16 01:11:27 +00:00
|
|
|
|
2011-09-12 02:51:01 +00:00
|
|
|
$data_array = snmpwalk_cache_oid($device, "icmp", array(), "IP-MIB");
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$rrdupdate = "N";
|
2011-03-16 01:11:27 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
foreach ($oids as $oid)
|
|
|
|
{
|
|
|
|
if (is_numeric($data_array[0][$oid]))
|
2011-03-16 01:11:27 +00:00
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
$value = $data_array[0][$oid];
|
|
|
|
} else {
|
2011-10-18 17:32:01 +00:00
|
|
|
$value = "U";
|
2010-07-28 12:59:59 +00:00
|
|
|
}
|
2011-03-23 09:54:56 +00:00
|
|
|
$rrdupdate .= ":$value";
|
|
|
|
}
|
2011-03-16 01:11:27 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
unset($snmpstring);
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
if (isset($data_array[0]['icmpInMsgs']) && isset($data_array[0]['icmpOutMsgs']))
|
|
|
|
{
|
|
|
|
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
|
|
|
rrdtool_update($rrd_file, $rrdupdate);
|
|
|
|
$graphs['netstat_icmp'] = TRUE;
|
|
|
|
$graphs['netstat_icmp_info'] = TRUE;
|
|
|
|
}
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
unset($oids, $data, $data_array, $oid, $protos);
|
2010-07-28 12:59:59 +00:00
|
|
|
}
|
|
|
|
|
2011-09-12 02:35:58 +00:00
|
|
|
?>
|