$data) { if (isset($data['mib_dir'])) { $mibs[$mib] = 'def'; } } // Fetch MIBs we support for specific OSes foreach ($config['os'] as $os => $data) { foreach ($data['mibs'] as $mib) { if (!isset($mibs[$mib])) { $mibs[$mib] = 'os'; } } } // Fetch all MIBs we support for specific OS groups foreach ($config['os_group'] as $os => $data) { foreach ($data['mibs'] as $mib) { if (!isset($mibs[$mib])) { $mibs[$mib] = 'group'; } } } ksort($mibs); $defined_config = get_defined_settings(); // Used defined configs in config.php // r($vars); if ($vars['toggle_mib'] && isset($mibs[$vars['toggle_mib']]) && !isset($defined_config['mibs'][$mib]['enable'])) { // Ignore if defined in config.php $mib = $vars['toggle_mib']; $mib_disabled = isset($config['mibs'][$mib]['enable']) && !$config['mibs'][$mib]['enable']; $set_mib = $mib_disabled ? 1 : 0; $key = 'mibs|'.$mib.'|enable'; set_sql_config($key, $set_mib); $config['mibs'][$mib]['enable'] = $set_mib; // one time override config var on page } print_message("This page allows you to globally disable individual MIBs. This configuration disables all discovery and polling using this MIB."); ?>
'Global MIB Configuration', 'header-border' => TRUE, ); echo generate_box_open($box_args); ?> $data) { $key = 'mibs|'.$mib.'|enable'; $mib_set = in_array($key, $db_config); $class = $mib_set ? ' class="ignore"' : ''; echo(''); if (isset($config['mibs'][$mib])) { $descr = $config['mibs'][$mib]['descr']; } else { $descr = ''; } /* echo('

$mib = "'.$mib.'";
$config[\'mibs\'][ $mib ][\'mib_dir\'] = "";
$config[\'mibs\'][ $mib ][\'descr\']   = "";

'); */ echo ''; // Highlight not defined MIBs $label_class = $data != 'def' ? 'label label-warning' : 'label'; echo ''; echo ''); } ?>
Module Description Status
'.$mib.''.$descr.''.strtoupper($data).''; $readonly = FALSE; $btn_value = ''; $btn_tooltip = ''; if (isset($defined_config['mibs'][$mib]['enable']) && !$defined_config['mibs'][$mib]['enable']) { // Disabled in config.php $attrib_status = 'disabled'; $toggle = 'Config'; $btn_class = ''; $btn_tooltip = 'Disabled in config.php, see: $config[\'mibs\'][\'' . $mib . '\'][\'enable\']'; $readonly = TRUE; } elseif (isset($config['mibs'][$mib]['enable']) && !$config['mibs'][$mib]['enable']) { // Disabled in definitions or manually, can be re-enabled $attrib_status = 'disabled'; $toggle = 'Enable'; $btn_class = 'btn-success'; $btn_value = 'Toggle'; } else { $attrib_status = 'enabled'; $toggle = 'Disable'; $btn_class = 'btn-danger'; } echo($attrib_status.''); $form = [ 'id' => 'toggle_mib', 'type' => 'simple' ]; // Elements $form['row'][0]['toggle_mib'] = [ 'type' => 'hidden', 'value' => $mib ]; $form['row'][0]['submit'] = [ 'type' => 'submit', 'name' => $toggle, 'class' => 'btn-mini '.$btn_class, 'icon' => '', 'tooltip' => $btn_tooltip, 'right' => TRUE, 'readonly' => $readonly, 'value' => $btn_value ]; print_form($form); unset($form); echo('