Move MIB-based polling out of discovery altogether

This commit is contained in:
Paul Gear
2015-06-06 22:46:01 +10:00
parent 2a18afe3af
commit 5bdf67ba6e
3 changed files with 28 additions and 54 deletions

View File

@ -0,0 +1,27 @@
The overall design of MIB-based support is:
Discovery:
- MIBs are not involved; any work done here would have to be
duplicated by the poller and thus would only increase load.
Polling:
- Look for a MIB matching sysObjectID in the MIB directory; if one
is found:
- parse it
- walk that MIB on the device
- store any numeric results in individual RRD files
- update/add graph definitions in the database
- Individual OSes can add extra MIBs that should be there for a given
OS (includes/polling/os/*.inc.php). The MIB poller will poll,
store, and update graph definitions for them after attempting the
sysObjectID-based MIB poll.
- Devices may be excluded from MIB polling by adding poll_mib = 0 to
devices_attribs (see /device/device=ID/tab=edit/section=modules/)
Graphing:
- For each file in the device directory, create a graph using the
definition in the database. Future enhancements:
- Allow graphs to go in different sections
- Allow graphs to be combined automatically or on a user-defined
basis.

View File

@ -533,6 +533,7 @@ $config['poller_modules']['aruba-controller'] = 1;
$config['poller_modules']['entity-physical'] = 1;
$config['poller_modules']['applications'] = 1;
$config['poller_modules']['cisco-asa-firewall'] = 1;
$config['poller_modules']['mib'] = 0;
// List of discovery modules. Need to be in this array to be
// considered for execution.
@ -565,7 +566,6 @@ $config['discovery_modules']['toner'] = 1;
$config['discovery_modules']['ucd-diskio'] = 1;
$config['discovery_modules']['services'] = 1;
$config['discovery_modules']['charge'] = 1;
$config['discovery_modules']['mib'] = 0;
$config['modules_compat']['rfc1628']['liebert'] = 1;
$config['modules_compat']['rfc1628']['netmanplus'] = 1;

View File

@ -1,53 +0,0 @@
<?php
/*
* LibreNMS MIB-based discovery
*
* Copyright (c) 2015 Gear Consulting Pty Ltd <github@libertysys.com.au>
*
* 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.
*/
/*
* The overall plan for MIB-based support is:
*
* Discovery:
* 1. SNMP_get sysObjectID; look for a MIB matching this object (set_os_mib).
* 2. Add any extra MIBs that should be there for a given device
* (includes/discovery/os/*.inc.php).
* 3. Walk these MIBs to see if they exist in the device (this file).
* Save the ones that do in the database table device_oids.
*
* Polling:
* 5. For each MIB in the device_oids table, walk the device for that MIB.
* 6. Save each MIB value in its own RRD file. (At present there is no
* deletion of values that disappear.)
*
* Graphing:
* 7. For each MIB in the device_oids table, create a graph from the RRD
* file. All graphs go into the MIB section at present.
*/
set_os_mib($device);
$mibs = array();
// remove any existing device_oids for this device
dbDelete('device_oids', 'device_id = ?', array($device['device_id']));
// parse MIBs and check for them on the device
foreach ($device['mibs'] as $name => $module) {
d_echo("MIB discovery: $name, $module");
$mibs[$name] = snmp_mib_load($name, $module);
$oids = snmpwalk_cache_oid($device, "$module::$name", array(), $module);
// add the oids for this device
foreach ($oids[0] as $key => $val) {
$data = $mibs[$name][$key];
$data['device_id'] = $device['device_id'];
$result = dbInsert($data, 'device_oids');
d_echo("dbInsert for $name $key returned $result");
}
}