diff --git a/AUTHORS.md b/AUTHORS.md index bc4f417c94..ce1ce2b579 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -34,6 +34,10 @@ Contributors to LibreNMS: - Steve Calvário (Calvario) - Christian Marg (einhirn) - Louis Rossouw (spinza) +- Clint Armstrong (clinta) +- Tony Ditchfield (arnoldthebat) +- Travis Hegner (travishegner) +- Will Jones (willjones) [1]: http://observium.org/ "Observium web site" diff --git a/addhost.php b/addhost.php index 2c75d65735..d1e26a3991 100755 --- a/addhost.php +++ b/addhost.php @@ -114,6 +114,9 @@ if (!empty($argv[1])) elseif (preg_match ('/^(sha|md5)$/i', $arg)) { $v3['authalgo'] = $arg; + } else { + echo "Invalid argument: " . $arg . "\n" ; + return ; } } @@ -147,6 +150,9 @@ if (!empty($argv[1])) elseif (preg_match ('/^(aes|des)$/i', $arg)) { $v3['cryptoalgo'] = $arg; + } else { + echo "Invalid argument: " . $arg . "\n" ; + return ; } } diff --git a/daily.php b/daily.php index 03176a47d3..abb525a0b2 100644 --- a/daily.php +++ b/daily.php @@ -58,5 +58,13 @@ if ($options['f'] === 'perf_times') { if ($options['f'] === 'callback') { require_once "callback.php"; } +if ($options['f'] === 'device_perf') { + if (is_numeric($config['device_perf_purge'])) { + if (dbDelete('device_perf', "timestamp < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL ? DAY))", array($config['device_perf_purge'])) ) { + echo 'Device performance times cleared for entries over ' . $config['device_perf_purge'] . " days\n"; + } + } +} + ?> diff --git a/daily.sh b/daily.sh index 4168d73448..91183d6d1b 100755 --- a/daily.sh +++ b/daily.sh @@ -12,3 +12,4 @@ php daily.php -f eventlog php daily.php -f authlog php daily.php -f perf_times php daily.php -f callback +php daily.php -f device_perf diff --git a/doc/Extensions/Alerting.md b/doc/Extensions/Alerting.md index 9390e53afe..253c90cc0b 100644 --- a/doc/Extensions/Alerting.md +++ b/doc/Extensions/Alerting.md @@ -321,6 +321,8 @@ __devices.location__ = The devices location. __devices.status__ = The status of the device, 1 = up, 0 = down. +__devices.status_reason__ = The reason the device was detected as down (icmp or snmp). + __devices.ignore__ = If the device is ignored this will be set to 1. __devices.disabled__ = If the device is disabled this will be set to 1. @@ -502,3 +504,19 @@ Entity: `%macros.sensor` Description: Only select sensors that aren't ignored. Source: `(%sensors.sensor_alert = 1)` + +## Packet Loss (Boolean) + +Entity: `(%macros.packet_loss_5m)` + +Description: Packet loss % value for the device within the last 5 minutes. + +Example: `%macros.packet_loss_5m` > 50 + +Entity: `(%macros.packet_loss_15m)` + +Description: Packet loss % value for the device within the last 15 minutes. + +Example: `%macros.packet_loss_15m` > 50 + + diff --git a/doc/Extensions/Services.md b/doc/Extensions/Services.md new file mode 100644 index 0000000000..7ad7c9d290 --- /dev/null +++ b/doc/Extensions/Services.md @@ -0,0 +1,52 @@ +# Setting up Services + +Services within LibreNMS provides the ability to use Nagios plugins to perform additional monitoring outside of SNMP. + +These services are tied into an existing device so you need at least one device that supports SNMP to be able to add it +to LibreNMS - localhot is a good one. + +## Setup + +Firstly, install Nagios plugins however you would like, this could be via yum, apt-get or direct from source. + +Next, you need to enable the services within config.php with the following: + +```php +$config['show_services'] = 1; +``` +This will enable a new service menu within your navbar. + +```php +$config['nagios_plugins'] = "/usr/lib/nagios/plugins"; +``` + +This will point LibreNMS at the location of the nagios plugins - please ensure that any plugins you use are set to executable. + +Finally, you now need to add check-services.php to the current cron file (/etc/cron.d/librenms typically) like: +```bash +*/5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1 +``` + +Now you can add services via the main Services link in the navbar, or via the Services link within the device page. + +> **Please note that at present the service checks will only return the status and the response from the check +no graphs will be generated. ** + +## Supported checks + +- ftp +- icmp +- spop +- ssh +- ssl_cert +- http +- domain_expire +- mysql +- imap +- dns +- telnet +- smtp +- pop +- simap +- ntp +- ircd diff --git a/doc/General/Changelog.md b/doc/General/Changelog.md index ff43400c1b..8cdb6a1e5f 100644 --- a/doc/General/Changelog.md +++ b/doc/General/Changelog.md @@ -1,3 +1,16 @@ +### July 2015 + +#### Bug fixes + - Fixed API not functioning. (PR1367) + - Fixed API not storing alert rule names (PR1372) + - Fixed datetimepicker use (PR1376) + - Do not allow master to rejoin itself. (PR1377) + - Fixed Nginx config file (PR1389) + +#### Improvements + - Added additional support for Rielo UPS (PR1381) + - Improved service check support (PR1385,PR1386,PR1387,PR1388) + ### June 2015 #### Bug fixes @@ -15,6 +28,14 @@ - Fixed legend ifLabels (PR1296) - Fixed bug causing map to not load when stale link data was present (PR1297) - Fixed javascript issue preventing removal of alert rules (PR1312) + - Fixed removal of IPs before ports are deleted (PR1329) + - Fixed JS issue when removing ports from bills (PR1330) + - Fixed adding --daemon a second time to collectd Graphs (PR1342) + - Fixed CollectD DS names (PR1347,PR1349,PR1368) + - Fixed graphing issues when rrd contains special chars (PR1350) + - Fixed regex for device groups (PR1359) + - Added HOST-RESOURCES-MIB into Synology detection (RP1360) + - Fix health page graphs showing the first graph for all (PR1363) #### Improvements - Updated Syslog docs to include syslog-ng 3.5.1 updates (PR1171) @@ -48,6 +69,18 @@ - Added WebUI support for Pushover (PR1313) - Updated path check for Oxidized config (PR1316) - Added Multimatic UPS to rfc1628 detection (PR1317) + - Added timeout for Unix agent (PR1319) + - Added support for a poller to use more than one poller group (PR1323) + - Added ability to use Plugins on device overview page (PR1325) + - Added latency loss/avg/max/min results to DB and Graph (PR1326) + - Added recording of device down (snmp/icmp) (PR1326) + - Added debugging output for when invalid SNMPv3 options used (PR1331) + - Added load and state output to device overview page (PR1333) + - Added load sensors to RFC1628 Devices (PR1336) + - Added support for WebPower Pro II UPS Cards (PR1338) + - No longer rewrite server-status in .htaccess (PR1339) + - Added docs for setting up Service extensions (PR1354) + - Added additional info from pfsense devices (PR1356) ### May 2015 diff --git a/doc/Installation/Installation-(RHEL-CentOS).md b/doc/Installation/Installation-(RHEL-CentOS).md index a1aafc2b86..42f277f181 100644 --- a/doc/Installation/Installation-(RHEL-CentOS).md +++ b/doc/Installation/Installation-(RHEL-CentOS).md @@ -96,7 +96,7 @@ Modify permissions and configuration for `php-fpm` to use nginx credentials. vi /etc/php-fpm.d/www.conf # At line #12: Change `listen` to `/var/run/php5-fpm.sock` # At line #39-41: Change the `user` and `group` to `nginx` -Add configuration for `nginx` at `/etc/nginx/conf.d/librenms` with the following content: +Add configuration for `nginx` at `/etc/nginx/conf.d/librenms.conf` with the following content: ```nginx server { diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index ae3ee9e19e..68cb552515 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -33,6 +33,8 @@ $config['fping'] = "/usr/bin/fping"; $config['fping6'] = "/usr/bin/fping6"; $config['fping_options']['retries'] = 3; $config['fping_options']['timeout'] = 500; +$config['fping_options']['count'] = 3; +$config['fping_options']['millisec'] = 5; ``` fping configuration options, this includes setting the timeout and retry options. @@ -404,6 +406,7 @@ $config['syslog_purge'] = 30; $config['eventlog_purge'] = 30; $config['authlog_purge'] = 30; $config['perf_times_purge'] = 30; +$config['device_perf_purge'] = 30; ``` This option will ensure data within LibreNMS over 1 month old is automatically purged. You can alter these individually, values are in days. diff --git a/html/.htaccess b/html/.htaccess index 0b7faa983b..44bd1687d2 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -9,6 +9,7 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !\.(js|ico|txt|gif|jpg|png|css|php) RewriteRule ^api/v0(.*)$ api_v0.php/$1 [L] +RewriteCond %{REQUEST_URI} !=/server-status RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !\.(js|ico|txt|gif|jpg|png|css|php) diff --git a/html/forms/parse-device-group.inc.php b/html/forms/parse-device-group.inc.php index 7009459f26..9ecd4e52eb 100644 --- a/html/forms/parse-device-group.inc.php +++ b/html/forms/parse-device-group.inc.php @@ -20,7 +20,7 @@ $group_id = $_POST['group_id']; if(is_numeric($group_id) && $group_id > 0) { $group = dbFetchRow("SELECT * FROM `device_groups` WHERE `id` = ? LIMIT 1",array($group_id)); - $group_split = preg_split('/([a-zA-Z0-9_\-\.\=\%\<\>\ \"\'\!\~\(\)\*\/\@]+[&&\|\|]+)/',$group['pattern'], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + $group_split = preg_split('/([a-zA-Z0-9_\-\.\=\%\<\>\ \"\'\!\~\(\)\*\/\@\[\]]+[&&\|\|]+)/',$group['pattern'], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $count = count($group_split) - 1; $group_split[$count] = $group_split[$count].' &&'; $output = array('name'=>$group['name'],'desc'=>$group['desc'],'pattern'=>$group_split); diff --git a/html/images/icons/load.png b/html/images/icons/load.png new file mode 100644 index 0000000000..9051fbc609 Binary files /dev/null and b/html/images/icons/load.png differ diff --git a/html/images/icons/state.png b/html/images/icons/state.png new file mode 100644 index 0000000000..a9925a06ab Binary files /dev/null and b/html/images/icons/state.png differ diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index d2e9f3061c..a3593e684e 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -567,6 +567,10 @@ function add_edit_rule() { if(empty($rule)) { $message = 'Missing the alert rule'; } + $name = mres($data['name']); + if (empty($name)) { + $message = 'Missing the alert rule name'; + } $severity = mres($data['severity']); $sevs = array("ok","warning","critical"); if(!in_array($severity, $sevs)) { @@ -590,15 +594,19 @@ function add_edit_rule() { $extra = array('mute'=>$mute,'count'=>$count,'delay'=>$delay_sec); $extra_json = json_encode($extra); + if (dbFetchCell("SELECT `name` FROM `alert_rules` WHERE `name`=?",array($name)) == $name) { + $message = 'Name has already been used'; + } + if(empty($message)) { if(is_numeric($rule_id)) { - if( dbUpdate(array('rule' => $rule,'severity'=>$severity,'disabled'=>$disabled,'extra'=>$extra_json), 'alert_rules', 'id=?',array($rule_id)) >= 0) { + if( dbUpdate(array('name' => $name, 'rule' => $rule,'severity'=>$severity,'disabled'=>$disabled,'extra'=>$extra_json), 'alert_rules', 'id=?',array($rule_id)) >= 0) { $status = 'ok'; $code = 200; } else { $message = 'Failed to update existing alert rule'; } - } elseif( dbInsert(array('device_id'=>$device_id,'rule'=>$rule,'severity'=>$severity,'disabled'=>$disabled,'extra'=>$extra_json),'alert_rules') ) { + } elseif( dbInsert(array('name' => $name, 'device_id'=>$device_id,'rule'=>$rule,'severity'=>$severity,'disabled'=>$disabled,'extra'=>$extra_json),'alert_rules') ) { $status = 'ok'; $code = 200; } else { diff --git a/html/includes/collectd/definitions.php b/html/includes/collectd/definitions.php index a3a2277757..e93e35cfdf 100644 --- a/html/includes/collectd/definitions.php +++ b/html/includes/collectd/definitions.php @@ -47,9 +47,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) { $GraphDefs = array(); $GraphDefs['apache_bytes'] = array( - 'DEF:min_raw={file}:count:MIN', - 'DEF:avg_raw={file}:count:AVERAGE', - 'DEF:max_raw={file}:count:MAX', + 'DEF:min_raw={file}:value:MIN', + 'DEF:avg_raw={file}:value:AVERAGE', + 'DEF:max_raw={file}:value:MAX', 'CDEF:min=min_raw,8,*', 'CDEF:avg=avg_raw,8,*', 'CDEF:max=max_raw,8,*', @@ -67,9 +67,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) { 'GPRINT:min:MIN:%5.1lf%s\l', 'GPRINT:avg_sum:LAST: (ca. %5.1lf%sB Total)'); $GraphDefs['apache_requests'] = array( - 'DEF:min={file}:count:MIN', - 'DEF:avg={file}:count:AVERAGE', - 'DEF:max={file}:count:MAX', + 'DEF:min={file}:value:MIN', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:max={file}:value:MAX', 'COMMENT: Cur Avg Min Max\l', "AREA:max#$HalfBlue", "AREA:min#$Canvas", @@ -79,9 +79,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) { 'GPRINT:min:MIN:%5.2lf%s', 'GPRINT:max:MAX:%5.2lf%s\l'); $GraphDefs['apache_scoreboard'] = array( - 'DEF:min={file}:count:MIN', - 'DEF:avg={file}:count:AVERAGE', - 'DEF:max={file}:count:MAX', + 'DEF:min={file}:value:MIN', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:max={file}:value:MAX', 'COMMENT: Cur Min Ave Max\l', "AREA:max#$HalfBlue", "AREA:min#$Canvas", @@ -397,9 +397,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) { 'GPRINT:avg:LAST:%4.1lf\l'); $GraphDefs['entropy'] = array( #'-v', 'Bits', - 'DEF:avg={file}:entropy:AVERAGE', - 'DEF:min={file}:entropy:MIN', - 'DEF:max={file}:entropy:MAX', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', 'COMMENT: Min Avg Max Cur\l', "AREA:max#$HalfBlue", "AREA:min#$Canvas", @@ -422,9 +422,9 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) { 'GPRINT:avg:LAST:%4.1lf\l'); $GraphDefs['frequency'] = array( #'-v', 'Hertz', - 'DEF:avg={file}:frequency:AVERAGE', - 'DEF:min={file}:frequency:MIN', - 'DEF:max={file}:frequency:MAX', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', "AREA:max#b5b5b5", "AREA:min#$Canvas", "LINE1:avg#$FullBlue:Frequency [Hz]", @@ -2043,7 +2043,7 @@ function meta_graph_apache_scoreboard($host, $plugin, $plugin_instance, $type, $ if ($file == '') continue; - $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'count'); + $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'value'); } return collectd_draw_meta_stack($opts, $sources); diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 8912bb636e..fc7c52a09b 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -69,7 +69,7 @@ function generate_url($vars, $new_vars = array()) { if ($value == "0" || $value != "" && strstr($var, "opt") === FALSE && is_numeric($var) === FALSE) { - $url .= $var ."=".$value."/"; + $url .= $var ."=".urlencode($value)."/"; } } @@ -339,7 +339,7 @@ function generate_graph_tag($args) $urlargs = array(); foreach ($args as $key => $arg) { - $urlargs[] = $key."=".$arg; + $urlargs[] = $key."=".urlencode($arg); } return ''; diff --git a/html/includes/graphs/device/collectd.inc.php b/html/includes/graphs/device/collectd.inc.php index b6e5e6a3ae..05ce8b3cbe 100644 --- a/html/includes/graphs/device/collectd.inc.php +++ b/html/includes/graphs/device/collectd.inc.php @@ -197,7 +197,6 @@ if (isset($MetaGraphDefs[$type])) { if(isset($rrd_cmd)) { - if ($config['rrdcached']) { $rrd_cmd .= " --daemon ".$config['rrdcached'] . " "; } if ($_GET['from']) { $from = mres($_GET['from']); } if ($_GET['to']) { $to = mres($_GET['to']); } $rrd_cmd .= " -s " . $from . " -e " . $to; diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 5c6bfe1c1f..6ba9de57a8 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -38,7 +38,9 @@ $graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; $type = $graphtype['type']; $subtype = $graphtype['subtype']; -$auth = is_client_authorized($_SERVER['REMOTE_ADDR']); +if ($auth !== true && $auth != 1) { + $auth = is_client_authorized($_SERVER['REMOTE_ADDR']); +} include($config['install_dir'] . "/html/includes/graphs/$type/auth.inc.php"); if ($auth === true && is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php")) { diff --git a/html/includes/graphs/sensor/charge.inc.php b/html/includes/graphs/sensor/charge.inc.php index 153d435dd3..331d4ff1a4 100644 --- a/html/includes/graphs/sensor/charge.inc.php +++ b/html/includes/graphs/sensor/charge.inc.php @@ -10,7 +10,10 @@ $rrd_options .= " COMMENT:' Last Max\\n'"; $rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max=$rrd_filename:sensor:MAX"; $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; -$rrd_options .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF"; +if (isset($sensor['sensor_limit'])) { + $rrd_options .= " CDEF:sensorwarm=sensor_max,".$sensor['sensor_limit'].",GT,sensor,UNKN,IF"; + $rrd_options .= " LINE1:sensorwarm#660000"; +} $rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF"; $rrd_options .= " AREA:sensor_max#c5c5c5"; $rrd_options .= " AREA:sensor_min#ffffffff"; @@ -19,7 +22,6 @@ $rrd_options .= " AREA:sensor_min#ffffffff"; # $rrd_options .= " AREA:sensorwarm#FFCCCC"; # $rrd_options .= " AREA:sensorcold#CCCCFF"; $rrd_options .= " LINE1:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'],28)."'"; -$rrd_options .= " LINE1:sensorwarm#660000"; $rrd_options .= " GPRINT:sensor:LAST:%3.0lf%%"; $rrd_options .= " GPRINT:sensor:MAX:%3.0lf%%\\\\l"; diff --git a/html/includes/print-graphrow.inc.php b/html/includes/print-graphrow.inc.php index 2403626327..c550910443 100644 --- a/html/includes/print-graphrow.inc.php +++ b/html/includes/print-graphrow.inc.php @@ -15,6 +15,7 @@ if($_SESSION['widescreen']) $graph_array['to'] = $config['time']['now']; +$graph_data = array(); foreach ($periods as $period) { $graph_array['from'] = $config['time'][$period]; diff --git a/html/includes/table/devices.inc.php b/html/includes/table/devices.inc.php index e89e0b6dbe..25cf21bd51 100644 --- a/html/includes/table/devices.inc.php +++ b/html/includes/table/devices.inc.php @@ -94,7 +94,7 @@ foreach (dbFetchRows($sql, $param) as $device) { if ($device['status'] == '0') { $extra = "danger"; - $msg = "down"; + $msg = $device['status_reason']; } else { $extra = "success"; $msg = "up"; diff --git a/html/pages/bill/edit.inc.php b/html/pages/bill/edit.inc.php index 6434c93e77..67e5000180 100644 --- a/html/pages/bill/edit.inc.php +++ b/html/pages/bill/edit.inc.php @@ -138,7 +138,6 @@ for ($x=1;$x<32;$x++) { -

Billed Ports

".$port['hostname'], "\" style=\"color: #000;\"> ".$port['hostname'], $devicebtn); $portbtn = str_replace("\">".strtolower($port['ifName']), "\" style=\"color: #000;\"> ".$port['ifName']."".$portalias, $portbtn); - echo(" \n"); + echo(" \n"); echo(" \n"); echo(" \n"); echo(" \n"); @@ -189,7 +188,6 @@ if (is_array($ports)) ?>
-
diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 93149f601b..2e2353d13b 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -355,6 +355,13 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) '); } + echo('
  • + + Performance + +
  • '); + + echo ('
  • https
  • ssh
  • telnet
  • '); diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index f414dd4e5b..aac3b2ca23 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -26,6 +26,8 @@ echo('
    '); include("includes/dev-overview-data.inc.php"); +Plugins::call('device_overview_container',array($device)); + include("overview/ports.inc.php"); echo('
    @@ -48,6 +50,8 @@ include("overview/sensors/voltages.inc.php"); include("overview/sensors/current.inc.php"); include("overview/sensors/power.inc.php"); include("overview/sensors/frequencies.inc.php"); +include("overview/sensors/load.inc.php"); +include("overview/sensors/state.inc.php"); include("overview/eventlog.inc.php"); include("overview/services.inc.php"); include("overview/syslog.inc.php"); diff --git a/html/pages/device/overview/sensors/load.inc.php b/html/pages/device/overview/sensors/load.inc.php new file mode 100644 index 0000000000..989a305b9b --- /dev/null +++ b/html/pages/device/overview/sensors/load.inc.php @@ -0,0 +1,8 @@ + +* 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. + +* Copyright (c) 2014 Neil Lathwood +* +* 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(!isset($vars['section'])) { $vars['section'] = "performance"; } + +if (is_admin() === true || is_read() === true) { + $query = "SELECT DATE_FORMAT(timestamp, '".$config['alert_graph_date_format']."') Date, xmt,rcv,loss,min,max,avg FROM `device_perf` WHERE `device_id` = ?"; + $param = array($device['device_id']); +} else { + $query = "SELECT DATE_FORMAT(timestamp, '".$config['alert_graph_date_format']."') Date, xmt,rcv,loss,min,max,avg FROM `device_perf`,`devices_perms` WHERE `device_id` = ? AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id']; + $param = array($device['device_id']); +} + +?> + + +
    + + diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 8e438489de..0cc268fceb 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -118,13 +118,11 @@ if (!$auth) function submitCustomRange(frmdata) { var reto = /to=([0-9])+/g; var refrom = /from=([0-9])+/g; - var tsto = new Date(frmdata.dtpickerto.value.replace(' ','T')); - var tsfrom = new Date(frmdata.dtpickerfrom.value.replace(' ','T')); - tsto = tsto.getTime() / 1000; - tsfrom = tsfrom.getTime() / 1000; + var tsto = moment(frmdata.dtpickerto.value).unix(); + var tsfrom = moment(frmdata.dtpickerfrom.value).unix(); frmdata.selfaction.value = frmdata.selfaction.value.replace(reto, 'to=' + tsto); frmdata.selfaction.value = frmdata.selfaction.value.replace(refrom, 'from=' + tsfrom); - frmdata.action = frmdata.selfaction.value + frmdata.action = frmdata.selfaction.value; return true; } @@ -135,16 +133,30 @@ if (!$auth) echo('
    - +
    - +