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(" TCP");
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$oids = array ('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab',
|
|
|
|
'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts');
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
# $oids['tcp_collect'] = $oids['tcp'];
|
|
|
|
# $oids['tcp_collect'][] = 'tcpHCInSegs';
|
|
|
|
# $oids['tcp_collect'][] = 'tcpHCOutSegs';
|
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-tcp.rrd";
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$rrd_create = "RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600 \
|
|
|
|
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797";
|
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:10000000"; ## Limit to 10MPPS
|
|
|
|
$snmpstring .= " $oid.0";
|
|
|
|
}
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$snmpstring .= " tcpHCInSegs.0";
|
|
|
|
$snmpstring .= " tcpHCOutSegs.0";
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$data = snmp_get_multi($device, $snmpstring);
|
2011-03-16 01:11:27 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$rrdupdate = "N";
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
foreach ($oids as $oid)
|
|
|
|
{
|
|
|
|
if (is_numeric($data[0][$oid]))
|
2011-03-16 01:11:27 +00:00
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
$value = $data[0][$oid];
|
|
|
|
} else {
|
|
|
|
$value = "0";
|
2010-07-28 12:59:59 +00:00
|
|
|
}
|
2011-03-23 09:54:56 +00:00
|
|
|
$rrdupdate .= ":$value";
|
|
|
|
}
|
2010-07-28 12:59:59 +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[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs']))
|
|
|
|
{
|
|
|
|
if (!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); }
|
|
|
|
rrdtool_update($rrd_file, $rrdupdate);
|
|
|
|
$graphs['netstat_tcp'] = 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-03-23 09:54:56 +00:00
|
|
|
?>
|