Network
banshee/network-collection/network/cisco/snmp/
cpu
The processor load of a Cisco IOS, IOS-XE or NX-OS device by SNMP (CISCO-PROCESS-MIB), over 5 seconds, 1 and 5 minutes.
par banshee1 installation2 versions
v2Dernière
Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.
// The processor load of a Cisco device, by SNMP (CISCO-PROCESS-MIB, cpmCPUTotalTable): for each processor,
// its load over the last 5 seconds, minute and 5 minutes, as the device itself averages them. A processor
// is named by the part it sits on (entPhysicalName, ENTITY-MIB): "CPU of Switch 1", "module 1".
// The "Rev" objects are read first; an older IOS that serves only the former ones is read by those.
need('protocol:snmp');
per('cpu', 'Processors');
output('busy-5s', 'number', array('label' => 'Load over 5 seconds', 'unit' => '%', 'per' => 'cpu'));
output('busy-1m', 'number', array('label' => 'Load over 1 minute', 'unit' => '%', 'per' => 'cpu'));
output('busy-5m', 'number', array('label' => 'Load over 5 minutes', 'unit' => '%', 'per' => 'cpu'));
watch.above('cpu-high', 'Processor saturated', 'busy-5m', array('warning' => 80, 'critical' => 90, 'for' => '3 runs'));
watch.above('cpu-peak', 'Processor peak', 'busy-1m', array('warning' => 95, 'for' => '3 runs', 'enabled' => false));
// cpmCPUTotalTable, by cpmCPUTotalIndex: cpmCPUTotalPhysicalIndex (0 when the processor is tied to no
// part), cpmCPUTotal5secRev, cpmCPUTotal1minRev, cpmCPUTotal5minRev, and the former cpmCPUTotal5sec,
// cpmCPUTotal1min and cpmCPUTotal5min.
$cpus = snmp.table(array(
'entity' => '1.3.6.1.4.1.9.9.109.1.1.1.1.2',
'old-5s' => '1.3.6.1.4.1.9.9.109.1.1.1.1.3',
'old-1m' => '1.3.6.1.4.1.9.9.109.1.1.1.1.4',
'old-5m' => '1.3.6.1.4.1.9.9.109.1.1.1.1.5',
'busy-5s' => '1.3.6.1.4.1.9.9.109.1.1.1.1.6',
'busy-1m' => '1.3.6.1.4.1.9.9.109.1.1.1.1.7',
'busy-5m' => '1.3.6.1.4.1.9.9.109.1.1.1.1.8',
));
if (list.count($cpus) == 0) {
fail('misconfigured', 'The agent serves no processor (cpmCPUTotalTable, CISCO-PROCESS-MIB)',
'A device that does not implement CISCO-PROCESS-MIB, or a view that does not grant it to the poller.');
}
// ENTITY-MIB, entPhysicalName, by entPhysicalIndex.
$names = snmp.walk('1.3.6.1.2.1.47.1.1.1.1.7');
$seen = array();
foreach ($cpus as $index => $row) {
$name = list.get($names, list.get($row, 'entity', 0), '');
if ($name == '') {
$name = 'cpu ' . $index;
}
if (list.has($seen, $name)) {
$name = $name . ' #' . $index;
}
$seen[$name] = true;
// A load the agent does not serve is not returned: never a zero in its place.
$busy = list.get($row, 'busy-5s', list.get($row, 'old-5s', ''));
if ($busy != '') {
value('busy-5s', $busy, $name);
}
$busy = list.get($row, 'busy-1m', list.get($row, 'old-1m', ''));
if ($busy != '') {
value('busy-1m', $busy, $name);
}
$busy = list.get($row, 'busy-5m', list.get($row, 'old-5m', ''));
if ($busy != '') {
value('busy-5m', $busy, $name);
}
}