2007-04-03 14:10:23 +00:00
|
|
|
<?
|
|
|
|
|
|
|
|
include("snom-graphing.php");
|
|
|
|
|
|
|
|
function pollDeviceSNOM() {
|
|
|
|
|
|
|
|
global $device;
|
|
|
|
global $community;
|
|
|
|
$snmpver = $device['snmpver'];
|
2007-04-08 14:34:19 +00:00
|
|
|
$id = $device['device_id'];
|
2007-04-03 14:10:23 +00:00
|
|
|
$hostname = $device['hostname'];
|
|
|
|
$hardware = $device['hardware'];
|
|
|
|
$version = $device['version'];
|
|
|
|
$features = $device['features'];
|
|
|
|
$location = $device['location'];
|
|
|
|
|
|
|
|
$snmpdata = `snmpget -Ovq -$snmpver -c $community $hostname 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2`;
|
|
|
|
$snmpdatab = `snmpget -Oqv -$snmpver -c $community $hostname 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6`;
|
|
|
|
list($rxbytes, $rxpkts, $txbytes, $txpkts) = explode("\n", $snmpdata);
|
|
|
|
list($calls, $registrations) = explode("\n", $snmpdatab);
|
|
|
|
$txbytes = 0 - $txbytes * 8;
|
|
|
|
$rxbytes = 0 - $rxbytes * 8;
|
|
|
|
echo("$rxbytes, $rxpkts, $txbytes, $txpkts, $calls, $registrations");
|
|
|
|
|
|
|
|
$rrdfile = "rrd/" . $hostname . "-data.rrd";
|
|
|
|
if(!is_file($rrdfile)) {
|
|
|
|
$woo = `rrdtool create $rrdfile \
|
|
|
|
DS:INOCTETS:COUNTER:600:U:100000000000 \
|
|
|
|
DS:OUTOCTETS:COUNTER:600:U:10000000000 \
|
|
|
|
DS:INPKTS:COUNTER:600:U:10000000000 \
|
|
|
|
DS:OUTPKTS:COUNTER:600:U:10000000000 \
|
|
|
|
DS:CALLS:COUNTER:600:U:10000000000 \
|
|
|
|
DS:REGISTRATIONS:COUNTER:600:U:10000000000 \
|
|
|
|
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`;
|
|
|
|
}
|
|
|
|
|
|
|
|
$rrdupdate = "N:$rxbytes:$txbytes:$rxpkts:$rxbytes:$calls:$registrations";
|
2008-03-09 21:13:27 +00:00
|
|
|
$ret = rrdtool_update("$rrdfile", $rrdupdate);
|
2007-04-03 14:10:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|