2009-09-07 11:07:59 +00:00
|
|
|
<?php
|
2007-04-08 18:08:50 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo "Polling SNOM device...\n";
|
2011-03-15 11:59:47 +00:00
|
|
|
|
|
|
|
// Get SNOM specific version string from silly SNOM location. Silly SNOM!
|
2012-05-25 12:24:34 +00:00
|
|
|
// FIXME - This needs a good cleanup...
|
2015-07-13 20:10:26 +02:00
|
|
|
$cmd = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.4';
|
|
|
|
$poll_device['sysDescr'] = `$cmd`;
|
|
|
|
$poll_device['sysDescr'] = str_replace('-', ' ', $poll_device['sysDescr']);
|
|
|
|
$poll_device['sysDescr'] = str_replace('"', '', $poll_device['sysDescr']);
|
|
|
|
list($hardware, $features, $version) = explode(' ', $poll_device['sysDescr']);
|
2011-03-15 11:59:47 +00:00
|
|
|
|
|
|
|
// Get data for calls and network from SNOM specific SNMP OIDs.
|
2015-07-13 20:10:26 +02:00
|
|
|
$cmda = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 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';
|
|
|
|
$cmdb = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6';
|
|
|
|
// echo($cmda);
|
|
|
|
$snmpdata = `$cmda`;
|
2011-03-15 11:59:47 +00:00
|
|
|
$snmpdatab = `$cmdb`;
|
|
|
|
|
|
|
|
list($rxbytes, $rxpkts, $txbytes, $txpkts) = explode("\n", $snmpdata);
|
2015-07-13 20:10:26 +02:00
|
|
|
list($calls, $registrations) = explode("\n", $snmpdatab);
|
|
|
|
$txbytes = (0 - $txbytes * 8);
|
|
|
|
$rxbytes = (0 - $rxbytes * 8);
|
|
|
|
echo "$rxbytes, $rxpkts, $txbytes, $txpkts, $calls, $registrations";
|
|
|
|
|
|
|
|
$rrdfile = $config['rrd_dir'].'/'.$device['hostname'].'/data.rrd';
|
|
|
|
if (!is_file($rrdfile)) {
|
|
|
|
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 '.$config['rrd_rra']
|
|
|
|
);
|
2011-03-15 11:59:47 +00:00
|
|
|
}
|
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields = array(
|
|
|
|
'INOCTETS' => $rxbytes,
|
|
|
|
'OUTOCTETS' => $txbytes,
|
|
|
|
'INPKTS' => $rxpkts,
|
|
|
|
'OUTPKTS' => $rxbytes,
|
|
|
|
'CALLS' => $calls,
|
|
|
|
'REGISTRATIONS' => $registrations,
|
|
|
|
);
|
|
|
|
|
|
|
|
rrdtool_update("$rrdfile", $fields);
|