0

I have a Linksys WRT54GL router that is running openwrt. I have a primary internet connection and a secondary connection which works as a failover connection when our primary link goes down. Both connections have public ips.

I now want to monitor both connections using nagios such that I can be notified when either of them goes down. Im also using pnp4nagios for graphing which I also intend to find out outage stats of each connection.

Now my question is, what nagios plugin do you recommend to use to monitor these connections. Is there such a plugin ideal for such a scenario, and how do you go about it?

Khaled
  • 36,533
  • 8
  • 72
  • 99
Kibet
  • 252
  • 4
  • 12
  • I am not expert with openwrt. Can you monitor your link/connection state via system "shell"? If so, you can write your own plugin! I did this in Linux. It is very simple. – Khaled Nov 16 '10 at 08:35

3 Answers3

3

NAGIOS' usual approach to monitoring link-state is somewhat simpler, at least as regards its status map and the concept of host dependencies: it wants to be able to contact the device immediately at the other end of the link. The definition of "contact" is usually ICMP echo-request (ping), but it's arbitrarily configurable.

Yes, you could instead devise some test for openwrt that tells you the router's view of the link-state, but: let us assume that such a test can be written.

  • Either it's always going to give the same results as testing connectivity to the other end of the link, in which case, why did you bother doing a complex thing when a simple one sufficed,
  • or it can occasionally give a different result to the test of connectivity to the other end of the link, in which case I submit that the test is broken; what use is it that the router assures you that the link is up if it won't carry traffic.

I'm a great believer in testing what you actually want to know. In this case, I assume you want to know if the links will carry traffic; if so, then don't delegate the answer to another device - test it for yourself.

If that doesn't convince you, look at the openwrt code and find out how it determines if the link is up - and repeat that test from NAGIOS.

MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • Really? I think checking http as Matt mentioned is so much simpler and easier to setup. Bottom line, he wants to test the connectivity and if http is available publicly then check_http is all he needs. If ping isn't available, there's gotta be a port that's open via openwrt and he can use check_tcp!. No need to make it difficult. – sdot257 Nov 17 '10 at 16:58
  • The OP says he has a 1ary and 2ary link, and he wants to know when **either** of them goes down. Assuming his failover is well setup, checking http to a remote webserver won't actually tell him that; it will only tell him when **both** have failed. – MadHatter Nov 22 '10 at 14:51
2

I would use the check_http script, strangely enough. Have it make an http request every N minutes to something that you are relatively sure will be up (google, facebook, yahoo). If you don't want it to complain when DNS is not working, use the remote server's IP instead of the DNS name.

matt
  • 1,152
  • 1
  • 8
  • 18
0

check_http doesn't do the job, as WRT54GL routers generate a SSLv1 certificate (Tomato 1.28 in my case) which isn't accepted by the check_http nagios plugin (only SSLv2 & SSLv3 in nagios-plugins 1.4).

nagios@host:~# ./check_http --ssl -H cacert.org
HTTP OK: HTTP/1.1 302 Found - 412 bytes in 0.446 second response time |time=0.445800s;;;0.000000 size=412B;;;0
nagios@host:~# ./check_http --ssl -H myrouter.local
CRITICAL - Cannot make SSL connection 
20391:error:14077417:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert illegal parameter:s23_clnt.c:602:
HTTP CRITICAL - Error on receive

user check_tcp instead

nagios@host:~# ./check_tcp -p 443 -H myrouter.local
TCP OK - 0.059 second response time on port 443|time=0.059017s;;;0.000000;10.000000
  • This is a decent answer, except that it doesn't answer the question that was asked. The original question refers to looking at the uptime of primary and secondary internet connections plugged into the router, not the router itself. – NathanG Nov 20 '12 at 20:54