diff --git a/AUTHORS.md b/AUTHORS.md index 0fc344279..4c3d6983b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -68,4 +68,5 @@ Contributors to LibreNMS: - Robert Gornall (rgormley) - Richard Kojedzinszky (rkojedzinszky) +- Tony Murray (murrant) [1]: http://observium.org/ "Observium web site" diff --git a/doc/Extensions/Authentication.md b/doc/Extensions/Authentication.md index d7c526d36..48ad0e92f 100644 --- a/doc/Extensions/Authentication.md +++ b/doc/Extensions/Authentication.md @@ -108,7 +108,7 @@ Config option: `active_directory` This is similar to LDAP Authentication. Install __php_ldap__ for CentOS/RHEL or __php5-ldap__ for Debian/Ubuntu. -If you have issues with secure LDAP try setting `$config['auth_ad_dont_check_certificates']` to `1`. +If you have issues with secure LDAP try setting `$config['auth_ad_check_certificates']` to `0`. ##### Require actual membership of the configured groups @@ -118,7 +118,7 @@ If you set ```$config['auth_ad_require_groupmembership']``` to 1, the authentica ``` $config['auth_ad_url'] = "ldaps://your-domain.controll.er"; -$config['auth_ad_dont_check_certificates'] = 1; // or 0 +$config['auth_ad_check_certificates'] = 1; // or 0 $config['auth_ad_domain'] = "your-domain.com"; $config['auth_ad_base_dn'] = "dc=your-domain,dc=com"; $config['auth_ad_groups']['admin']['level'] = 10; diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 4682988d8..fbfd21fee 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -436,7 +436,7 @@ $config['auth_mechanism'] = "mysql"; ``` This is the authentication type to use for the WebUI. MySQL is the default and configured when following the installation instructions. ldap and http-auth are also valid options. For instructions on the different authentication modules please -see [Authentication](http://doc.librenms.org/Extensions/Authentication/). +see [Authentication](http://docs.librenms.org/Extensions/Authentication/). ```php $config['auth_remember'] = '30'; diff --git a/html/data.php b/html/data.php index b55d09c32..4267ddb5d 100644 --- a/html/data.php +++ b/html/data.php @@ -31,14 +31,14 @@ if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted $auth = true; } -$in = snmp_get($device, 'ifInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); -$out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); +$in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); if (empty($in)) { - $in = snmp_get($device, 'ifHCInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); + $in = snmp_get($device, 'ifInOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); } +$out = snmp_get($device, 'ifHCOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); if (empty($out)) { - $out = snmp_get($device, 'ifHCOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); + $out = snmp_get($device, 'ifOutOctets.'.$port['ifIndex'], '-OUqnv', 'IF-MIB'); } $time = time(); diff --git a/html/includes/authentication/active_directory.inc.php b/html/includes/authentication/active_directory.inc.php index 03788f90d..a562ae901 100644 --- a/html/includes/authentication/active_directory.inc.php +++ b/html/includes/authentication/active_directory.inc.php @@ -2,6 +2,12 @@ // easier to rewrite for Active Directory than to bash it into existing LDAP implementation +// disable certificate checking before connect if required +if (isset($config['auth_ad_check_certificates']) && + $config['auth_ad_check_certificates'] == 0) { + putenv('LDAPTLS_REQCERT=never'); +}; + $ds = @ldap_connect($config['auth_ad_url']); // disable referrals and force ldap version to 3 @@ -9,13 +15,6 @@ $ds = @ldap_connect($config['auth_ad_url']); ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); -// disable certificate checking if required - -if (isset($config['auth_ad_dont_check_certificates']) && - $config['auth_ad_dont_check_certificates'] > 0) { - putenv('LDAPTLS_REQCERT=never'); -}; - function authenticate($username, $password) { global $config, $ds; diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index 223c169fc..b15c9b773 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -50,12 +50,12 @@ unset($break); if ($port_details) { foreach (dbFetchRows('SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip) { - echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; + echo "$break ".$ip['ipv4_address'].'/'.$ip['ipv4_prefixlen'].''; $break = '
'; } foreach (dbFetchRows('SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?', array($port['port_id'])) as $ip6) { - echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; + echo "$break ".Net_IPv6::compress($ip6['ipv6_address']).'/'.$ip6['ipv6_prefixlen'].''; $break = '
'; } } diff --git a/html/pages/bill/history.inc.php b/html/pages/bill/history.inc.php index 26a4750b6..6770271c8 100644 --- a/html/pages/bill/history.inc.php +++ b/html/pages/bill/history.inc.php @@ -101,7 +101,7 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY $total_data $rate_95th $overuse - ".print_percentage_bar(250, 20, $perc, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' + ".print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' Show details diff --git a/html/pages/bills/pmonth.inc.php b/html/pages/bills/pmonth.inc.php index abac72f00..39f1ff75c 100644 --- a/html/pages/bills/pmonth.inc.php +++ b/html/pages/bills/pmonth.inc.php @@ -60,7 +60,7 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_name`') as $bill) { $total_data $rate_95th $overuse - ".print_percentage_bar(250, 20, $perc, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' + ".print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).' '; $i++; diff --git a/html/pages/front/default.php b/html/pages/front/default.php index 341f8f12e..1709f842a 100644 --- a/html/pages/front/default.php +++ b/html/pages/front/default.php @@ -33,7 +33,7 @@ echo '
'; $count_boxes = 0; // Device down boxes -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -50,7 +50,7 @@ foreach (dbFetchRows($sql) as $device) { ++$count_boxes; } -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -79,7 +79,7 @@ if ($config['warn']['ifdown']) { /* FIXME service permissions? seem nonexisting now.. */ // Service down boxes -if ($_SESSION['userlevel'] >= '10') { +if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; $param[] = ''; } @@ -101,7 +101,7 @@ foreach (dbFetchRows($sql, $param) as $service) { // BGP neighbour down boxes if (isset($config['enable_bgp']) && $config['enable_bgp']) { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 AND `D`.`status` = '1' LIMIT ".$config['front_page_down_box_limit']; } else { @@ -122,7 +122,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp']) { // Device rebooted boxes if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== false && $config['uptime_warning'] > 0) { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '".$config['uptime_warning']."' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } else { @@ -204,7 +204,7 @@ if ($config['enable_syslog']) { echo '
'; } else { - if ($_SESSION['userlevel'] >= '10') { + if (is_admin() === true || is_read() === true) { $query = "SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $alertquery = 'SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15'; } diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 97badfa1f..16873101c 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -114,7 +114,11 @@ $config['os'][$os]['type'] = 'wireless'; $config['os'][$os]['icon'] = 'ubiquiti'; $config['os'][$os]['nobulk'] = 1; $config['os'][$os]['over'][0]['graph'] = 'device_bits'; +$config['os'][$os]['over'][0]['text'] = 'Device Traffic'; $config['os'][$os]['over'][1]['graph'] = 'device_processor'; +$config['os'][$os]['over'][1]['text'] = 'Processor Usage'; +$config['os'][$os]['over'][2]['graph'] = 'device_mempool'; +$config['os'][$os]['over'][2]['text'] = 'Memory Usage'; $os = 'airos'; $config['os'][$os]['text'] = 'Ubiquiti AirOS'; diff --git a/includes/discovery/mempools/unifi.inc.php b/includes/discovery/mempools/unifi.inc.php new file mode 100644 index 000000000..26704f422 --- /dev/null +++ b/includes/discovery/mempools/unifi.inc.php @@ -0,0 +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. + */ + +if ($device['os'] == 'unifi') { + echo 'UNIFI-MEMORY-POOL: '; + + $total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ'); + $free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ'); + + if (is_numeric($total) && is_numeric($free)) { + discover_mempool($valid_mempool, $device, 0, 'unifi', 'Memory', '1', null, null); + } +} diff --git a/includes/discovery/processors/unifi.inc.php b/includes/discovery/processors/unifi.inc.php new file mode 100644 index 000000000..0d463d669 --- /dev/null +++ b/includes/discovery/processors/unifi.inc.php @@ -0,0 +1,24 @@ + + * 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. + */ + +if ($device['os'] == 'unifi') { + echo 'Ubiquiti UniFi: '; + + $descr = 'CPU'; + $usage = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '-Ovqn'); + + if (is_numeric($usage)) { + discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '0', 'unifi', $descr, '1', $usage, null, null); + } +} + +unset($processors_array); diff --git a/includes/polling/applications/ntpd-server.inc.php b/includes/polling/applications/ntpd-server.inc.php index f6267ce16..44e009e5c 100644 --- a/includes/polling/applications/ntpd-server.inc.php +++ b/includes/polling/applications/ntpd-server.inc.php @@ -4,8 +4,9 @@ $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-ntpdserver-'.$app['app_id'].'.rrd'; $options = '-O qv'; $oid = 'nsExtendOutputFull.10.110.116.112.100.115.101.114.118.101.114'; +$mib = 'NET-SNMP-EXTEND-MIB'; -$ntpdserver = snmp_get($device, $oid, $options); +$ntpdserver = snmp_get($device, $oid, $options, $mib); echo ' ntpd-server'; diff --git a/includes/polling/mempools/unifi.inc.php b/includes/polling/mempools/unifi.inc.php new file mode 100644 index 000000000..05611285d --- /dev/null +++ b/includes/polling/mempools/unifi.inc.php @@ -0,0 +1,17 @@ + + * 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. + */ + +$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ'); +$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ'); +$mempool['total'] = $total * 1024; +$mempool['free'] = $free * 1024; +$mempool['used'] = ($mempool['total'] - $mempool['free']);