summaryrefslogtreecommitdiffstats
path: root/modules-available/systemstatus
diff options
context:
space:
mode:
authorSimon Rettberg2017-03-02 14:26:21 +0100
committerSimon Rettberg2017-03-02 14:26:21 +0100
commit72e95b9c506c61d8d60eb8949d129bc496277e4a (patch)
tree0182e66a639870a4f9ad789ee4fbe8d2e7a015da /modules-available/systemstatus
parentFinish modularizing cron; Add error detection for crashed cron jobs (diff)
downloadslx-admin-72e95b9c506c61d8d60eb8949d129bc496277e4a.tar.gz
slx-admin-72e95b9c506c61d8d60eb8949d129bc496277e4a.tar.xz
slx-admin-72e95b9c506c61d8d60eb8949d129bc496277e4a.zip
[systemstatus] Add lighttpd error log
Diffstat (limited to 'modules-available/systemstatus')
-rw-r--r--modules-available/systemstatus/page.inc.php32
-rw-r--r--modules-available/systemstatus/templates/_page.html9
2 files changed, 41 insertions, 0 deletions
diff --git a/modules-available/systemstatus/page.inc.php b/modules-available/systemstatus/page.inc.php
index 59a69267..b9fef0fd 100644
--- a/modules-available/systemstatus/page.inc.php
+++ b/modules-available/systemstatus/page.inc.php
@@ -269,6 +269,38 @@ class Page_SystemStatus extends Page
echo '<pre>', htmlspecialchars(substr($data, $start), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>';
}
+ protected function ajaxLighttpdLog()
+ {
+ $fh = @fopen('/var/log/lighttpd/error.log', 'r');
+ if ($fh === false) {
+ echo 'Error opening log file';
+ return;
+ }
+ fseek($fh, -6000, SEEK_END);
+ $data = fread($fh, 6000);
+ @fclose($fh);
+ if ($data === false) {
+ echo 'Error reading from log file';
+ return;
+ }
+ // If we could read less, try the .1 file too
+ $amount = 6000 - strlen($data);
+ if ($amount > 100) {
+ $fh = @fopen('/var/log/lighttpd/error.log.1', 'r');
+ if ($fh !== false) {
+ fseek($fh, -$amount, SEEK_END);
+ $data = fread($fh, $amount) . $data;
+ @fclose($fh);
+ }
+ }
+ if (strlen($data) < 5990) {
+ $start = 0;
+ } else {
+ $start = strpos($data, "\n") + 1;
+ }
+ echo '<pre>', htmlspecialchars(substr($data, $start), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), '</pre>';
+ }
+
protected function ajaxLdadpLog()
{
$haveSysconfig = Module::isAvailable('sysconfig');
diff --git a/modules-available/systemstatus/templates/_page.html b/modules-available/systemstatus/templates/_page.html
index 51aa5b55..0573a20c 100644
--- a/modules-available/systemstatus/templates/_page.html
+++ b/modules-available/systemstatus/templates/_page.html
@@ -97,6 +97,14 @@
</div>
<div class="panel panel-default">
<div class="panel-heading">
+ {{lang_lighttpdLog}}
+ </div>
+ <div class="panel-body" id="lighttpd-log">
+ <span class="glyphicon glyphicon-refresh slx-rotation"></span>
+ </div>
+</div>
+<div class="panel panel-default">
+ <div class="panel-heading">
netstat -tulpn
</div>
<div class="panel-body" id="netstat">
@@ -124,6 +132,7 @@
$('#netstat').load('?do=SystemStatus&action=Netstat');
$('#pslist').load('?do=SystemStatus&action=PsList');
$('#ldadp-log').load('?do=SystemStatus&action=LdadpLog');
+ $('#lighttpd-log').load('?do=SystemStatus&action=LighttpdLog');
}, 300);
}, false);
</script>