diff --git a/html/includes/common/eventlog.inc.php b/html/includes/common/eventlog.inc.php new file mode 100644 index 000000000..9cce9daca --- /dev/null +++ b/html/includes/common/eventlog.inc.php @@ -0,0 +1,29 @@ + + + + Datetime + Hostname + Type + Message + + + + + +'; diff --git a/html/includes/common/syslog.inc.php b/html/includes/common/syslog.inc.php new file mode 100644 index 000000000..c4ab66576 --- /dev/null +++ b/html/includes/common/syslog.inc.php @@ -0,0 +1,29 @@ + +
+
+
+
+ Syslog entries +
+ '; + +foreach (dbFetchRows($sql) as $entry) { + $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); + include 'includes/print-syslog.inc.php'; +} + +$syslog_output .= ' +
+
+
+
+ +'; + +$common_output[] = $syslog_output; diff --git a/html/includes/common/worldmap.inc.php b/html/includes/common/worldmap.inc.php new file mode 100644 index 000000000..7ab55228c --- /dev/null +++ b/html/includes/common/worldmap.inc.php @@ -0,0 +1,74 @@ + + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + +/** + * Custom Frontpage + * @author f0o + * @copyright 2014 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Frontpage + */ + +if ($config['map']['engine'] == 'leaflet') { + +$temp_output = ' + + + +
+'; + +} else { + $temp_output = 'Mapael engine not supported here'; +} + +unset($common_output); +$common_output[] = $temp_output; diff --git a/html/includes/print-syslog.inc.php b/html/includes/print-syslog.inc.php index 1a7564920..0f1c1c669 100644 --- a/html/includes/print-syslog.inc.php +++ b/html/includes/print-syslog.inc.php @@ -1,18 +1,18 @@ '; + $syslog_output .= ''; // Stop shortening hostname. Issue #61 // $entry['hostname'] = shorthost($entry['hostname'], 20); if ($vars['page'] != 'device') { - echo ''.$entry['date'].''; - echo ''.generate_device_link($entry).''; - echo ''.$entry['program'].' : '.htmlspecialchars($entry['msg']).''; + $syslog_output .= ''.$entry['date'].' + '.generate_device_link($entry).' + '.$entry['program'].' : '.htmlspecialchars($entry['msg']).''; } else { - echo ''.$entry['date'].'   '.$entry['program'].'   '.htmlspecialchars($entry['msg']).''; + $syslog_output .= ''.$entry['date'].'   '.$entry['program'].'   '.htmlspecialchars($entry['msg']).''; } - echo ''; + $syslog_output .= ''; } diff --git a/html/pages/device/logs/syslog.inc.php b/html/pages/device/logs/syslog.inc.php index 1284ad157..94e5c87e8 100644 --- a/html/pages/device/logs/syslog.inc.php +++ b/html/pages/device/logs/syslog.inc.php @@ -48,7 +48,9 @@ echo '
'; foreach (dbFetchRows($sql, $param) as $entry) { + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
diff --git a/html/pages/device/overview/syslog.inc.php b/html/pages/device/overview/syslog.inc.php index bcfb6d2c5..0b27b1a61 100644 --- a/html/pages/device/overview/syslog.inc.php +++ b/html/pages/device/overview/syslog.inc.php @@ -12,7 +12,9 @@ if ($config['enable_syslog']) { echo ' '; foreach ($syslog as $entry) { + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
'; diff --git a/html/pages/eventlog.inc.php b/html/pages/eventlog.inc.php index 2ac41ec91..f33a2cb88 100644 --- a/html/pages/eventlog.inc.php +++ b/html/pages/eventlog.inc.php @@ -42,31 +42,9 @@ print_optionbar_start(); - - - - - - - - - -
DatetimeHostnameTypeMessage
- - diff --git a/html/pages/front/default.php b/html/pages/front/default.php index 19f222546..fcb2f8542 100644 --- a/html/pages/front/default.php +++ b/html/pages/front/default.php @@ -192,7 +192,9 @@ if ($config['enable_syslog']) { foreach (dbFetchRows($sql) as $entry) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo ''; diff --git a/html/pages/front/demo.php b/html/pages/front/demo.php index 6478a566b..da29f70cb 100644 --- a/html/pages/front/demo.php +++ b/html/pages/front/demo.php @@ -156,7 +156,9 @@ echo ''; foreach (dbFetchRows($sql) as $entry) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
'; diff --git a/html/pages/front/example2.php b/html/pages/front/example2.php index e5898ac07..8a01e4393 100644 --- a/html/pages/front/example2.php +++ b/html/pages/front/example2.php @@ -89,7 +89,9 @@ echo " $sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog ORDER BY timestamp DESC LIMIT 20"; echo ''; foreach (dbFetchRows($sql) as $entry) { + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
'; diff --git a/html/pages/front/globe.php b/html/pages/front/globe.php index 17b0147b8..f4d8d300e 100644 --- a/html/pages/front/globe.php +++ b/html/pages/front/globe.php @@ -86,7 +86,9 @@ if ($config['enable_syslog']) { foreach (dbFetchRows($sql) as $entry) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo(""); echo(""); diff --git a/html/pages/front/jt.php b/html/pages/front/jt.php index cda0b49bb..c5bb988e5 100644 --- a/html/pages/front/jt.php +++ b/html/pages/front/jt.php @@ -102,7 +102,9 @@ echo " $sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20"; echo ''; foreach (dbFetchRows($sql) as $entry) { + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
'; diff --git a/html/pages/front/map.php b/html/pages/front/map.php index dd8d1a18d..d3c442c88 100644 --- a/html/pages/front/map.php +++ b/html/pages/front/map.php @@ -23,50 +23,8 @@ */ if ($config['map']['engine'] == 'leaflet') { -?> - - - -
- - { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); + unset($syslog_output); include("includes/print-syslog.inc.php"); + echo $syslog_output; } echo(""); echo(""); @@ -250,10 +210,9 @@ echo('
'); - foreach (dbFetchRows($query) as $entry) - { - include("includes/print-event.inc.php"); - } + foreach (dbFetchRows($query) as $entry) { + include 'includes/print-event.inc.php'; + } echo("
"); echo(""); diff --git a/html/pages/front/traffic.php b/html/pages/front/traffic.php index 6b501cf9c..f7dd3dcff 100644 --- a/html/pages/front/traffic.php +++ b/html/pages/front/traffic.php @@ -96,7 +96,9 @@ echo " $sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20"; echo ''; foreach (dbFetchRows($sql) as $entry) { + unset($syslog_output); include 'includes/print-syslog.inc.php'; + echo $syslog_output; } echo '
'; diff --git a/sql-schema/060.sql b/sql-schema/060.sql new file mode 100644 index 000000000..93d006f8d --- /dev/null +++ b/sql-schema/060.sql @@ -0,0 +1 @@ +INSERT INTO `widgets` (`widget_title`, `widget`, `base_dimensions`) VALUES ('Syslog', 'syslog', '9,3'), ('Eventlog', 'eventlog', '9,5'), ('Global Map', 'worldmap', '8,6');