Network devices presence monitoring

Screwface
Hi,

I'm thinking about using a mini to make a home alarm, based on IP webcams
and motion package. My question is, it can't be really efficient if
unplugging the power source or ethernet cable from the webcams is sufficent
to put the system down.
So I would like to have a kind of monitoring function which rings the alarm
if a webcam disappears from the network.
I thought about a solution which pings each camera each minute or something
like that.

Do you have an idea to do such a monitoring ?

Thanks for your help

Screwface
No idea?
Anybody?
:-)

davef
Guess I didn't see your request :)

Ethernet driven webcams?  I thought most of them were USB.

So, they are connected via ethernet .. why not a cron job pinging them and
then sent an alarm message.  I could show you a script to do that.

davef
This was for collecting ping return times for a rrdtool database.  Maybe,
it will give you some ideas.  There could be an easier ping parameter to
monitor, search "ICMP echo reply".


#!/bin/bash -x

## set the paths
command="/bin/ping -q -c 3"
gawk="/usr/bin/gawk"
rrdtool="/usr/bin/rrdtool"
hosttoping="192.168.1.1"
 
### data collection routine 
get_data() {
    local output=$($command $1 2>&1)
    local method=$(echo "$output" | $gawk '
        BEGIN {pl=100; rtt=0.1}
        /packets transmitted/ {
            match($0, /([0-9]+)% packet loss/, datapl)
            pl=datapl[1]
        }
        /min\/avg\/max/ {
            match($4, /(.*)\/(.*)\/(.*)\/(.*)/, datartt)
            rtt=datartt[2]
        }
        END {print pl ":" rtt}
        ')
    RETURN_DATA=$method
}
 
### change to the script directory
cd /home/davef/rrdtool-pingtest/
 
### collect the data
get_data $hosttoping
 
### update the database
$rrdtool update /home/davef/rrdtool-pingtest/latency_db.rrd --template
pl:rtt N:$RETURN_DATA

Think I got this from a rrdtool tutorial.  If you want to use ping to
collect this type of data I found Busybox ping wouldn't cut it. I use
inetutils ping.

Screwface
Thank you very much for your suggestion Davef.

In fact, I was talking about FOSCAM FI8910W (http://www.foscam.com/)

I didn't have cron in mind, maybe because I never used this tool.
Anyway, it seems to be a good idea, I'll look closer at it. But I suppose I
should have two successive tasks : one which uses ping or such a tool to
ensure all ipcams are still connected, and the other which monitors results
and launches a program which rings the alarm in case of problem.
I'll keep having a reflexion about that.

Thanks again