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); unset($mac_table);
echo 'ARP Table : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){ if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco']; $vrfs_lite_cisco = $device['vrf_lite_cisco'];
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,6 @@
<?php <?php
if ($config['enable_sla'] && $device['os_group'] == 'cisco') { if ($config['enable_sla'] && $device['os_group'] == 'cisco') {
echo 'SLAs : ';
$slas = snmp_walk($device, 'ciscoRttMonMIB.ciscoRttMonObjects.rttMonCtrl', '-Osq', '+CISCO-RTTMON-MIB'); $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 // For the moment only will be cisco and the version 3
if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') { if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') {
echo ("VRF lite cisco : \n");
$mib = "SNMP-COMMUNITY-MIB"; $mib = "SNMP-COMMUNITY-MIB";
$mib = "CISCO-CONTEXT-MAPPING-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 //-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') { if ($device['os_group'] == 'cisco' || $device['os_group'] == 'junos' || $device['os'] == 'ironware') {
unset($vrf_count); unset($vrf_count);
echo 'VRFs : ';
/* /*
There are 2 MIBs for VPNs : MPLS-VPN-MIB (oldest) and MPLS-L3VPN-STD-MIB (newest) 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 Unfortunately, there is no simple way to find out which one to use, unless we reference

View File

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

View File

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

View File

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

View File

@@ -108,20 +108,17 @@ function discover_device($device, $options = null) {
if ($options['m']) { if ($options['m']) {
foreach (explode(',', $options['m']) as $module) { foreach (explode(',', $options['m']) as $module) {
if (is_file("includes/discovery/$module.inc.php")) { if (is_file("includes/discovery/$module.inc.php")) {
include "includes/discovery/$module.inc.php"; load_discovery_module($module, $device, $attribs);
} }
} }
} else { } else {
foreach ($config['discovery_modules'] as $module => $module_status) { foreach ($config['discovery_modules'] as $module => $module_status) {
if ($attribs['discover_' . $module] || ( $module_status && !isset($attribs['discover_' . $module]))) { if ($attribs['discover_' . $module] || ( $module_status && !isset($attribs['discover_' . $module]))) {
$module_start = microtime(true); load_discovery_module($module, $device, $attribs);
include 'includes/discovery/' . $module . '.inc.php';
$module_time = microtime(true) - $module_start;
echo "Runtime for discovery module '$module': $module_time\n";
} else if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') { } 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 { } 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; 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 <?php
echo 'hrDevice : ';
$hrDevice_oids = array( $hrDevice_oids = array(
'hrDeviceEntry', 'hrDeviceEntry',
'hrProcessorEntry', 'hrProcessorEntry',

View File

@@ -1,6 +1,5 @@
<?php <?php
echo 'IPv4 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!= 0) ){ if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!= 0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco']; $vrfs_lite_cisco = $device['vrf_lite_cisco'];
} }
@@ -72,4 +71,4 @@ foreach ($vrfs_lite_cisco as $vrf) {
unset($device['context_name']); unset($device['context_name']);
unset($valid_v4); unset($valid_v4);
} }
unset($vrfs_c); unset($vrfs_c);

View File

@@ -1,6 +1,5 @@
<?php <?php
echo 'IPv6 Addresses : ';
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){ if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
$vrfs_lite_cisco = $device['vrf_lite_cisco']; $vrfs_lite_cisco = $device['vrf_lite_cisco'];
} }
@@ -86,4 +85,4 @@ foreach ($vrfs_lite_cisco as $vrf) {
echo "\n"; echo "\n";
unset($device['context_name']); unset($device['context_name']);
} }
unset($vrfs_c); unset($vrfs_c);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
<?php <?php
echo 'Processors : ';
// Include all discovery modules // Include all discovery modules
$include_dir = 'includes/discovery/processors'; $include_dir = 'includes/discovery/processors';
require 'includes/include-dir.inc.php'; 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 // For the moment only will be cisco and the version 3
if ($device['os_group'] == "cisco") { if ($device['os_group'] == "cisco") {
echo ("ROUTE : ");
//RFC1213-MIB //RFC1213-MIB
$mib = "RFC1213-MIB"; $mib = "RFC1213-MIB";
//IpRouteEntry //IpRouteEntry

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
<?php <?php
echo "VLANs:\n";
// Pre-cache the existing state of VLANs for this device from the database // 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'])); $vlans_db_raw = dbFetchRows('SELECT * FROM `vlans` WHERE `device_id` = ?', array($device['device_id']));
foreach ($vlans_db_raw as $vlan_db) { 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. * CONSOLE: Start the VMware discovery process.
*/ */
echo 'VMware VM: ';
/* /*
* Fetch information about Virtual Machines. * Fetch information about Virtual Machines.
*/ */