Moniker
Monitoring Ports with Moniker
Abstract
If you're responsible for administering Internet services like HTTP, POP, and SMTP, one of your daily tasks probably consists of testing these services to make sure they're running. Alternatively, you can simply wait for a user to call and complain that mail isn't working. After all, users are often more than willing to notify you by phone or in person when a service is not working. Still, a little pro-active monitoring is a good thing as long as it doesn't require much effort. Sicking a Perl script on the problem will also reduce the amount of time you spend listening to user babble, which will allow you to focus on the more important things in life; like playing Quake for instance.
I whipped up a little script for the job (less than 100 lines) that allows me
to monitor ports on various servers. It's a command line script with a couple
switches (port and host) with an alternative switch that allows you to specify
an email address to send an alert to if the service test fails. You can
automate the process by running it as a cron job (*nix), or with at
(Scheduler on NT).
Required Modules
For Moniker to work on your system, you should have a recent version of Perl installed, 5.003 or better. You will also need the following modules installed:
Mail::Sendmail
Net::Telnet
- on *nix:
perl -MCPAN -e "install Mail::Sendmail"
- on NT/Win95:
ppm install --location=https://alma.ch/perl/ppm Mail-Sendmail
- on *nix:
perl -MCPAN -e "install Net::Telnet"
- on NT/Win95:
ppm install Net-Telnet
Syntax
The usage for moniker is quite simple:
moniker -h host -s service [-e email]
-h
Hostname or IP address of the machine you want to test-s
Name of the service you want to test. Currently, these are ftp, ssh,
telnet, www, pop, nntp, imap, and smtp-e
Email to send alert to if the test fails
So, to test the Web Mother of Perl Web server, the syntax would be:
moniker -h www.motherofperl.com -s www
moniker -h www.motherofperl.com -s www -e [email protected]
|
Produced by Jonathan
Eisenzopf and
Created: August 4, 1999
Revised: August 4, 1999
URL: https://www.webreference.com/perl/tutorial/6/