function poll_mibs($device, &$graphs) { if (!is_mib_poller_enabled($device)) { return; } echo 'MIB: polling '; d_echo("\n"); foreach (load_device_mibs($device) as $name => $module) { echo "{$name} "; d_echo("\n"); $oids = snmpwalk_cache_oid($device, $name, array(), $module, null, "-OQUsb"); d_print_r($oids); save_mibs($device, $name, $oids, load_mibdefs($module, $name), $graphs); } echo "\n"; }
* * Copyright (c) 2016 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 (is_admin() !== false) { // Build the types list. $dir = $config['nagios_plugins']; if (file_exists($dir) && is_dir($dir)) { $files = scandir($dir); $dir .= DIRECTORY_SEPARATOR; d_print_r($files); foreach ($files as $file) { if (is_executable($dir . $file) && is_file($dir . $file) && strstr($file, 'check_')) { list(, $check_name) = explode('_', $file, 2); $stype .= "<option value='{$check_name}'>{$check_name}</option>"; } } } ?> <div class="modal fade bs-example-modal-sm" id="create-service" tabindex="-1" role="dialog" aria-labelledby="Create" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h5 class="modal-title" id="Create">Services</h5>
function poll_mibs($list, $device, &$graphs) { if (!is_dev_attrib_enabled($device, "poll_mib")) { d_echo("MIB module disabled for " . $device['hostname'] . "\n"); return; } $mibdefs = array(); echo "MIB-based polling:"; d_echo("\n"); foreach ($list as $name => $module) { $translated = snmp_translate($name, $module); if ($translated) { echo " {$module}::{$name}"; d_echo("\n"); $mod = $translated[0]; $nam = $translated[1]; $mibdefs[$nam] = snmp_mib_load($nam, $mod); $oids = snmpwalk_cache_oid($device, $nam, array(), $mod, null, "-OQUsb"); d_print_r($oids); save_mibs($device, $nam, $oids, $mibdefs[$nam], $graphs); } else { d_echo("MIB: no match for {$module}::{$name}\n"); } } d_echo("Done MIB-based polling"); echo "\n"; }