Solved

Remote port availability monitoring with notifications

Posted on 2007-03-26
3
304 Views
Last Modified: 2010-04-20
I want to be able to watch a few remote systems for application availability and send a notification via SMTP if they bocome unavailable. I only need to see if the HTTPS port is listening say every minute and then send the notification.

I am sure I could do this with a script but would rather just use something already proven, open source and, even better, an RPM for FC4 or something that is straightforward to compile.

Anybody have any ideas?
0
Comment
Question by:ferg-o
3 Comments
 
LVL 10

Accepted Solution

by:
Luxana earned 125 total points
ID: 18797745
Hi,

You can use lsof as the main core of your smalll IDS. Change "awk" to regex you prefer. This will check it every 10 secs.


#!/bin/bash
MAILTO="root"
HOSTNAME=`hostname`
getports() {
  lsof -i -n -P | awk '/LISTEN/ {print $1"/"$3"/"$8}' | sort -u
}

OLD="$(getports)"
echo -e "Services monitored:\n$OLD"
while sleep 10 ; do
  NEW="$(getports)"
  if test "$OLD" != "$NEW" ; then
    echo "Sending mail to administrator"
    mail -s "Warning: $HOSTNAME LISTEN-Status changed" $MAILTO <<EOF
#old status
$OLD

#new status
$NEW
EOF
  fi
  OLD="$NEW"
done


Hope this helps...
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 125 total points
ID: 18797882
Nagios is what a lot of people use, but it maybe a little overkill if you're just monitoring a couple of servers.

http://nagios.org/
0
 
LVL 4

Author Comment

by:ferg-o
ID: 18798503
Hi thanks for these - the script option is beind me to customise and I would have trouble growing it out as I need to monitor more device.

Nagios is very configurable etc but definately too much for us at this stage - it would take me more time to configure it than I would save!

The only sorta easy things for dumb admins that I have found runs on Windows...
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now