summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-02-05 15:50:28 +0000
committerUrban Müller2007-02-05 15:50:28 +0000
commitc330b7962ae9af5093cfe47e9cb981f6e9720ca2 (patch)
tree1219ecedac86c6071c0e9e83b5d293c8588b897e
parent8a1280360e6e2e3c9a59d4bec61dbdaedcc1fa4d (diff)
downloaditools-c330b7962ae9af5093cfe47e9cb981f6e9720ca2.tar.gz
itools-c330b7962ae9af5093cfe47e9cb981f6e9720ca2.tar.bz2
itools-c330b7962ae9af5093cfe47e9cb981f6e9720ca2.zip
grace period for it::error
-rw-r--r--it.class10
1 files changed, 5 insertions, 5 deletions
diff --git a/it.class b/it.class
index e79f228..e02ba5f 100644
--- a/it.class
+++ b/it.class
@@ -67,7 +67,7 @@ function timerlog($label = '')
* @param $to (optional) comma separated recipient list
* @param named parameter id identifier of error. if given, only subsequent errors of same id will trigger message
* @param named parameter timewindow number of seconds within which the second error must occur
- * @param named parameter interval minimum number of seconds between alerts
+ * @param named parameter graceperiod numer of seconds within which additional errors are ignored
*/
function error($p = array(), $body = "", $to = "")
{
@@ -83,7 +83,7 @@ function error($p = array(), $body = "", $to = "")
$p = array();
}
- $p += array('timewindow' => 25*3600, 'interval' => 6*3600);
+ $p += array('timewindow' => 25*3600, 'graceperiod' => 60);
if (!$to)
$to = strtr(trim(@file_get_contents($GLOBALS['ULTRAHOME'] . "/.diffnotice")), array("\n"=>',', ' '=>''));
@@ -93,10 +93,10 @@ function error($p = array(), $body = "", $to = "")
$stampfn = $GLOBALS['ULTRAHOME'] . "/tmp/errstamp_" . urlencode($p['id']);
$stampage = time() - @filemtime($stampfn);
- if ($stampage >= 60 && $stampage <= $p['timewindow'])
+ if ($stampage >= $p['graceperiod'] && $stampage <= $p['timewindow'])
$sendalert = true;
- if ($stampage >= 60) # constantly occurring errors should not suppress mail
+ if ($stampage >= $p['graceperiod']) # constantly occurring errors should not suppress mail
touch($stampfn);
}
else
@@ -116,7 +116,7 @@ function error($p = array(), $body = "", $to = "")
}
else
{
- $cmd = "alert -l -i " . escapeshellarg($p['interval']) ." " . escapeshellarg($to) . " 4 " . escapeshellarg($title);
+ $cmd = "alert -l " . escapeshellarg($to) . " 4 " . escapeshellarg($title);
EDC('exec', $cmd);
if (($pipe = popen($cmd, "w")))