mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* refactor: Updated discovery to use a core module for sysDescr/sysObjectID use * final update hopefully * revert changes * more changes + docs * migrated poller to use numerical sysObjectID * more updates for sysObjectID * update any alert rules which might have enterprises. in * moved schema file * small updates * updated getHostOS() * scrut fixes * updated sysObjectId -> sysObjectID * updated sysObjectId -> sysObjectID * updated remainder of sysObjectId -> sysObjectID * another sysObjectId -> sysObjectID * fixed secureplatform test data * Fix tests: $device is not pulled from the database before polling Also, update the db in the core discovery module.
48 lines
2.0 KiB
PHP
48 lines
2.0 KiB
PHP
<?php
|
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
echo "Polling SNOM device...\n";
|
|
|
|
// Get SNOM specific version string from silly SNOM location. Silly SNOM!
|
|
// FIXME - This needs a good cleanup...
|
|
$cmd = 'snmpget -O qv '.snmp_gen_auth($device).' '.$device['hostname'].':'.$device['port'].' 1.3.6.1.2.1.7526.2.4';
|
|
$device['sysDescr'] = `$cmd`;
|
|
$device['sysDescr'] = str_replace('-', ' ', $device['sysDescr']);
|
|
$device['sysDescr'] = str_replace('"', '', $device['sysDescr']);
|
|
list($hardware, $features, $version) = explode(' ', $device['sysDescr']);
|
|
|
|
// Get data for calls and network from SNOM specific SNMP OIDs.
|
|
$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);poll
|
|
$snmpdata = `$cmda`;
|
|
$snmpdatab = `$cmdb`;
|
|
|
|
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";
|
|
|
|
$rrd_name = 'data';
|
|
$rrd_def = RrdDefinition::make()
|
|
->addDataset('INOCTETS', 'COUNTER', null, 100000000000)
|
|
->addDataset('OUTOCTETS', 'COUNTER', null, 10000000000)
|
|
->addDataset('INPKTS', 'COUNTER', null, 10000000000)
|
|
->addDataset('OUTPKTS', 'COUNTER', null, 10000000000)
|
|
->addDataset('CALLS', 'COUNTER', null, 10000000000)
|
|
->addDataset('REGISTRATIONS', 'COUNTER', null, 10000000000);
|
|
|
|
$fields = array(
|
|
'INOCTETS' => $rxbytes,
|
|
'OUTOCTETS' => $txbytes,
|
|
'INPKTS' => $rxpkts,
|
|
'OUTPKTS' => $rxbytes,
|
|
'CALLS' => $calls,
|
|
'REGISTRATIONS' => $registrations,
|
|
);
|
|
|
|
$tags = compact('rrd_name', 'rrd_def');
|
|
data_update($device, 'snom-data', $tags, $fields);
|