Solved

Remote port availability monitoring with notifications

Posted on 2007-03-26
3
303 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

759 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

19 Experts available now in Live!

Get 1:1 Help Now