I would like to set up a cron job to automatically check whether my mailserver and webserver are up, and tell me if they're not. This script tells me if my webserver is up: #!/bin/bash wget -q --tries=10 --timeout=20 --spider http://melvilletheatre.com if [[ $? -eq 0 ]]; then echo "Online" else echo "Offline" fi How can I do the something similar with my mailserver? Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested. -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
On 11/4/2014 11:36 AM, Frank Cox wrote:> Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested.Nagios. -- john r pierce 37N 122W somewhere on the middle of the left coast
El 04/11/14 a las 20:36, Frank Cox escribi?:> I would like to set up a cron job to automatically check whether my mailserver and webserver are up, and tell me if they're not. > > This script tells me if my webserver is up: > > #!/bin/bash > wget -q --tries=10 --timeout=20 --spider http://melvilletheatre.com > if [[ $? -eq 0 ]]; then > echo "Online" > else > echo "Offline" > fi > > How can I do the something similar with my mailserver? > > Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested. >Hello I use Nmap to test if a server up in a port: $ nmap -p587 a.mail.server |grep -i 587 587/tcp open submission Or several ports: $ nmap -p25,143,587 a.mail.server |grep -i open 25/tcp open smtp 143/tcp open imap 587/tcp open submission If the server is working, the port is shown as open. You can parse it as desired to message you as you want Best
On Tue, Nov 4, 2014 at 1:36 PM, Frank Cox <theatre at melvilletheatre.com> wrote:> > > Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested. >Overkill for one or a few sites, but: http://www.opennms.org/ can monitor most network services with a framework for alarms and notifications, plus keeping nice graph histories of snmp data (interface traffic, cpu/disk/memory use, etc. -- Les Mikesell lesmikesell at gmail.com
Am 04.11.2014 um 20:36 schrieb Frank Cox <theatre at melvilletheatre.com>:> I would like to set up a cron job to automatically check whether my mailserver and webserver are up, and tell me if they're not. > > This script tells me if my webserver is up: > > #!/bin/bash > wget -q --tries=10 --timeout=20 --spider http://melvilletheatre.com > if [[ $? -eq 0 ]]; then > echo "Online" > else > echo "Offline" > fi > > How can I do the something similar with my mailserver? > > Or if someone knows of an integrated tool that will monitor this in a better way (whatever that may be), I'm more than interested.mon - old lady but small: $ yum -y install epel-release ; yum install mon $ rpm -qi mon |grep -E 'Size|Summary' Size : 1155876 Summary : General-purpose resource monitoring system $ rpm -ql mon | grep -E 'http|imap|smtp|pop&or$' /usr/lib64/mon/mon.d/http.monitor /usr/lib64/mon/mon.d/http_tppnp.monitor /usr/lib64/mon/mon.d/imap.monitor /usr/lib64/mon/mon.d/phttp.monitor /usr/lib64/mon/mon.d/smtp.monitor /usr/lib64/mon/mon.d/smtp3.monitor $ vi /etc/mon/mon.cf $ service mon start $ monshow and if you like (on EL{5,6}): $ chkconfig mon on -- LF
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It could be done using a crontab job and it's very efficient sometimes to use only a crontab job instead of nagios. You can use the precompiled nagios scripts for the task. Unless you have constrains on the OS allowed languages and packages, which then should be evaluated more deeply to meet your needs which might be missing. So: - - Nagios scripts as crontab job - - Other tcp level scripts as a crontab job - - fully fledged nagios - - other relevant solutions in your scope Eliezer On 11/04/2014 09:36 PM, Frank Cox wrote:> I would like to set up a cron job to automatically check whether my > mailserver and webserver are up, and tell me if they're not.-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUWehzAAoJENxnfXtQ8ZQUaIEH/AtTmVDT7XN7uiFHSvPQRyEI Azb2L+RSMbvRq+n8yBx52D04F6A0YvRGYzA2/4i6ZK8ai3PV9DN1Y8IRim8PvNbf UvvQAVA4XvKT/nDSQJHP7GldcUS0WBPTm4BP/MAl1QYM5CPhc5FoP9+UhUgELxoj ZMzE58T+3XtzpQ5jeGELv9Oratz/zCIi+ysCdoJmoBgBd5Zg3Rfq53UGCxlKK6QB pfAYR0wfKn4O5Yo+EHTHlDHM+PIUzqdEKPtCWWigPhGAiLyrbMXHLL+PM3Tw2wZ8 82She07GAmyqyAkwBvi92z74fedMyjFEcgodEk0PbZpRN6JsWSmF0sxwcy4RZiA=yLLM -----END PGP SIGNATURE-----
On 11/4/2014 2:36 PM, Frank Cox wrote:> I would like to set up a cron job to automatically check whether my mailserver and webserver are up, and tell me if they're not. > > This script tells me if my webserver is up:...> How can I do the something similar with my mailserver?How about a cron job that e-mails you the output of 'service httpd status' or equivalent? You'll get a message that tells you if your web server is up or not. If you don't get a message, your mail server is down! (HHOS.) Unless you're just collecting performance or availability metrics for reports, how you intend to be notified is something to consider. It's trivial to have a web server's failing check result e-mailed to you, but you need an out-of-band notification method (an old Nokia phone attached to the serial port that emits an SMS message, for example) if your mail server is having difficulty. -- -Chris
Maybe Matching Threads
- Best way to do automated acceptance tests
- automated response
- Please accept our apologies. Your mail to rails@lists.rubyonrails.org was rejected by an automated spam filter. Please send another message.
- Rails Machine: Automated Rails application hosting
- automated installation of puppet into solaris 10 zone after insta lling zone with puppet