Network
banshee/network-collection/network/cisco/snmp/
memory
The memory pools of a Cisco device by SNMP (CISCO-ENHANCED-MEMPOOL-MIB, or CISCO-MEMORY-POOL-MIB): used, free, share used.
by banshee1 installation2 versions
v2Latest
Published on October 28, 2026. One naming convention across collections; documentation completed.
// The memory pools of a Cisco device, by SNMP: for each pool ("Processor", "I/O"), the memory used and
// free and the share used. CISCO-ENHANCED-MEMPOOL-MIB is read first, its 64-bit counters when the agent
// serves them; a device that does not serve it is read by the older CISCO-MEMORY-POOL-MIB. The "source"
// output says which one was read. Only the pools the agent marks valid are returned.
need('protocol:snmp');
per('pool', 'Memory pools');
output('used-percent', 'number', array('label' => 'Used memory', 'unit' => '%', 'per' => 'pool'));
output('used', 'number', array('label' => 'Used memory', 'unit' => 'MiB', 'per' => 'pool'));
output('free', 'number', array('label' => 'Free memory', 'unit' => 'MiB', 'per' => 'pool'));
output('source', 'text', array('label' => 'MIB read'));
watch.above('memory-high', 'Memory saturated', 'used-percent', array('warning' => 80, 'critical' => 90, 'for' => '3 runs'));
watch.below('free', 'Little free memory', 'free', array('critical' => 32, 'enabled' => false));
// cempMemPoolTable, by entPhysicalIndex and cempMemPoolIndex: cempMemPoolName, cempMemPoolValid,
// cempMemPoolUsed and cempMemPoolFree (32 bits, in bytes), cempMemPoolHCUsed and cempMemPoolHCFree (64 bits).
$pools = snmp.table(array(
'name' => '1.3.6.1.4.1.9.9.221.1.1.1.1.3',
'valid' => '1.3.6.1.4.1.9.9.221.1.1.1.1.6',
'used' => '1.3.6.1.4.1.9.9.221.1.1.1.1.7',
'free' => '1.3.6.1.4.1.9.9.221.1.1.1.1.8',
'hc-used' => '1.3.6.1.4.1.9.9.221.1.1.1.1.18',
'hc-free' => '1.3.6.1.4.1.9.9.221.1.1.1.1.20',
));
$source = 'cisco-enhanced-mempool-mib';
if (list.count($pools) == 0) {
// ciscoMemoryPoolTable, by ciscoMemoryPoolType: ciscoMemoryPoolName, ciscoMemoryPoolValid,
// ciscoMemoryPoolUsed and ciscoMemoryPoolFree, in bytes.
$pools = snmp.table(array(
'name' => '1.3.6.1.4.1.9.9.48.1.1.1.2',
'valid' => '1.3.6.1.4.1.9.9.48.1.1.1.4',
'used' => '1.3.6.1.4.1.9.9.48.1.1.1.5',
'free' => '1.3.6.1.4.1.9.9.48.1.1.1.6',
));
$source = 'cisco-memory-pool-mib';
}
// A pool counts when the agent marks it valid (TruthValue true, 1) and gives its used and free memory.
$read = 0;
$seen = array();
foreach ($pools as $index => $row) {
if (list.get($row, 'valid', 2) != 1) {
continue;
}
$used = list.get($row, 'hc-used', list.get($row, 'used', ''));
$free = list.get($row, 'hc-free', list.get($row, 'free', ''));
if ($used == '' || $free == '' || $used + $free <= 0) {
continue;
}
// Two pools of the same name (one per member of a stack, per module) each keep their own: the second
// carries its index.
$name = list.get($row, 'name', '');
if ($name == '') {
$name = 'pool ' . $index;
}
if (list.has($seen, $name)) {
$name = $name . ' #' . $index;
}
$seen[$name] = true;
$read = $read + 1;
value('used-percent', number.round(100 * $used / ($used + $free), 1), $name);
value('used', number.round($used / 1048576), $name);
value('free', number.round($free / 1048576), $name);
}
if ($read == 0) {
fail('misconfigured', 'The agent serves no valid memory pool (CISCO-ENHANCED-MEMPOOL-MIB, CISCO-MEMORY-POOL-MIB)',
'A device that implements neither, or a view that does not grant them to the poller.');
}
value('source', $source);