diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2016-12-09 23:13:45 -0600 |
---|---|---|
committer | Luiz Otavio O Souza <luiz@netgate.com> | 2016-12-09 23:13:45 -0600 |
commit | ca8ab3c958ace8fb42eb2f00cea7db74ae0bf707 (patch) | |
tree | e7d664971d7f41b608136f635dce8a4e8c332dc5 /src/etc/inc/gwlb.inc | |
parent | 140f1f6fe44d9f42011413ab718eab045f8624af (diff) | |
download | pfsense-ca8ab3c958ace8fb42eb2f00cea7db74ae0bf707.zip pfsense-ca8ab3c958ace8fb42eb2f00cea7db74ae0bf707.tar.gz |
Add a gateway state plugin hook.
Pull Request #3093
Diffstat (limited to 'src/etc/inc/gwlb.inc')
-rw-r--r-- | src/etc/inc/gwlb.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 696f150..ab4d53f 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -940,7 +940,11 @@ function return_gateway_groups_array() { $msg = sprintf(gettext('MONITOR: %1$s has high latency, omitting from routing group %2$s'), $gwname, $group['name']); $gwdown = true; } + $pluginparams = array(); + $pluginparams['type'] = 'gateway'; + $pluginparams['name'] = ${gwname}; if ($gwdown == true) { + $pluginparams['event'] = 'gateway.down'; if (!file_exists("/tmp/.down.{$gwname}")) { $msg .= "\n".implode("|", $status); touch("/tmp/.down.{$gwname}"); @@ -949,6 +953,7 @@ function return_gateway_groups_array() { notify_via_smtp($msg); } } else { + $pluginparams['event'] = 'gateway.up'; /* Online add member */ if (!is_array($tiers[$tier])) { $tiers[$tier] = array(); @@ -962,6 +967,9 @@ function return_gateway_groups_array() { notify_via_smtp($msg); } } + if (isset($gateways_arr[$gwname]['interface'])) + $pluginparams['interface'] = $gateways_arr[$gwname]['interface']; + pkg_call_plugins('plugin_gateway', $pluginparams); } else if (isset($gateways_arr[$gwname]['monitor_disable']) || isset($gateways_arr[$gwname]['action_disable'])) { $tiers[$tier][] = $gwname; } |