From 25eef8bfb91c2c57907ab79f4ba6bcd9fe0064cb Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 30 Mar 2011 12:09:58 -0700 Subject: check in for Bug 6959 Add the ability to run a user defined script to determine wan load-balancing interface health includes sample http test (scripts/http_test.pl). Configuration will look as follows: wan { interface-health eth0 { nexthop 10.3.0.1 test 1 { test-script /tmp/http_test.pl type user-defined } } interface-health eth1 { nexthop 10.3.0.1 test 1 { test-script /tmp/http_test.pl type user-defined } } With corresponding output: vyatta@vyatta# run show wan-load-balance Interface: eth0 Status: active Last Status Change: Wed Mar 30 19:03:59 2011 +Test: user Script: /tmp/http_test.pl Last Interface Success: 0s Last Interface Failure: n/a # Interface Failure(s): 0 Interface: eth1 Status: failed Last Status Change: Wed Mar 30 19:03:59 2011 -Test: user Script: /tmp/http_test.pl Last Interface Success: n/a Last Interface Failure: 0s # Interface Failure(s): 52 Scripts returns 0 for success, non-zero for failure. --- src/lbtest.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lbtest.hh') diff --git a/src/lbtest.hh b/src/lbtest.hh index 208adaa..4463315 100644 --- a/src/lbtest.hh +++ b/src/lbtest.hh @@ -59,12 +59,15 @@ public: virtual string dump() = 0; - int + virtual int recv(LBHealth &health); virtual string name() = 0; + virtual string + status() {return _status_line;} + private: int receive(int recv_sock); @@ -75,6 +78,8 @@ public: string _target; int _resp_time; int _state; + string _status_line; + static int _recv_icmp_sock; static int _send_raw_sock; -- cgit v1.2.3