From 02697cb42f76c55f326a864ebc9f8e7c7eea3fd4 Mon Sep 17 00:00:00 2001 From: jazzl0ver Date: Wed, 6 Apr 2016 14:06:52 +0300 Subject: notify by email and in syslog when a channel goes up or down --- src/etc/inc/gwlb.inc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/etc') diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index e712319..134690d 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -937,15 +937,27 @@ function return_gateway_groups_array() { $gwdown = true; } if ($gwdown == true) { - log_error($msg); - notify_via_growl($msg); - notify_via_smtp($msg); + if (!file_exists("/tmp/.down.$gwname")) { + $msg .= "\n".implode("|", $status); + touch("/tmp/.down.$gwname"); + log_error($msg); + notify_via_growl($msg); + notify_via_smtp($msg); + } } else { /* Online add member */ if (!is_array($tiers[$tier])) { $tiers[$tier] = array(); } $tiers[$tier][] = $gwname; + if (file_exists("/tmp/.down.$gwname")) { + $msg = "MONITOR: {$gwname} is available now, adding to routing group"; + $msg .= "\n".implode("|", $status); + log_error($msg); + notify_via_growl($msg); + notify_via_smtp($msg); + unlink("/tmp/.down.$gwname"); + } } } else if (isset($gateways_arr[$gwname]['monitor_disable'])) { $tiers[$tier][] = $gwname; -- cgit v1.1