LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   monitoning services (https://www.linuxquestions.org/questions/linux-general-1/monitoning-services-429467/)

seefor 03-28-2006 08:46 PM

monitoning services
 
Greetings all,

I'm new to Linux and was looking around for some kind of software that monitors your service(s).
If a service stop it will send out an email. Is there anything like that out there?

Thanks in advance,
Sif aka SeeFor

gilead 03-28-2006 09:13 PM

Are you talking about a home PC or do you have several PCs in an office? Nagios (http://www.nagios.org/) is probably overkill for home, but is useful in an office.

Alternatively, set up a cron job that scans your open ports and emails you when one of them no longer accepts connections.

seefor 03-28-2006 09:39 PM

gilead thank you very much.

It's for the office, we have six new Linux servers and I'm now learning Linux

Thanks for your advice.

Not sure how to setup a cron job to scan open ports. So I will start off by looking in to Nagios.

Thanks again!

-Sif aka SeeFor

gilead 03-29-2006 06:39 AM

If you have nmap installed you can create a cron job in (for example) /etc/cron.hourly called stopped-daemons.sh that contains the following (change the port numbers to those you want to monitor):
Code:

#!/bin/sh

for CLOSED in "$(/usr/local/bin/nmap -p 22,80,443 localhost | /usr/bin/grep 'closed' | /usr/bin/awk {'print $1'})"; do
  if [ ! -z "$CLOSED" ]; then
    echo "Port $CLOSED has closed."
  fi
done

cron should email any output to you and there should only be output if one the ports 22, 80 or 443 becomes closed.


All times are GMT -5. The time now is 10:34 PM.