Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remote port availability monitoring with notifications

Posted on 2007-03-26
3
Medium Priority
?
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Luxana earned 375 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 375 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

670 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