From 9f1d61d377e6b842d37718df95e2f051dd76759c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 9 Jul 2009 23:06:33 -0400 Subject: Send gateway notifications to GROWL --- etc/inc/gwlb.inc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'etc/inc/gwlb.inc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 4da107a..09db94a 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -308,18 +308,24 @@ function return_gateway_groups_array() { continue; } if (preg_match("/down/i", $status['status'])) { - log_error("MONITOR: $gwname has high latency, removing from routing group"); + $msg = "MONITOR: $gwname has high latency, removing from routing group"; + log_error($msg); + notify_via_growl($msg); } elseif (preg_match("/loss/i", $status['status'])) { if (strstr($group['trigger'], "loss")) { /* packet loss */ - log_error("MONITOR: $gwname has packet loss, removing from routing group"); + $msg = "MONITOR: $gwname has packet loss, removing from routing group"; + log_error($msg); + notify_via_growl($msg); } else { $tiers[$tier][] = $gwname; } } elseif (preg_match("/delay/i", $status['status'])) { if (strstr($group['trigger'] , "latency")) { /* high latency */ - log_error("MONITOR: $gwname has high latency, removing from routing group"); + $msg = "MONITOR: $gwname has high latency, removing from routing group"; + log_error($msg); + notify_via_growl($msg); } else { $tiers[$tier][] = $gwname; } @@ -332,7 +338,9 @@ function return_gateway_groups_array() { $tiers_count = count($tiers); if($tiers_count == 0) { /* Oh dear, we have no members! Engage Plan B */ - log_error("All gateways are unavailable, proceeding with configured XML settings!"); + $msg = "All gateways are unavailable, proceeding with configured XML settings!"; + log_error($msg); + notify_via_growl($msg); foreach($group['item'] as $item) { foreach($group['item'] as $item) { $itemsplit = explode("|", $item); @@ -471,4 +479,4 @@ function get_interface_gateway($interface) { return $gw; } -?> +?> \ No newline at end of file -- cgit v1.1