Pretty up the discovery process output

This commit is contained in:
laf
2016-06-21 00:59:43 +01:00
parent 7bc3e3e33e
commit 558dfb2344
32 changed files with 16 additions and 59 deletions

View File

@@ -2,8 +2,6 @@
unset($mac_table);
echo 'ARP Table : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}

View File

@@ -1,7 +1,6 @@
<?php
if ($config['enable_bgp']) {
// Discover BGP peers
echo 'BGP Sessions : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];

View File

@@ -14,7 +14,6 @@
if ($device['os_group'] == 'cisco') {
$module = 'Cisco-CBQOS';
echo $module.': ';
require_once 'includes/component.php';
$component = new component();

View File

@@ -1,7 +1,5 @@
<?php
echo 'Cisco CEF Switching Path: ';
$cefs = array();
$cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingPath', $cefs);
d_echo($cefs);

View File

@@ -1,7 +1,6 @@
<?php
if ($device['os_group'] == 'cisco') {
echo 'Cisco MAC Accounting : ';
$datas = shell_exec($config['snmpbulkwalk'].' -M '.$config['mibdir'].' -m CISCO-IP-STAT-MIB -Oqn '.snmp_gen_auth($device).' '.$device['hostname'].' cipMacSwitchedBytes');
// echo("$datas\n");

View File

@@ -58,7 +58,6 @@ if ($device['os_group'] == 'cisco') {
$error_overlay[6] = "destroy";
$module = 'Cisco-OTV';
echo $module.': ';
require_once 'includes/component.php';
$component = new component();

View File

@@ -4,8 +4,6 @@ if ($config['enable_pseudowires'] && $device['os_group'] == 'cisco') {
unset($cpw_count);
unset($cpw_exists);
echo 'Cisco Pseudowires : ';
// Pre-cache the existing state of pseudowires for this device from the database
$pws_db_raw = dbFetchRows('SELECT * FROM `pseudowires` WHERE `device_id` = ?', array($device['device_id']));
foreach ($pws_db_raw as $pw_db) {

View File

@@ -1,7 +1,6 @@
<?php
if ($config['enable_sla'] && $device['os_group'] == 'cisco') {
echo 'SLAs : ';
$slas = snmp_walk($device, 'ciscoRttMonMIB.ciscoRttMonObjects.rttMonCtrl', '-Osq', '+CISCO-RTTMON-MIB');

View File

@@ -24,7 +24,6 @@ if ($config['enable_vrf_lite_cisco']) {
// For the moment only will be cisco and the version 3
if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') {
echo ("VRF lite cisco : \n");
$mib = "SNMP-COMMUNITY-MIB";
$mib = "CISCO-CONTEXT-MAPPING-MIB";
//-Osq because if i put the n the oid from the first command is not the same of this one

View File

@@ -5,8 +5,6 @@ if ($config['enable_vrfs']) {
if ($device['os_group'] == 'cisco' || $device['os_group'] == 'junos' || $device['os'] == 'ironware') {
unset($vrf_count);
echo 'VRFs : ';
/*
There are 2 MIBs for VPNs : MPLS-VPN-MIB (oldest) and MPLS-L3VPN-STD-MIB (newest)
Unfortunately, there is no simple way to find out which one to use, unless we reference

View File

@@ -13,8 +13,6 @@
// License: GPLv3
//
echo 'ARP Discovery: ';
$hostname = $device['hostname'];
$deviceid = $device['device_id'];

View File

@@ -1,7 +1,5 @@
<?php
echo 'Discovery protocols:';
global $link_exists;
$community = $device['community'];

View File

@@ -1,7 +1,6 @@
<?php
if ($config['enable_inventory']) {
echo 'Physical Inventory : ';
echo "\nCaching OIDs:";

View File

@@ -108,20 +108,17 @@ function discover_device($device, $options = null) {
if ($options['m']) {
foreach (explode(',', $options['m']) as $module) {
if (is_file("includes/discovery/$module.inc.php")) {
include "includes/discovery/$module.inc.php";
load_discovery_module($module, $device, $attribs);
}
}
} else {
foreach ($config['discovery_modules'] as $module => $module_status) {
if ($attribs['discover_' . $module] || ( $module_status && !isset($attribs['discover_' . $module]))) {
$module_start = microtime(true);
include 'includes/discovery/' . $module . '.inc.php';
$module_time = microtime(true) - $module_start;
echo "Runtime for discovery module '$module': $module_time\n";
load_discovery_module($module, $device, $attribs);
} else if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') {
echo "Module [ $module ] disabled on host.\n";
echo "Module [ $module ] disabled on host.\n\n";
} else {
echo "Module [ $module ] disabled globally.\n";
echo "Module [ $module ] disabled globally.\n\n";
}
}
}
@@ -851,3 +848,12 @@ function avtech_add_sensor($device, $sensor) {
return true;
}
function load_discovery_module($module, $device, $attribs) {
global $config, $valid;
$module_start = microtime(true);
echo "#### Load disco module $module ####\n";
include "includes/discovery/$module.inc.php";
$module_time = microtime(true) - $module_start;
echo "\n>> Runtime for discovery module '$module': $module_time\n";
echo "#### Unload disco module $module ####\n\n";
}

View File

@@ -1,7 +1,5 @@
<?php
echo 'hrDevice : ';
$hrDevice_oids = array(
'hrDeviceEntry',
'hrProcessorEntry',

View File

@@ -1,6 +1,5 @@
<?php
echo 'IPv4 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!= 0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}

View File

@@ -1,6 +1,5 @@
<?php
echo 'IPv6 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
}

View File

@@ -4,7 +4,6 @@
// snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry
// JunOSe ATM vps
if ($device['os'] == 'junose' && $config['enable_ports_junoseatmvp']) {
echo 'JunOSe ATM vps : ';
$vp_array = snmpwalk_cache_multi_oid($device, 'juniAtmVpStatsInCells', $vp_array, 'Juniper-UNI-ATM-MIB', $config['install_dir'].'/mibs/junose');
$valid_vp = array();
d_echo($vp_array);

View File

@@ -5,8 +5,6 @@
if ($config['enable_libvirt'] == '1' && $device['os'] == 'linux') {
$libvirt_vmlist = array();
echo 'Libvirt VM: ';
$ssh_ok = 0;
$userHostname = $device['hostname'];

View File

@@ -1,7 +1,5 @@
<?php
echo 'Memory : ';
// Include all discovery modules
$include_dir = 'includes/discovery/mempools';
require 'includes/include-dir.inc.php';

View File

@@ -1,7 +1,5 @@
<?php
echo 'OS: ';
$os = getHostOS($device);
if ($os != $device['os']) {
log_event('Device OS changed '.$device['os']." => $os", $device, 'system');

View File

@@ -1,7 +1,5 @@
<?php
echo 'Port Stack: ';
$sql = "SELECT * FROM `ports_stack` WHERE `device_id` = '".$device['device_id']."'";
foreach (dbFetchRows($sql) as $entry) {

View File

@@ -1,7 +1,5 @@
<?php
echo 'Processors : ';
// Include all discovery modules
$include_dir = 'includes/discovery/processors';
require 'includes/include-dir.inc.php';

View File

@@ -25,7 +25,6 @@ $ids = array();
// For the moment only will be cisco and the version 3
if ($device['os_group'] == "cisco") {
echo ("ROUTE : ");
//RFC1213-MIB
$mib = "RFC1213-MIB";
//IpRouteEntry

View File

@@ -2,8 +2,6 @@
$valid['sensor'] = array();
echo 'Sensors: ';
require 'includes/discovery/sensors/cisco-entity-sensor.inc.php';
require 'includes/discovery/sensors/entity-sensor.inc.php';
require 'includes/discovery/sensors/ipmi.inc.php';

View File

@@ -1,7 +1,6 @@
<?php
if ($config['discover_services']) {
echo 'Services: ';
// FIXME: use /etc/services?
$known_services = array(

View File

@@ -1,7 +1,5 @@
<?php
echo 'Storage : ';
// Include all discovery modules
$include_dir = 'includes/discovery/storage';
require 'includes/include-dir.inc.php';

View File

@@ -14,8 +14,6 @@
* needs RSTP-MIB
*/
echo "Spanning Tree: ";
// Pre-cache existing state of STP for this device from database
$stp_db = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id']));
//d_echo($stp_db);

View File

@@ -3,8 +3,6 @@
if ($config['enable_printers']) {
$valid_toner = array();
echo 'Toner : ';
if ($device['os_group'] == 'printer') {
$oids = trim(snmp_walk($device, 'SNMPv2-SMI::mib-2.43.12.1.1.2.1 ', '-OsqnU'));
if (!$oids) {

View File

@@ -1,6 +1,5 @@
<?php
echo 'UCD Disk IO : ';
$diskio_array = snmpwalk_cache_oid($device, 'diskIOEntry', array(), 'UCD-DISKIO-MIB', '+'.$config['install_dir'].'/mibs/');
$valid_diskio = array();
if (is_array($diskio_array)) {

View File

@@ -1,7 +1,5 @@
<?php
echo "VLANs:\n";
// Pre-cache the existing state of VLANs for this device from the database
$vlans_db_raw = dbFetchRows('SELECT * FROM `vlans` WHERE `device_id` = ?', array($device['device_id']));
foreach ($vlans_db_raw as $vlan_db) {

View File

@@ -16,8 +16,6 @@ if (($device['os'] == 'vmware') || ($device['os'] == 'linux')) {
* CONSOLE: Start the VMware discovery process.
*/
echo 'VMware VM: ';
/*
* Fetch information about Virtual Machines.
*/