diff --git a/html/includes/print-graph-alerts.inc.php b/html/includes/print-graph-alerts.inc.php index ac4a713f0a..6479d7a7dc 100644 --- a/html/includes/print-graph-alerts.inc.php +++ b/html/includes/print-graph-alerts.inc.php @@ -19,11 +19,11 @@ if (isset($device['device_id']) && $device['device_id'] > 0) { } if ($_SESSION['userlevel'] >= '5') { - $query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id $sql GROUP BY DATE(time_logged),alert_rules.severity"; + $query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.rule_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity"; } if ($_SESSION['userlevel'] < '5') { - $query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE(time_logged),alert_rules.severity"; + $query = "SELECT DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."') Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id AND `alert_log`.`state` != 0 $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE_FORMAT(time_logged, '".$config['alert_graph_date_format']."'),alert_rules.severity"; } ?> @@ -86,7 +86,7 @@ echo $max_count; ?> } } }, - zoomMin: 2073600000, //24hrs + zoomMin: 86400, //24hrs zoomMax: \ No newline at end of file + diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 7cee0e712b..c9cc3d4c2c 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -603,4 +603,7 @@ $config['distributed_poller_memcached_port'] = '11211'; $config['callback_post'] = 'https://stats.librenms.org/log.php'; $config['callback_clear'] = 'https://stats.librenms.org/clear.php'; +// Stat graphs +$config['alert_graph_date_format'] = '%Y-%m-%d %H:%i'; + ?>