Network
banshee/network-collection/network/cisco/snmp/ios/
stack
A stack of Cisco Catalyst switches by SNMP (CISCO-STACKWISE-MIB): the role and state of each member, and the stack ring.
by banshee1 installation2 versions
// A stack of Cisco Catalyst switches, by SNMP (CISCO-STACKWISE-MIB), which IOS and IOS-XE serve on
// stackable Catalyst switches (StackWise): the role and the state of each member, the number of members,
// and whether the stack cables close the ring, so that one cable more can be lost without splitting the
// stack. A member is named by its switch number ("switch 2").
need('protocol:snmp');
per('member', 'Members');
output('role', 'text', array('label' => 'Role', 'per' => 'member'));
output('state', 'text', array('label' => 'State', 'per' => 'member'));
output('members', 'number', array('label' => 'Members'));
output('ring', 'text', array('label' => 'Stack ring'));
watch.expect('not-ready', 'Member not ready', 'state', array(
'help' => 'Critical when a member stays in another state than ready: a version mismatch, a member removed.',
'critical' => array('ready'),
'for' => '3 runs',
));
watch.state('ring-broken', 'Stack ring broken', 'ring', array('warning' => array('not-redundant')));
watch.expect('member-count', 'Unexpected number of members', 'members', array(
'help' => 'Raises when the stack counts another number of members than the one set on the probe.',
'enabled' => false,
));
watch.missing('missing', 'Missing member', 'state', array('enabled' => false));
// cswSwitchInfoTable, by entPhysicalIndex: cswSwitchNumCurrent, cswSwitchRole and cswSwitchState.
$switches = snmp.table(array(
'number' => '1.3.6.1.4.1.9.9.500.1.2.1.1.1',
'role' => '1.3.6.1.4.1.9.9.500.1.2.1.1.3',
'state' => '1.3.6.1.4.1.9.9.500.1.2.1.1.6',
));
if (list.count($switches) == 0) {
fail('misconfigured', 'The agent serves no stack (cswSwitchInfoTable, CISCO-STACKWISE-MIB)',
'A switch that is not stackable, or a view that does not grant CISCO-STACKWISE-MIB to the poller.');
}
// cswSwitchRole and cswSwitchState in words.
$roles = array(1 => 'master', 2 => 'member', 3 => 'not-member', 4 => 'standby');
$states = array(
1 => 'waiting', 2 => 'progressing', 3 => 'added', 4 => 'ready', 5 => 'sdm-mismatch', 6 => 'version-mismatch',
7 => 'feature-mismatch', 8 => 'new-master-init', 9 => 'provisioned', 10 => 'invalid', 11 => 'removed',
);
$count = 0;
foreach ($switches as $index => $row) {
$name = 'switch ' . list.get($row, 'number', $index);
value('role', list.get($roles, list.get($row, 'role', 0), 'unknown'), $name);
value('state', list.get($states, list.get($row, 'state', 0), 'unknown'), $name);
$count = $count + 1;
}
value('members', $count);
// cswRingRedundant, TruthValue: true (1) when the stack ring is closed.
$ring = 'not-redundant';
if (snmp.get('1.3.6.1.4.1.9.9.500.1.1.3.0') == 1) {
$ring = 'redundant';
}
value('ring', $ring);