Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 8:35
up vote 2 down vote accepted

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.

share|improve this answer
I agree to test IP address to avoid DNS mistake. – lg. Nov 16 '10 at 13:26

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.

share|improve this answer
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!<port number>. No need to make it difficult. – luckytaxi 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

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
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
share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.