From 24406cd568a47a8a8e4b30406cf5c0ee1e4e2c82 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 24 Oct 2017 15:19:30 +0200 Subject: indicate time of previous err with timewindow; we seem to have false triggers --- it.class | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 5246336..e42bbeb 100644 --- a/it.class +++ b/it.class @@ -200,7 +200,8 @@ static function error($p = array()) else { $errstampfn = "/tmp/alertdata/errstamp_" . urlencode($p['id']); - $errstampage = time() - @filemtime($errstampfn); + $errstamp = @filemtime($errstampfn); + $errstampage = time() - $errstamp; $sendmail = $errstampage >= $p['graceperiod'] && $errstampage <= $p['graceperiod'] + $p['timewindow']; if ($errstampage > $p['graceperiod']) { @@ -248,7 +249,7 @@ static function error($p = array()) $stackframes[] = $stackframe; $body .= "Host: " . getenv('HOSTNAME') . "\n\n"; - $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . "\n\n" : ""; + $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . " (previous err: " . it::date('', $errstamp) . ")\n\n" : ""; $body .= "Time: " . date("Y-m-d H:i:s") . (($t = time() - $_SERVER['REQUEST_TIME']) ? " (started {$t}s before)" : "") . "\n\n"; # no it::date() due to time- debug param $body .= "Overview: ssh " . getenv('HOSTNAME') . " 'tail -100000 /tmp/alertdata/alert.log | grep \"$trace\"'\n\n"; $body .= $_GET ? "\$_GET: " . var_export($_GET, true) . "\n\n" : ""; -- cgit v1.2.3