Tony Murray b9dc7773d7 refactor: Don't do unneeded snmp queries (#7841)
* Don't do uneeded snmp queries
sensors discovery 26 -> 16
wrapped some poller modules in db checks.  The same could be done for some others, but more work is needed.

* travis fix
2017-12-02 23:18:45 +00:00

48 lines
1.7 KiB
PHP

<?php
use LibreNMS\RRD\RrdDefinition;
echo "Cisco Cat6xxx/76xx Crossbar : \n";
$mod_stats = snmpwalk_cache_oid($device, 'cc6kxbarModuleModeTable', array(), 'CISCO-CAT6K-CROSSBAR-MIB');
foreach ($mod_stats as $index => $entry) {
$group = 'c6kxbar';
foreach ($entry as $key => $value) {
$subindex = null;
$entPhysical_state[$index][$subindex][$group][$key] = $value;
}
}
$chan_stats = snmpwalk_cache_oid($device, 'cc6kxbarModuleChannelTable', array(), 'CISCO-CAT6K-CROSSBAR-MIB');
if (!empty($chan_stats)) {
$chan_stats = snmpwalk_cache_oid($device, 'cc6kxbarStatisticsTable', $chan_stats, 'CISCO-CAT6K-CROSSBAR-MIB');
}
foreach ($chan_stats as $index => $entry) {
list($index,$subindex) = explode('.', $index, 2);
$group = 'c6kxbar';
foreach ($entry as $key => $value) {
$entPhysical_state[$index][$subindex][$group][$key] = $value;
}
$rrd_name = array('c6kxbar', $index, $subindex);
$rrd_def = RrdDefinition::make()
->addDataset('inutil', 'GAUGE', 0, 100)
->addDataset('oututil', 'GAUGE', 0, 100)
->addDataset('outdropped', 'DERIVE', 0, 125000000000)
->addDataset('outerrors', 'DERIVE', 0, 125000000000)
->addDataset('inerrors', 'DERIVE', 0, 125000000000);
$fields = array(
'inutil' => $entry['cc6kxbarStatisticsInUtil'],
'oututil' => $entry['cc6kxbarStatisticsOutUtil'],
'outdropped' => $entry['cc6kxbarStatisticsOutDropped'],
'outerrors' => $entry['cc6kxbarStatisticsOutErrors'],
'inerrors' => $entry['cc6kxbarStatisticsInErrors'],
);
$tags = compact('index', 'subindex', 'rrd_name', 'rrd_def');
data_update($device, 'c6kxbar', $tags, $fields);
}//end foreach