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

What is the best approach to setting up a script to monitor and report a server's connection to the Internet? I'm not referring to connection to the local network, but rather a server's (or the whole network's) ability to access the Internet, for the cases when your ISP's connection goes down.

It would need to be a script that tests for an Internet connection 24/7 and logs the results (or possibly just logs when there is an outage), and then some other way to read these logs and generate a report, showing various stats (what % of the time was the ISP connection offline, etc).

Would this just be something as simple as pinging various popular URLs (,, etc), and using that as a test to determine if you have internet access? Or is there a better approach?

The purpose of this is mostly to log all the time our ISP is failing us, so we can show them and they can use it to fix the problem or to use the logs as leverage for my boss to use to switch ISPs.

share|improve this question

closed as off-topic by Jenny D, Dave M, Ward, mdpc, kce Oct 4 '13 at 16:37

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – Ward, kce
  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Jenny D, Dave M, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

What scripting languages do you have at your disposal? You don't even mention windows or unix based. Something like Nagios or Zabbix or any other monitoring system can do that, but might be a bit complex for your needs. – Grant Oct 1 '13 at 20:04
Sorry. Linux server here. So Bash or Python or whatever. – Jake Wilson Oct 1 '13 at 20:19
You really don't want to re-invent the wheel when it comes to monitoring. Monit is a really light weight monitor. Smokeping will make nice graphs that can easily be used to convince an ISP that the connection has problems. – Zoredache Oct 1 '13 at 20:34
Good point @Zoredache. I will look deeper into Monit to see how to handle this. – Jake Wilson Oct 2 '13 at 21:00
up vote 1 down vote accepted

This is typically done through interface monitoring using SNMP on the firewall/router itself. In addition, you could use netflow/sflow/jflow on the interfaces to gather deeper stats/info.

Larger ISPs will also offer portals with monitoring tools (Sprint/Cox/TW and others come to mind).

In addition, you can setup tools like Nagios, etc. that can ping outbound as well as an additional layer/check

You can also use 3rd party tools such as or similar to monitor from the outside in, verifying your server is reachable. Or something as simple as a free online ping monitor (just search) that will ping your firewall's WAN IP and if it is unreachable alert you.

Monitoring it only from your server's perspective is myopic and may not accurately reflect a true outage of the ISP itself.

share|improve this answer
Great idea for pinging the firewall from an external source as opposed to pinging hosts from within the local network! – Jake Wilson Oct 2 '13 at 20:59

Generically, the first thing you need to do it define exactly what you call an internet outage. Does an "outage" mean you can't reach:

  • the CPE router on your local network?
  • the ISP router on the other end of your PPP link?
  • A host somewhere in the middle of your ISP network such as a DNS or Mail server (but the ISP could have lost all upstream connectivity)?
  • A 'general' host out on the internet? What if that host is down but the rest of the internet is "up"?
  • Various hosts out on the internet? What exactly is a "fail" condition then? How many need to be unreachable before you consider the internet to be "down"?

For your specific instance (trying to pin down the stability of your internet connection), monitoring logs and/or SNMP from your router should give you the information you need, although "real-world" tests of traffic passing is probably useful to. If it's the link between you and the ISP, then pinging some of your ISP hosts (DNS/Mail etc) would be good, or better script and actual DNS lookup against their DNS server, and try to establish an SMTP connection to their mail server. Of course, don't do this too often or they might accuse you breaching Acceptable Use Policy, Terms of Service etc.

share|improve this answer
By "outage" I mean that our connection to the Internet (for the whole network) is lost due to our ISP. – Jake Wilson Oct 2 '13 at 20:56

I use a great tool for monitoring connections like this.

MTR or My Trace route.

It's very much an evolution from singular ping operations and trace routes, almost a hybrid of the two.

MTR has a few modes of operation

mtr --report

will generate a report for you to send to the ISP for analysis.

OR you can try

mtr and press d twice to see the latency or loss between all hops over a period of time.

Depending on the flavour of Linux you are referring to, most distributions have MTR in their native repos.

share|improve this answer
Cool tool thanks! But I'm looking for something that is a bit more of a long term report, rather than a single snapshot of a moment in time. Like for example, I want to send the ISP a report showing what percentage of the current month our Internet connection was down. – Jake Wilson Oct 2 '13 at 20:58

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