Solved

Remote port availability monitoring with notifications

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux Hosting 16 108
Check for Linux process in script 7 90
how to write and save a unix script 12 42
PartedMagic Secure Erase 14 35
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…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

710 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