banshee est en développement actif : les collecteurs vont encore changer, et une version que vous publiez demandera sans doute des ajustements. Pour un usage stable, attendez la version 1.0.0.

Network

banshee/network-collection/network/cisco/snmp/ios/

environment

The environment of a Cisco IOS or IOS-XE device by SNMP (CISCO-ENVMON-MIB): temperatures, fans and power supplies.

  • network
  • snmp
  • cisco
  • ios
  • ios-xe
  • temperature
  • fan
  • power-supply

par banshee1 installation2 versions

v2Dernière

Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.

Keen 1.0.0 · 77 lignes
// The environment of a Cisco IOS or IOS-XE device, by SNMP (CISCO-ENVMON-MIB): the state of each
// temperature sensor, fan and power supply, as the device judges it against its own thresholds, and each
// temperature. A part is named by the description the device gives it ("Switch 1 - FAN 1"). A part that
// is not present (an empty power supply slot) reads "not-present" and raises nothing.
need('protocol:snmp');

per('part', 'Parts');
output('state', 'text', array('label' => 'State', 'per' => 'part'));
output('temperature', 'number', array('label' => 'Temperature', 'unit' => '°C', 'per' => 'part'));

watch.state('fault', 'Hardware fault', 'state', array(
    'warning'  => array('warning'),
    'critical' => array('critical', 'shutdown', 'not-functioning'),
));
watch.above('hot', 'High temperature', 'temperature', array(
    'help'    => 'Raises beyond the temperatures set on the probe; the device already judges its own thresholds in "Hardware fault".',
    'enabled' => false,
));
watch.missing('missing', 'Part missing', 'state', array('enabled' => false));

// CiscoEnvMonState in words.
$states = array(1 => 'normal', 2 => 'warning', 3 => 'critical', 4 => 'shutdown', 5 => 'not-present', 6 => 'not-functioning');

// ciscoEnvMonTemperatureStatusTable: Descr, Value (in degrees Celsius) and State. ciscoEnvMonFanStatusTable
// and ciscoEnvMonSupplyStatusTable: Descr and State.
$temperatures = snmp.table(array(
    'description' => '1.3.6.1.4.1.9.9.13.1.3.1.2',
    'value'       => '1.3.6.1.4.1.9.9.13.1.3.1.3',
    'state'       => '1.3.6.1.4.1.9.9.13.1.3.1.6',
));
$fans = snmp.table(array(
    'description' => '1.3.6.1.4.1.9.9.13.1.4.1.2',
    'state'       => '1.3.6.1.4.1.9.9.13.1.4.1.3',
));
$supplies = snmp.table(array(
    'description' => '1.3.6.1.4.1.9.9.13.1.5.1.2',
    'state'       => '1.3.6.1.4.1.9.9.13.1.5.1.3',
));

// One list of the three, each row with the word that names its sort when it has no description.
$parts = array();
foreach ($temperatures as $index => $row) {
    $row['sort'] = 'temperature';
    $row['index'] = $index;
    $parts = list.add($parts, $row);
}
foreach ($fans as $index => $row) {
    $row['sort'] = 'fan';
    $row['index'] = $index;
    $parts = list.add($parts, $row);
}
foreach ($supplies as $index => $row) {
    $row['sort'] = 'power supply';
    $row['index'] = $index;
    $parts = list.add($parts, $row);
}
if (list.count($parts) == 0) {
    fail('misconfigured', 'The agent serves no environment (CISCO-ENVMON-MIB)',
        'A device that does not implement CISCO-ENVMON-MIB, such as NX-OS, or a view that does not grant it to the poller.');
}

$seen = array();
foreach ($parts as $part) {
    $name = list.get($part, 'description', '');
    if ($name == '') {
        $name = $part['sort'] . ' ' . $part['index'];
    }
    if (list.has($seen, $name)) {
        $name = $name . ' #' . $part['index'];
    }
    $seen[$name] = true;
    $state = list.get($states, list.get($part, 'state', 0), 'unknown');
    value('state', $state, $name);
    if ($state != 'not-present' && list.has($part, 'value')) {
        value('temperature', $part['value'], $name);
    }
}