$switch_counter_oids = array('wlsxSwitchTotalNumAccessPoints.0', 'wlsxSwitchTotalNumStationsAssociated.0'); $switch_apinfo_oids = array('wlsxWlanRadioEntry', 'wlanAPChInterferenceIndex'); $switch_apname_oids = array('wlsxWlanRadioEntry.16'); $aruba_oids = array_merge($switch_info_oids, $switch_counter_oids); echo 'Caching Oids: '; foreach ($aruba_oids as $oid) { echo "{$oid} "; $aruba_stats = snmpwalk_cache_oid($device, $oid, $aruba_stats, 'WLSX-SWITCH-MIB'); } foreach ($switch_apinfo_oids as $oid) { echo "{$oid} "; $aruba_apstats = snmpwalk_cache_oid_num($device, $oid, $aruba_apstats, 'WLSX-WLAN-MIB'); } foreach ($switch_apname_oids as $oid) { echo "{$oid} "; $aruba_apnames = snmpwalk_cache_oid_num($device, $oid, $aruba_apnames, 'WLSX-WLAN-MIB'); } echo "\n"; $rrdfile = $host_rrd . '/aruba-controller' . safename('.rrd'); if (!is_file($rrdfile)) { rrdtool_create($rrdfile, ' --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 ' . $config['rrd_rra']); } $fields = array('NUMAPS' => $aruba_stats[0]['wlsxSwitchTotalNumAccessPoints'], 'NUMCLIENTS' => $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']); $ret = rrdtool_update($rrdfile, $fields); // also save the info about how many clients in the same place as the wireless module $wificlientsrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('wificlients-radio1.rrd'); if (!is_file($wificlientsrrd)) { rrdtool_create($wificlientsrrd, '--step 300 DS:wificlients:GAUGE:600:-273:10000 ' . $config['rrd_rra']); } $fields = array('wificlients' => $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']); rrdtool_update($wificlientsrrd, $fields);
* * Copyright (c) 2015 Aaron Daniels <*****@*****.**> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os_group'] == "cisco") { // Total $total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.7.1.0", NULL); $total = $total['1.3.6.1.4.1.9.9.86.1.7.1.0']['']; if (isset($total) && $total != "" && $total != 0) { // Available $available = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.7.2.0", NULL); $available = $available['1.3.6.1.4.1.9.9.86.1.7.2.0']['']; // Active $active = $total - $available; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cisco-iosxcode.rrd"); if (!file_exists($rrd_filename)) { rrdtool_create($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']); } $fields = array('total' => $total, 'active' => $active); rrdtool_update($rrd_filename, $fields); $tags = array(); influx_update($device, 'cisco-iosxcode', $tags, $fields); $graphs['cisco-iosxcode'] = TRUE; echo " Cisco IOS Transcoder "; } unset($rrd_filename, $total, $active, $available);
* Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os_group'] == "cisco") { // TODO: Need to test partial PRI. // Total $total = 0; foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.2.1.2.2.1.3", NULL) as $key => $value) { // 81 is the ifType for DS0's if ($value[''] == "81") { $total++; } } // Active $active = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.10.19.1.1.4.0", NULL); $active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0']['']; if (isset($active) && $active != "" && $total != 0) { $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cisco-iospri.rrd"); if (!file_exists($rrd_filename)) { rrdtool_create($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']); } $fields = array('total' => $total, 'active' => $active); rrdtool_update($rrd_filename, $fields); $tags = array(); influx_update($device, 'cisco-iospri', $tags, $fields); $graphs['cisco-iospri'] = TRUE; echo " Cisco IOS PRI "; } unset($rrd_filename, $total, $active); }
* This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os_group'] == "cisco") { // Total $total = 0; foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.6", NULL) as $key => $value) { $total += $value['']; } if (isset($total) && $total != "" && $total != 0) { // Active $active = 0; foreach (snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.2.1.1.7", NULL) as $key => $value) { $active += $value['']; } $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cisco-iosdsp.rrd"); if (!file_exists($rrd_filename)) { rrdtool_create($rrd_filename, " DS:total:GAUGE:600:0:U DS:active:GAUGE:600:0:U" . $config['rrd_rra']); } $fields = array('total' => $total, 'active' => $active); rrdtool_update($rrd_filename, $fields); $tags = array(); influx_update($device, 'cisco-iosdsp', $tags, $fields); $graphs['cisco-iosdsp'] = TRUE; echo " Cisco IOS DSP "; } unset($rrd_filename, $total, $active); }
$switch_counter_oids = array('wlsxSwitchTotalNumAccessPoints.0', 'wlsxSwitchTotalNumStationsAssociated.0'); $switch_apinfo_oids = array('wlsxWlanRadioEntry', 'wlanAPChInterferenceIndex'); $switch_apname_oids = array('wlsxWlanRadioEntry.16'); $aruba_oids = array_merge($switch_info_oids, $switch_counter_oids); echo "Caching Oids: "; foreach ($aruba_oids as $oid) { echo "{$oid} "; $aruba_stats = snmpwalk_cache_oid($device, $oid, $aruba_stats, "WLSX-SWITCH-MIB", mib_dirs(array("aruba"))); } foreach ($switch_apinfo_oids as $oid) { echo "{$oid} "; $aruba_apstats = snmpwalk_cache_oid_num($device, $oid, $aruba_apstats, "WLSX-WLAN-MIB", mib_dirs(array("aruba"))); } foreach ($switch_apname_oids as $oid) { echo "{$oid} "; $aruba_apnames = snmpwalk_cache_oid_num($device, $oid, $aruba_apnames, "WLSX-WLAN-MIB", mib_dirs(array("aruba"))); } echo "\n"; $rrdfile = $host_rrd . "/aruba-controller.rrd"; rrdtool_create($device, $rrdfile, "DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 "); $cont_rrd_update = "{$polled}:" . $aruba_stats[0]['wlsxSwitchTotalNumAccessPoints'] . ":" . $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']; $ret = rrdtool_update($device, $rrdfile, $cont_rrd_update); $graphs['arubacontroller_numclients'] = TRUE; $graphs['arubacontroller_numaps'] = TRUE; // also save the info about how many clients in the same place as the wireless module $wificlientsrrd = "wificlients-radio1.rrd"; rrdtool_create($device, $wificlientsrrd, "DS:wificlients:GAUGE:600:-273:10000 "); rrdtool_update($device, $wificlientsrrd, "N:" . $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']); $graphs['wifi_clients'] = TRUE; foreach ($aruba_apnames as $key => $value) { $radioid = str_replace("1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.16.", "", $key);
/* * LibreNMS module to Graph Hardware MTP Resources in a Cisco Voice Router * * Copyright (c) 2015 Aaron Daniels <*****@*****.**> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os_group'] == "cisco") { // Total $total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.6.4.1.3", null); $total = $total['1.3.6.1.4.1.9.9.86.1.6.4.1.3']['']; if (isset($total) && $total != "" && $total != 0) { // Available $available = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.6.4.1.4", null); $available = $available['1.3.6.1.4.1.9.9.86.1.6.4.1.4']['']; // Active $active = $total - $available; $rrd_def = array('DS:total:GAUGE:600:0:U', 'DS:active:GAUGE:600:0:U'); $fields = array('total' => $total, 'active' => $active); $tags = compact('rrd_def'); data_update($device, 'cisco-iosmtp', $tags, $fields); $graphs['cisco-iosmtp'] = true; echo " Cisco IOS MTP "; } unset($rrd_def, $total, $active, $available, $fields, $tags); }
} //end if discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $index); $index++; } //end if } //end foreach $index = 1; $state_name = 'ibm-amm_PowerModuleState'; $state_descr = 'Power Module '; $powerModuleStateOid = '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.3'; // BLADE-MIB::powerModuleState $data = snmpwalk_cache_oid_num($device, $powerModuleStateOid, array()); /* BLADE-MIB: powerModuleState * unknown(0), * good(1), * warning(2), * notAvailable(3), * critical(4) */ foreach ($data as $oid => $array) { $state = current($array); // get the first (and only) item from the array $descr = $state_descr . $index; if (is_numeric($state) && $state != 3) { $state_index_id = create_state_index($state_name); if ($state_index_id) { $states = array(array($state_index_id, 'unknown', 0, 0, 3), array($state_index_id, 'good', 1, 1, 0), array($state_index_id, 'warning', 1, 2, 1), array($state_index_id, 'notAvailable', 1, 3, -1), array($state_index_id, 'critical', 1, 4, 2));
$descr = 'Output'; $type = 'sinetica'; $index = '4.2.0'; discover_sensor($valid['sensor'], 'frequency', $device, $output_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } $bypass_oid = '.1.3.6.1.4.1.13891.101.5.1.0'; $bypass_current = snmp_get($device, $bypass_oid, '-Oqv'); if (!empty($bypass_current) || $bypass_current == 0) { $divisor = 10; $current = $bypass_current / $divisor; $descr = 'Bypass'; $type = 'sinetica'; $index = '5.1.0'; discover_sensor($valid['sensor'], 'frequency', $device, $bypass_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } $oids = snmpwalk_cache_oid_num($device, '.1.3.6.1.4.1.13891.101.3.3.1.2', array()); foreach ($oids as $oid => $data) { $current_id = substr($oid, strrpos($oid, '.') + 1); $current_oid = ".{$oid}"; $descr = 'Input'; if (count($oids) > 1) { $descr .= " Phase {$current_id}"; } $divisor = 10; $current = current($data) / $divisor; $type = 'sinetica'; $index = '3.3.1.2.' . $current_id; discover_sensor($valid['sensor'], 'frequency', $device, $current_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current); } } //end if
* Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os'] == 'nxos') { $fan_tray_oid = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1'; $fan_trays = snmpwalk_cache_oid_num($device, $fan_tray_oid, array()); /* CISCO-ENTITY-FRU-CONTROL-MIB cefcFanTrayOperStatus * unknown(1), * up(2), * down(3), * warning(4) */ if (is_array($fan_trays)) { $entity_oid = '.1.3.6.1.2.1.47.1.1.1.1.7'; $entities = snmpwalk_cache_oid_num($device, $entity_oid, array()); foreach ($fan_trays as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); $index = $split_oid[count($split_oid) - 1]; $current_oid = "{$fan_tray_oid}.{$index}"; $descr = current($entities["{$entity_oid}.{$index}"]); $state_name = "cefcFanTrayOperStatus"; $state_index_id = create_state_index($state_name); if ($state_index_id !== null) { $states = array(array($state_index_id, 'unknown', 0, 1, 3), array($state_index_id, 'up', 1, 2, 0), array($state_index_id, 'down', 1, 3, 2), array($state_index_id, 'warning', 1, 4, 1)); foreach ($states as $value) { $insert = array('state_index_id' => $value[0], 'state_descr' => $value[1], 'state_draw_graph' => $value[2], 'state_value' => $value[3], 'state_generic_value' => $value[4]); dbInsert($insert, 'state_translations'); } }
<?php /* * LibreNMS NX-OS Fan state * * Copyright (c) 2016 Dave Bell <*****@*****.**> * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if ($device['os'] == 'nxos') { $fan_tray_oid = '.1.3.6.1.4.1.9.9.117.1.4.1.1.1'; $fan_trays = snmpwalk_cache_oid_num($device, $fan_tray_oid, array()); /* CISCO-ENTITY-FRU-CONTROL-MIB cefcFanTrayOperStatus * unknown(1), * up(2), * down(3), * warning(4) */ if (is_array($fan_trays)) { foreach ($fan_trays as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); $index = $split_oid[count($split_oid) - 1]; $current_oid = "{$fan_tray_oid}.{$index}"; $entity_oid = '.1.3.6.1.2.1.47.1.1.1.1.7'; $descr = trim(snmp_get($device, "{$entity_oid}.{$index}", '-Ovq'), '"'); $state_name = "cefcFanTrayOperStatus"; $state_index_id = create_state_index($state_name);