If the test fails, it prints an error message. First the number of arguments is checked, then the actual server test is run. Lines 30-34 are invoked when the script is initially called on the command line.Lines 24-28 parse the arguments passed to the script, and determine which test was requested.Lines 17-22 establish makes an HTTP(S) request to a server, and reports if the attempt was successful.Lines 7-15 establish a TCP connection to an arbitrary hostname:port, and report if the attempt was successful.Lines 3-5 load the modules for HTTP(S) connections, TCP connections, and command line arguments, respectively.Line 1 is a requisite for running a python script directly (i.e.The first requirement is easily solved in Python by using the socket module, while the latter will use the urllib2 module. Python's built-in modules support a wide number of protocols natively, so if I use Python as the language for this project, I would be able to easily extend it in the future. Additionally, I would like my monitor to be able to pull web pages from HTTP and HTTPS and check for validity. For my personal use, it would be nice if the monitor tool were able to check arbitrary ports by attempting to connect to them. The first step in building a server monitoring system is defining the requirements for the services you need to monitor.
PROGRAM TO MONITOR INTERNET UPTIME HOW TO
How to make scripts report to you via email.How to write a simple script that connects to a server.A reliable, offsite shell acount like lends itself to this task quite naturally.
For a system administrator to keep track of uptime, a reliable method for monitoring servers and services is key. Uptime is an important statistic for anyone in the internet business.