I want something that will tell me when something on a remote system has stopped working. I.e. I want silence (no E-Mail) when it's working and I want to receive an E-Mail when it stops working.
For local tasks cron does this quite nicely, as long as the job produces no output (no errors), cron is silent but as soon as there's an error that produces output you get an E-Mail message.
The task I want to keep tabs on is a cron job on a remote system, it's OK as long as the remote system is up and running and connected. The cron job will work similarly to a local cron job and will send me an E-Mail if anything goes wrong (well, most things). However if the system dies completely or if one can't connect to it then I'll never know.
I suppose all I need to have is a silent test to see if I can connect to the remote system which becomes non-silent if one can't connect. I can then run this from cron. As long as I can connect to the remote system its cron will tell me if the job I'm interested in has worked.
Can anyone suggest such a test? I guess a script using ping could do it but is there a more elegant and/or ready made utility to do it?
On 29 Jan 17:29, Chris G wrote:
I want something that will tell me when something on a remote system has stopped working. I.e. I want silence (no E-Mail) when it's working and I want to receive an E-Mail when it stops working.
For local tasks cron does this quite nicely, as long as the job produces no output (no errors), cron is silent but as soon as there's an error that produces output you get an E-Mail message.
The task I want to keep tabs on is a cron job on a remote system, it's OK as long as the remote system is up and running and connected. The cron job will work similarly to a local cron job and will send me an E-Mail if anything goes wrong (well, most things). However if the system dies completely or if one can't connect to it then I'll never know.
I suppose all I need to have is a silent test to see if I can connect to the remote system which becomes non-silent if one can't connect. I can then run this from cron. As long as I can connect to the remote system its cron will tell me if the job I'm interested in has worked.
Can anyone suggest such a test? I guess a script using ping could do it but is there a more elegant and/or ready made utility to do it?
Nagios? Munin with alerts turned on? Or something really simple like:
---- Script Start ---- #!/bin/bash
machine="i.p.to.check"
if [ ! ping -c 1 $machine >/dev/null 2>&1 ]; then echo $machine is down. fi
---- Script End ----
Cheers,