diff --git a/.gitignore b/.gitignore index 8c57c5ce4..0a6dbb3cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,21 @@ +# Ignore all dotfiles # +####################### +.* +!/.gitignore +!/.editorconfig +!/.scrutinizer.yml + + +# Others # +########## +*.swp +Thumbs.db config.php -.index -junk -logs -patches -rrd html/plugins/* !html/plugins/Test/ +junk +logs nbproject -.alerts.lock -.ircbot.alert -.metadata_never_index -*.swp +patches +rrd -# OS generated files # -###################### -.DS_Store -.DS_Store? -.Spotlight-V100 -.Trashes -Thumbs.db diff --git a/AUTHORS.md b/AUTHORS.md index 0945ba8ec..83929477a 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -78,6 +78,7 @@ LibreNMS contributors: - D. Britz (flatterlight) - Tobias Herrmann (Mightea) - Nicolas Guillaumin (nguillaumin) +- Jurrian van Iersel (jviersel) [1]: http://observium.org/ "Observium web site" Observium was written by: diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index f9ff0951d..02d1958e9 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -81,6 +81,12 @@ Alert when: - Any port changes: `%ports.ifOperStatus != 'up'` - Root-directory gets too full: `%storage.storage_descr = '/' && %storage.storage_perc >= '75'` - Any storage gets fuller than the 'warning': `%storage.storage_perc >= %storage_perc_warn` +- If device is a server and the used storage is above the warning level, but ignore /boot partitions: `%storage.storage_perc > %storage.storage_perc_warn && %devices.type = "server" && %storage.storage_descr !~ "/boot"` +- VMware LAG is not using "Source ip address hash" load balancing: `%devices.os = "vmware" && %ports.ifType = "ieee8023adLag" && %ports.ifDescr !~ "Link Aggregation @, load balancing algorithm: Source ip address hash"` +- Syslog, authentication failure during the last 5m: `%syslog.timestamp >= %macros.past_5m && %syslog.msg ~ "@authentication failure@"` +- High memory usage: `%macros.device_up = "1" && %mempools.mempool_perc >= "90" && %mempools.mempool_descr = "Virtual@"` +- High CPU usage(per core usage, not overall): `%macros.device_up = "1" && %processors.processor_usage >= "90"` +- High port usage, where description is not client & ifType is not softwareLoopback: `%macros.port_usage_perc >= "80" && %port.port_descr_type != "client" && %ports.ifType != "softwareLoopback"` # Templates diff --git a/doc/Extensions/MIB-based-polling.md b/doc/Extensions/MIB-based-polling.md index 8358c44e7..d23d207dd 100644 --- a/doc/Extensions/MIB-based-polling.md +++ b/doc/Extensions/MIB-based-polling.md @@ -69,8 +69,9 @@ The components involved in MIB-based polling are: - During discovery, relevant MIBs are parsed using `snmptranslate`, and the data returned is used to populate a database which guides the poller in - what to store. At the moment, only OIDs with Unsigned32 and Counter64 - data types are parsed. + what to store. At the moment, only OIDs of INTEGER, Integer32, Gauge32, + Unsigned32, Counter32, and Counter64 data types are parsed, and negative + values are untested. - Devices may be excluded from MIB polling by changing the setting in the device edit screen: diff --git a/doc/Extensions/Oxidized.md b/doc/Extensions/Oxidized.md index 6bb7c2bf4..23153780b 100644 --- a/doc/Extensions/Oxidized.md +++ b/doc/Extensions/Oxidized.md @@ -31,14 +31,6 @@ You can set a default group that devices will fall back to with: $config['oxidized']['default_group'] = 'default'; ``` -To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted. -The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php: - -```php -$config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'group' => 'london-switches'); -$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches'); -``` - ### Feeding Oxidized Oxidized has support for feeding devices into it via an API call, support for Oxidized has been added to the LibreNMS API. A sample config for Oxidized is provided below. @@ -56,10 +48,40 @@ You will need to configure default credentials for your devices, LibreNMS doesn' map: name: hostname model: os + group: group headers: X-Auth-Token: '01582bf94c03104ecb7953dsadsadwed' ``` +LibreNMS is able to reload the Oxidized list of nodes, each time a device is added to LibreNMS. +To do so, edit the option in Global Settings>External Settings>Oxidized Integration or add the following to your config.php. + +```php +$config['oxidized']['reload_nodes'] = TRUE; + +``` + +### Using Groups + +To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted. +The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php: + +```php +$config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'group' => 'london-switches'); +$config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches'); +``` + +If you need to, you can specify credentials for groups by using the following in your Oxidized config: + +```bash +groups: + : + username: + password: +``` + +### Miscellaneous + If you have devices which you do not wish to appear in Oxidized then you can edit those devices in Device -> Edit -> Misc and enable "Exclude from Oxidized?" It's also possible to exclude certain device types and OS' from being output via the API. This is currently only possible via config.php: diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 45891da81..15be9ed6c 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -488,6 +488,7 @@ This array can be used to filter out syslog messages that you don't want to be s ```php $config['enable_libvirt'] = 1; $config['libvirt_protocols'] = array("qemu+ssh","xen+ssh"); +$config['libvirt_username'] = 'root'; ``` Enable this to switch on support for libvirt along with `libvirt_protocols` to indicate how you connect to libvirt. You also need to: diff --git a/doc/Support/Poller Support.md b/doc/Support/Poller Support.md index 616698630..ad99c4219 100644 --- a/doc/Support/Poller Support.md +++ b/doc/Support/Poller Support.md @@ -39,7 +39,6 @@ disable it for one device then you can do this within the WebUI -> Settings -> M ```php $config['poller_modules']['unix-agent'] = 0; -$config['poller_modules']['system'] = 1; $config['poller_modules']['os'] = 1; $config['poller_modules']['ipmi'] = 1; $config['poller_modules']['sensors'] = 1; diff --git a/html/includes/print-graphrow.inc.php b/html/includes/print-graphrow.inc.php index 9b98a8039..a35107b94 100644 --- a/html/includes/print-graphrow.inc.php +++ b/html/includes/print-graphrow.inc.php @@ -76,3 +76,4 @@ foreach ($periods as $period) { echo ""; } } +unset($graph_array); diff --git a/html/pages/settings/external.inc.php b/html/pages/settings/external.inc.php index ccade1add..fe89d4645 100644 --- a/html/pages/settings/external.inc.php +++ b/html/pages/settings/external.inc.php @@ -25,6 +25,10 @@ $oxidized_conf = array( 'descr' => 'Set the default group returned', 'type' => 'text', ), + array('name' => 'oxidized.reload_nodes', + 'descr' => 'Reload Oxidized nodes list, each time a device is added', + 'type' => 'checkbox', + ), ); $unixagent_conf = array( diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 4b6dc05bc..39701fd39 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -473,6 +473,7 @@ $config['rancid_ignorecomments'] = 0; $config['smokeping']['pings'] = 20; // $config['oxidized']['enabled'] = FALSE;//Set to TRUE // $config['oxidized']['url'] = 'http://127.0.0.1:8888';// Set the Oxidized rest URL +// $config['oxidized']['reload_nodes'] = FALSE;//Set to TRUE, check documentation // NFSen RRD dir. $config['nfsen_enable'] = 0; // $config['nfsen_split_char'] = "_"; @@ -675,7 +676,6 @@ $config['warn']['ifdown'] = true; // List of poller modules. Need to be in the array to be // considered for execution. $config['poller_modules']['unix-agent'] = 0; -$config['poller_modules']['system'] = 1; $config['poller_modules']['os'] = 1; $config['poller_modules']['ipmi'] = 1; $config['poller_modules']['sensors'] = 1; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 5e30d2bd7..26f58e992 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1,6 +1,5 @@ "CISCO-AAA-SESSION-MIB", + ); + register_mibs($device, $extra_mibs, "includes/discovery/os/ios.inc.php"); } // Fallback case diff --git a/includes/discovery/os/routeros.inc.php b/includes/discovery/os/routeros.inc.php index 5e35eb7f7..a5e407cd5 100644 --- a/includes/discovery/os/routeros.inc.php +++ b/includes/discovery/os/routeros.inc.php @@ -18,4 +18,10 @@ if (!$os) { if ($sysDescr == 'RB260GS') { $os = 'routeros'; } + + // poll Cisco AAA MIB + $extra_mibs = array( + "ciscoAAASessionMIB" => "CISCO-AAA-SESSION-MIB", + ); + register_mibs($device, $extra_mibs, "includes/discovery/os/routeros.inc.php"); } diff --git a/includes/discovery/temperatures/cisco-envmon.inc.php b/includes/discovery/temperatures/cisco-envmon.inc.php index 15b7577aa..74408318d 100644 --- a/includes/discovery/temperatures/cisco-envmon.inc.php +++ b/includes/discovery/temperatures/cisco-envmon.inc.php @@ -1,31 +1,22 @@ + * 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. + */ -// FIXME - dbFacile and fewer SNMP_GETs -if (dbFetchCell("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_class` = 'temperature' AND (`sensor_type` = 'cisco-entity-sensor' OR `sensor_type` = 'entity-sensor')", array($device['device_id'])) == '0' && ($device['os_group'] == 'cisco')) { - echo 'CISCO-ENVMON-MIB: '; - $oids = snmp_walk($device, '.1.3.6.1.4.1.9.9.13.1.3.1.2', '-Osqn', 'CISCO-ENVMON-MIB'); - $oids = str_replace('.1.3.6.1.4.1.9.9.13.1.3.1.2.', '', $oids); - $oids = trim($oids); - foreach (explode("\n", $oids) as $data) { - $data = trim($data); - if ($data) { - list($index) = explode(' ', $data); - $oid = ".1.3.6.1.4.1.9.9.13.1.3.1.3.$index"; - $descr_oid = ".1.3.6.1.4.1.9.9.13.1.3.1.2.$index"; - $descr = snmp_get($device, $descr_oid, '-Oqv', 'CISCO-ENVMON-MIB'); - $temperature = snmp_get($device, $oid, '-Oqv', 'CISCO-ENVMON-MIB'); - if (!strstr($descr, 'No') && !strstr($temperature, 'No') && $temperature != '' && $descr != '') { - $descr = str_replace('"', '', $descr); - $descr = str_replace('temperature', '', $descr); - $descr = str_replace('temperature', '', $descr); - $descr = trim($descr); - - if (!is_numeric($temperature)) { - $temperature = stristr($temperature, ' degrees', true); - } - - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'cisco', $descr, '1', '1', null, null, null, null, $temperature); - } +if ($device['os_group'] == 'cisco') { + $temp = snmpwalk_cache_multi_oid($device, 'ciscoEnvMonTemperatureStatusTable', array(), 'CISCO-ENVMON-MIB'); + if (is_array($temp)) { + $cur_oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.'; + foreach ($temp as $index => $entry) { + $descr = ucwords($temp[$index]['ciscoEnvMonTemperatureStatusDescr']); + discover_sensor($valid['sensor'], 'temperature', $device, $cur_oid.$index, $index, 'cisco', $descr, '1', '1', null, null, $temp[$index]['ciscoEnvMonTemperatureThreshold'], null, $temp[$index]['ciscoEnvMonTemperatureStatusValue'], 'snmp', $index); } - }//end foreach -}//end if + } +} diff --git a/includes/functions.php b/includes/functions.php index bb128bd13..c9d842b9a 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -580,6 +580,7 @@ function createHost($host, $community = NULL, $snmpver, $port = 161, $transport if (host_exists($host) === false) { $device_id = dbInsert($device, 'devices'); if ($device_id) { + oxidized_reload_nodes(); return($device_id); } else { @@ -1302,3 +1303,20 @@ function warn_innodb_buffer($innodb_buffer) { $output .= 'Config proposal: "innodb_buffer_pool_size = '.pow(2,ceil(log(($innodb_buffer['used'] / 1024 / 1024),2))).'M"'.PHP_EOL; return $output; } + +function oxidized_reload_nodes() { + + global $config; + + if ($config['oxidized']['enabled'] === TRUE && $config['oxidized']['reload_nodes'] === TRUE && isset($config['oxidized']['url'])) { + $oxidized_reload_url = $config['oxidized']['url'] . '/reload'; + $ch = curl_init($oxidized_reload_url); + + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_exec($ch); + curl_close($ch); + } +} diff --git a/includes/polling/core.inc.php b/includes/polling/core.inc.php new file mode 100644 index 000000000..c6f5399a4 --- /dev/null +++ b/includes/polling/core.inc.php @@ -0,0 +1,131 @@ + $uptime && is_numeric($snmp_uptime)) { + $uptime = $snmp_uptime; + d_echo('hrSystemUptime or sysUpTime looks like to have rolled, using snmpEngineTime instead'); +} + +if (is_numeric($uptime)) { + if ($uptime < $device['uptime']) { + log_event('Device rebooted after '.formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); + } + + $uptime_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/uptime.rrd'; + + if (!is_file($uptime_rrd)) { + rrdtool_create($uptime_rrd, 'DS:uptime:GAUGE:600:0:U '.$config['rrd_rra']); + } + + $fields = array( + 'uptime' => $uptime, + ); + + rrdtool_update($uptime_rrd, $fields); + + $measurement = 'uptime'; + $tags = array(); + + influx_update($device,$measurement,$tags,$fields); + + $graphs['uptime'] = true; + + echo 'Uptime: '.formatUptime($uptime)."\n"; + + $update_array['uptime'] = $uptime; +}//end if + +$poll_device['sysLocation'] = str_replace('"', '', $poll_device['sysLocation']); + +// Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS +$poll_device['sysLocation'] = trim($poll_device['sysLocation'], '\\'); + +// Rewrite sysLocation if there is a mapping array (database too?) +if (!empty($poll_device['sysLocation']) && is_array($config['location_map'])) { + $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); +} + +$poll_device['sysContact'] = str_replace('"', '', $poll_device['sysContact']); + +// Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS +$poll_device['sysContact'] = trim($poll_device['sysContact'], '\\'); + + +foreach (array('sysLocation', 'sysContact') as $elem) { + if ($poll_device[$elem] == 'not set') { + $poll_device[$elem] = ''; + } +} + +// Save results of various polled values to the database +foreach (array('sysContact', 'sysObjectID', 'sysName', 'sysDescr') as $elem) { + if ($poll_device[$elem] && $poll_device[$elem] != $device[$elem]) { + $update_array[$elem] = $poll_device[$elem]; + log_event("$elem -> ".$poll_device[$elem], $device, 'system'); + } +} + +if ($poll_device['sysLocation'] && $device['location'] != $poll_device['sysLocation'] && $device['override_sysLocation'] == 0) { + $update_array['location'] = $poll_device['sysLocation']; + log_event('Location -> '.$poll_device['sysLocation'], $device, 'system'); +} + +if ($config['geoloc']['latlng'] === true) { + location_to_latlng($device); +} diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index bc7e80e07..266c3d4a2 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -204,6 +204,9 @@ function poll_device($device, $options) { $graphs = array(); $oldgraphs = array(); + // we always want the core module to be included + include 'includes/polling/core.inc.php'; + if ($options['m']) { foreach (explode(',', $options['m']) as $module) { if (is_file('includes/polling/'.$module.'.inc.php')) { diff --git a/includes/polling/os/avaya-ers.inc.php b/includes/polling/os/avaya-ers.inc.php index 163c82c18..97afaab5b 100644 --- a/includes/polling/os/avaya-ers.inc.php +++ b/includes/polling/os/avaya-ers.inc.php @@ -2,7 +2,7 @@ echo 'Doing Nortel/Avaya ERS '; -$sysObjectID = snmp_get($device, 'sysObjectID.0', '-Oqvn'); +$sysObjectID = $poll_device['sysObjectID']; // Try multiple ways of getting firmware version $version = snmp_get($device, 'SNMPv2-SMI::enterprises.2272.1.1.7.0', '-Oqvn'); @@ -17,7 +17,7 @@ if ($version == '') { } // Get hardware details -$sysDescr = snmp_get($device, 'SNMPv2-MIB::sysDescr.0', '-Oqvn'); +$sysDescr = $poll_device['sysDescr']; $details = explode(' ', $sysDescr); $details = str_replace('ERS-', 'Ethernet Routing Switch ', $details); diff --git a/includes/polling/os/datacom.inc.php b/includes/polling/os/datacom.inc.php index 9d2d5aea3..ebf0bf538 100644 --- a/includes/polling/os/datacom.inc.php +++ b/includes/polling/os/datacom.inc.php @@ -1,5 +1,5 @@ + * 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. + */ + +preg_match_all('/^(MSM\d{3})|Serial number ([\S]+)|Firmware version (\d+\.\d+\.\d+\.\d+-\d+)/', $poll_device['sysDescr'], $matches); +$hardware = $matches[1][0]; +$serial = $matches[2][1]; +$version = $matches[3][2]; diff --git a/includes/polling/os/ibmnos.inc.php b/includes/polling/os/ibmnos.inc.php index 90f950c6e..88059323d 100644 --- a/includes/polling/os/ibmnos.inc.php +++ b/includes/polling/os/ibmnos.inc.php @@ -9,7 +9,7 @@ * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ -$sysdescr_value = snmp_get($device, 'sysDescr.0', '-Ovq'); +$sysdescr_value = $poll_device['sysDescr']; if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) { $hardware = str_replace('IBM Networking Operating System', '', $sysdescr_value); if (strpos($sysdescr_value, 'G8052') !== false) { diff --git a/includes/polling/os/infinity.inc.php b/includes/polling/os/infinity.inc.php index ddebce091..bf4d70981 100644 --- a/includes/polling/os/infinity.inc.php +++ b/includes/polling/os/infinity.inc.php @@ -10,6 +10,6 @@ * the source code distribution for details. */ -$version = snmp_get($device, 'SNMPv2-MIB::sysDescr.0', '-Ovq'); +$version = $poll_device['sysDescr']; $version = explode(' ', $version)[2]; $hardware = snmp_get($device, 'IEEE802dot11-MIB::dot11manufacturerProductName.5', '-Ovq'); diff --git a/includes/polling/os/merakimr.inc.php b/includes/polling/os/merakimr.inc.php index 647b8d032..d150024a5 100644 --- a/includes/polling/os/merakimr.inc.php +++ b/includes/polling/os/merakimr.inc.php @@ -11,5 +11,5 @@ */ if (empty($hardware)) { - $hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB'); + $hardware = $poll_device['sysDescr']; } diff --git a/includes/polling/os/merakims.inc.php b/includes/polling/os/merakims.inc.php index 669d27f10..834a86f65 100644 --- a/includes/polling/os/merakims.inc.php +++ b/includes/polling/os/merakims.inc.php @@ -11,5 +11,5 @@ */ if (empty($hardware)) { - $hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB'); + $hardware = $poll_device['sysDescr']; } diff --git a/includes/polling/os/merakimx.inc.php b/includes/polling/os/merakimx.inc.php index eb373acff..fda7c5746 100644 --- a/includes/polling/os/merakimx.inc.php +++ b/includes/polling/os/merakimx.inc.php @@ -11,5 +11,5 @@ */ if (empty($hardware)) { - $hardware = snmp_get($device, 'sysDescr.0', '-Osqv', 'SNMPv2-MIB'); + $hardware = $poll_device['sysDescr']; } diff --git a/includes/polling/os/pbn.inc.php b/includes/polling/os/pbn.inc.php index ba424d7e9..b238f6dc3 100644 --- a/includes/polling/os/pbn.inc.php +++ b/includes/polling/os/pbn.inc.php @@ -6,7 +6,7 @@ if (preg_match('/^Pacific Broadband Networks .+\n.+ Version ([^,]+), .+\n.+\n.+\ // for PBN CPE 120/121 } -else if (strstr(snmp_get($device, 'SNMPv2-MIB::sysObjectID.0', '-Ovqn'), '.1.3.6.1.4.1.11606.24.1.1.10')) { +else if (strstr($poll_device['sysObjectID'], '.1.3.6.1.4.1.11606.24.1.1.10')) { $version = str_replace(array('"'), '', snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.6.0', '-Ovq')); $hardware = str_replace(array('"'), '', snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.7.0', '-Ovq')); $features = str_replace(array('"'), '', snmp_get($device, '1.3.6.1.4.1.11606.24.1.1.10.0', '-Ovq')); diff --git a/includes/polling/os/pulse.inc.php b/includes/polling/os/pulse.inc.php index f52d9ac0c..d0aa0a51f 100644 --- a/includes/polling/os/pulse.inc.php +++ b/includes/polling/os/pulse.inc.php @@ -12,7 +12,7 @@ $version = trim(snmp_get($device, "productVersion.0", "-OQv", "PULSESECURE-PSG-MIB"),'"'); $hardware = "Juniper " . trim(snmp_get($device, "productName.0", "-OQv", "PULSESECURE-PSG-MIB"),'"'); -$hostname = trim(snmp_get($device, "sysName.0", "-OQv", "SNMPv2-MIB"),'"'); +$hostname = trim($poll_device['sysName'],'"'); $usersrrd = $config['rrd_dir'].'/'.$device['hostname'].'/pulse_users.rrd'; $users = snmp_get($device, 'PULSESECURE-PSG-MIB::iveConcurrentUsers.0', '-OQv'); diff --git a/includes/polling/os/vyatta.inc.php b/includes/polling/os/vyatta.inc.php index 39e323dbf..b89a02d69 100644 --- a/includes/polling/os/vyatta.inc.php +++ b/includes/polling/os/vyatta.inc.php @@ -1,3 +1,3 @@ $uptime && is_numeric($snmp_uptime)) { - $uptime = $snmp_uptime; - d_echo('hrSystemUptime or sysUpTime looks like to have rolled, using snmpEngineTime instead'); -} - -if (is_numeric($uptime)) { - if ($uptime < $device['uptime']) { - log_event('Device rebooted after '.formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); - } - - $uptime_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/uptime.rrd'; - - if (!is_file($uptime_rrd)) { - rrdtool_create($uptime_rrd, 'DS:uptime:GAUGE:600:0:U '.$config['rrd_rra']); - } - - $fields = array( - 'uptime' => $uptime, - ); - - rrdtool_update($uptime_rrd, $fields); - - $measurement = 'uptime'; - $tags = array(); - - influx_update($device,$measurement,$tags,$fields); - - $graphs['uptime'] = true; - - echo 'Uptime: '.formatUptime($uptime)."\n"; - - $update_array['uptime'] = $uptime; -}//end if - -$poll_device['sysLocation'] = str_replace('"', '', $poll_device['sysLocation']); - -// Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS -$poll_device['sysLocation'] = trim($poll_device['sysLocation'], '\\'); - -// Rewrite sysLocation if there is a mapping array (database too?) -if (!empty($poll_device['sysLocation']) && is_array($config['location_map'])) { - $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); -} - -$poll_device['sysContact'] = str_replace('"', '', $poll_device['sysContact']); - -// Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS -$poll_device['sysContact'] = trim($poll_device['sysContact'], '\\'); - - -foreach (array('sysLocation', 'sysContact') as $elem) { - if ($poll_device[$elem] == 'not set') { - $poll_device[$elem] = ''; - } -} - -// Save results of various polled values to the database -foreach (array('sysContact', 'sysObjectID', 'sysName', 'sysDescr') as $elem) { - if ($poll_device[$elem] && $poll_device[$elem] != $device[$elem]) { - $update_array[$elem] = $poll_device[$elem]; - log_event("$elem -> ".$poll_device[$elem], $device, 'system'); - } -} - -if ($poll_device['sysLocation'] && $device['location'] != $poll_device['sysLocation'] && $device['override_sysLocation'] == 0) { - $update_array['location'] = $poll_device['sysLocation']; - log_event('Location -> '.$poll_device['sysLocation'], $device, 'system'); -} - -if ($config['geoloc']['latlng'] === true) { - location_to_latlng($device); -} diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php index 73d9c693e..30803f2a1 100644 --- a/includes/polling/wifi.inc.php +++ b/includes/polling/wifi.inc.php @@ -43,6 +43,12 @@ if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['ty echo (($wificlients1 + 0).' clients on dot11Radio0, '.($wificlients2 + 0)." clients on dot11Radio1\n"); } + if ($device['os'] == 'hpmsm') { + echo 'Checking HP MSM Wireless clients... '; + $wificlients1 = snmp_get($device, '.1.3.6.1.4.1.8744.5.25.1.7.2.0', '-OUqnv'); + echo $wificlients1." clients\n"; + } + // MikroTik RouterOS if ($device['os'] == 'routeros') { // Check inventory for wireless card in device. Valid types be here: diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 6d1c32238..4f15260aa 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -1040,22 +1040,19 @@ function oid_rrd_type($oid, $mibdef) case 'INTEGER': case 'Integer32': - // FIXME - return false; + return 'GAUGE:600:U:U'; case 'Counter32': - // FIXME - return false; - case 'Counter64': return 'COUNTER:600:0:U'; + case 'Gauge32': case 'Unsigned32': - return 'GAUGE:600:U:U'; + return 'GAUGE:600:0:U'; + } return false; - } // oid_rrd_type @@ -1124,7 +1121,7 @@ function save_mibs($device, $mibname, $oids, $mibdef, &$graphs) foreach ($oids as $index => $array) { foreach ($array as $obj => $val) { // build up the device_oid row for saving into the database - $numvalue = preg_match('/^\d+$/', $val) ? $val : null; + $numvalue = is_numeric($val) ? $val + 0 : 0; $deviceoids[] = array( 'device_id' => $device['device_id'], 'oid' => $mibdef[$obj]['oid'].".".$index, @@ -1190,7 +1187,12 @@ function load_mibdefs($module, $name) // add shortname to each element $prefix = longest_matching_prefix($name, $object_types); foreach ($result as $mib => $m) { - $result[$mib]['shortname'] = str_replace($prefix, '', $m['object_type']); + if (strlen($prefix) > 2) { + $result[$mib]['shortname'] = preg_replace("/^$prefix/", '', $m['object_type'], 1); + } + else { + $result[$mib]['shortname'] = $m['object_type']; + } } d_print_r($result); diff --git a/mibs/CISCO-AAA-SESSION-MIB b/mibs/CISCO-AAA-SESSION-MIB new file mode 100644 index 000000000..fc947a267 --- /dev/null +++ b/mibs/CISCO-AAA-SESSION-MIB @@ -0,0 +1,494 @@ +-- ***************************************************************** +-- CISCO-AAA-SESSION-MIB.my: Cisco AAA Session MIB +-- +-- November 1999, Ed Richardson +-- +-- Copyright (c) 1999, 2000, 2002, 2006 by cisco Systems, Inc. +-- All rights reserved. +-- ***************************************************************** +-- + + +CISCO-AAA-SESSION-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, + OBJECT-TYPE, + Counter32, + Gauge32, + IpAddress, + Unsigned32 + FROM SNMPv2-SMI + MODULE-COMPLIANCE, + OBJECT-GROUP + FROM SNMPv2-CONF + DisplayString, + TruthValue, + TEXTUAL-CONVENTION, + RowPointer + FROM SNMPv2-TC + InterfaceIndexOrZero + FROM IF-MIB + ciscoMgmt + FROM CISCO-SMI; + + +ciscoAAASessionMIB MODULE-IDENTITY + LAST-UPDATED "200603210000Z" + ORGANIZATION "Cisco Systems, Inc." + CONTACT-INFO + " Cisco Systems + Customer Service + + Postal: 170 W. Tasman Drive + San Jose, CA 95134 + USA + + Tel: +1 800 553-NETS + + E-mail: cs-aaa@cisco.com" + DESCRIPTION + "This MIB module provides data for accounting sessions + based on Authentication, Authorization, Accounting + (AAA) protocols. + + + References: + RFC 2139 RADIUS Accounting + The TACACS+ Protocol Version 1.78, Internet Draft + + + " + REVISION "200603210000Z" + DESCRIPTION + "Added the casnNasPort and casnVaiIfIndex objects to the + casnActiveTable. + " + REVISION "200204110000Z" + DESCRIPTION + "Imported Unsigned32 from SNMPv2-SMI instead of CISCO-TC + " + REVISION "9911160000Z" + DESCRIPTION + "Initial version + " + ::= { ciscoMgmt 150 } + + +-- +-- Textual Conventions +-- + +-- +-- Call Identifier textual convention +-- +CctCallId ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Represents a Call Identifier. + The call identifier is used as an unique identifier for an + call within the system. + + A zero value indicates no call ID. + " + SYNTAX Unsigned32 + + + +-- +-- Session Identifier textual convention +-- +CasnSessionId ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Represents an Accounting Session Identifier. + The session identifier is used as an unique identifier for + a session within the system. + " + SYNTAX Unsigned32 (1..4294967295) + + + +-- AAA Session MIB objects definitions + +casnMIBObjects OBJECT IDENTIFIER ::= { ciscoAAASessionMIB 1 } + + +-- The AAA Session MIB consists of the following groups +-- [1] AAA Session Active Group (casnActive) +-- [2] AAA Session General Group (casnGeneral) + +casnActive OBJECT IDENTIFIER ::= { casnMIBObjects 1 } +casnGeneral OBJECT IDENTIFIER ::= { casnMIBObjects 2 } + + + +--********************************************************************** +-- AAA Session Active Group +--********************************************************************** +-- +-- + +-- +-- Active Table +-- + +casnActiveTableEntries OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of entries currently in casnActiveTable + " + ::= { casnActive 1 } + + +casnActiveTableHighWaterMark OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum number of entries present in casnActiveTable + since last system re-initialization. + + This corresponds to the maximum value reported by + casnActiveTableEntries. + " + ::= { casnActive 2 } + + +casnActiveTable OBJECT-TYPE + SYNTAX SEQUENCE OF CasnActiveEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains entries for active AAA accounting + sessions in the system. + " + ::= { casnActive 3 } + +casnActiveEntry OBJECT-TYPE + SYNTAX CasnActiveEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The information regarding a single accounting session. + + Entries are created when a new accounting session + is begun. + + Entries are removed when the accounting session + is ended. + + Initiating termination of a session with the object + casnDisconnect will cause removal of the entry when + the session completes termination. + " + INDEX { casnSessionId } + ::= { casnActiveTable 1 } + + +CasnActiveEntry ::= + SEQUENCE { + casnSessionId CasnSessionId, + casnUserId DisplayString, + casnIpAddr IpAddress, + casnIdleTime Gauge32, + casnDisconnect TruthValue, + casnCallTrackerId CctCallId, + casnNasPort RowPointer, + casnVaiIfIndex InterfaceIndexOrZero + } + + +casnSessionId OBJECT-TYPE + SYNTAX CasnSessionId + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This is the session identification used by the + accounting protocol. + + This value is unique to a session within the system, + even if multiple accounting protocols are in use. + + The value of this object corresponds to these + accounting protocol attributes. + RADIUS: attribute 44, Acct-Session-Id + TACACS+: attribute 'task_id' + " + ::= { casnActiveEntry 1 } + + +casnUserId OBJECT-TYPE + SYNTAX DisplayString(SIZE(0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The User login ID or zero length string if unavailable. + + The value of this object corresponds to these + accounting protocol attributes. + RADIUS: attribute 1, User-Name + TACACS+: attribute 'user' + " + ::= { casnActiveEntry 2 } + + +casnIpAddr OBJECT-TYPE + SYNTAX IpAddress + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The IP address of the session or 0.0.0.0 if not + applicable or unavailable. + + RADIUS: attribute 8, Framed-IP-Address + TACACS+: attribute 'addr' + " + ::= { casnActiveEntry 3 } + + +casnIdleTime OBJECT-TYPE + SYNTAX Gauge32 + UNITS "seconds" + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The elapsed time that this session has been idle. + + This is the time since the last user-level data has been + received or transmitted. Protocol level handshaking + associated with the call is considered to be idle for + this object. + " + ::= { casnActiveEntry 4 } + + +casnDisconnect OBJECT-TYPE + SYNTAX TruthValue + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object is used to terminate this session. + + Setting the value to true(1) will initiate termination + of this session. + + The entry will be removed once the session has completed + termination. + + Once this object has been set to true(1), the session + termination process can not be cancelled by setting the + value false(2). + " + ::= { casnActiveEntry 5 } + + +casnCallTrackerId OBJECT-TYPE + SYNTAX CctCallId + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of this object is the entry index in the + CISCO-CALL-TRACKER-MIB cctActiveTable of the call + corresponding to this accounting session. + + Using the value of this object to query the + cctActiveTable will provide more detailed data regarding + the session represented by this casnActiveEntry. + " + ::= { casnActiveEntry 6 } + + +casnNasPort OBJECT-TYPE + SYNTAX RowPointer + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of this object identifies a particular + conceptual row associated with the session identified by + casnSessionId. The conceptual row that this object points + to represents a port that is used to transport a session. + + If the port transporting the session cannot be determined, + the value of this object will be zeroDotZero. + + For example, suppose a session is established using an ATM + PVC. If the ifIndex of the ATM interface is 7, and the + VPI/VCI values of the PVC are 1, 100 respectively, then + the value of this object might be as follows: + + casnNasPort.15 = atmVclAdminStatus.7.1.100 + ^ ^ ^ ^ + | | | | + casnSessionId --+ | | | + ifIndex -------------------------+ | | + atmVclVpi ---------------------------+ | + atmVclVci ------------------------------+ + + where atmVclAdminStatus is the first accessible object + of the atmVclTable of the ATM-MIB. + " + ::= { casnActiveEntry 7 } + + +casnVaiIfIndex OBJECT-TYPE + SYNTAX InterfaceIndexOrZero + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The ifIndex of the Virtual Access Interface (VAI) + that is associated with the PPP session. + + This interface may not be represented in the IF-MIB in + which case the value of this object will be zero. + " + ::= { casnActiveEntry 8 } + + + +--********************************************************************** +-- AAA Session General Group +--********************************************************************** +-- +-- + +casnTotalSessions OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total number of sessions since last system + re-initialization. + + This value includes all sessions currently in the + casnActiveTable and all previous sessions whether + terminated via casnDisconnect or via other + mechanisms. + " + ::= { casnGeneral 1 } + + +casnDisconnectedSessions OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total number of sessions which have been disconnected using + casnDisconnect since last system re-initialization. + + This value includes any sessions still in the + casnActiveTable with a casnDisconnect value of true(1) and + all previous sessions which terminated as a result of + setting casnDisconnect. + " + ::= { casnGeneral 2 } + + + +--********************************************************************** +-- Notifications +--********************************************************************** +casnMIBNotificationPrefix OBJECT IDENTIFIER ::= + { ciscoAAASessionMIB 2 } +casnMIBNotifications OBJECT IDENTIFIER ::= + { casnMIBNotificationPrefix 1 } + + + +casnMIBConformance OBJECT IDENTIFIER ::= + { ciscoAAASessionMIB 3 } +casnMIBCompliances OBJECT IDENTIFIER ::= + { casnMIBConformance 1 } +casnMIBGroups OBJECT IDENTIFIER ::= + { casnMIBConformance 2 } + +-- compliance statements + +casnMIBCompliance MODULE-COMPLIANCE + STATUS deprecated + DESCRIPTION + "The compliance statement for entities which + implement the CISCO AAA Session MIB" + MODULE -- this module + MANDATORY-GROUPS + { casnActiveGroup, + casnGeneralGroup + } + + OBJECT casnDisconnect + MIN-ACCESS read-only + DESCRIPTION + "Write access is not required." + + ::= { casnMIBCompliances 1 } + + +casnMIBComplianceRev1 MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for entities which + implement the CISCO AAA Session MIB" + MODULE -- this module + MANDATORY-GROUPS + { casnActiveGroup, + casnGeneralGroup, + casnActiveGroupSup1 + } + + OBJECT casnDisconnect + MIN-ACCESS read-only + DESCRIPTION + "Write access is not required." + + ::= { casnMIBCompliances 2 } + + + +-- units of conformance + + +casnActiveGroup OBJECT-GROUP + OBJECTS { + casnActiveTableEntries, + casnActiveTableHighWaterMark, + casnUserId, + casnIpAddr, + casnIdleTime, + casnDisconnect, + casnCallTrackerId + } + STATUS current + DESCRIPTION + "A collection of objects providing the + AAA session information. + " + ::= { casnMIBGroups 1 } + + +casnGeneralGroup OBJECT-GROUP + OBJECTS { + casnTotalSessions, + casnDisconnectedSessions + } + STATUS current + DESCRIPTION + "A collection of objects providing the + AAA session information. + " + ::= { casnMIBGroups 2 } + + +casnActiveGroupSup1 OBJECT-GROUP + OBJECTS { + casnNasPort, + casnVaiIfIndex + } + STATUS current + DESCRIPTION + "A collection of objects that supplements + the casnActiveGroup. + " + ::= { casnMIBGroups 3 } +END diff --git a/sql-schema/089.sql b/sql-schema/089.sql new file mode 100644 index 000000000..faeaea353 --- /dev/null +++ b/sql-schema/089.sql @@ -0,0 +1 @@ +ALTER TABLE `perf_times` ADD `poller` VARCHAR( 255 ) NOT NULL ; diff --git a/sql-schema/090.sql b/sql-schema/090.sql new file mode 100644 index 000000000..dc08f0c67 --- /dev/null +++ b/sql-schema/090.sql @@ -0,0 +1 @@ +INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('oxidized.reload_nodes','false','false','Reload Oxidized nodes list, each time a device is added','external',0,'oxidized',0,'0','0'); \ No newline at end of file