1
1
Fork 0

finished v0.1 of ping.sh, added stuff to the readme

This commit is contained in:
David Starzengruber 2010-07-19 01:33:05 +02:00
parent c638cea2d5
commit c6c10c29ff
3 changed files with 35 additions and 11 deletions

View File

@ -1,15 +1,23 @@
this is my little mobot project.
the concept is not to spend hundreds of hours to implement some massive monitoring tool like nagios or something like this. instead i want to use some simple message/notification scripts which exactly tell me what i need to know.
the concept is not to spend hundreds of hours to implement some massive
monitoring tool like nagios or something like this.
instead i want to use some simple message/notification scripts
which exactly tell me what i need to know.
the first thing i have here is the df bot. it sends me a short jabber message when one or more disks on the serving machine reaching a preconfigured threshold (example: 90% disk usage).
the first thing i have here is the df bot. it sends me a short jabber message
when one or more disks on the serving machine reaching a preconfigured threshold
(example: 90% disk usage).
feel free to use or improve this handy tool!
another tool i find really useful is the pingbot (ping.sh)
it works pretty much the same as the dfbot.
feel free to use or improve this handy tools!
=== how to use the df bot (install notes) ===
=== install notes ===
1. copy the df.sh scrip somewhere on the machine
1. copy the scrip somewhere on your machine
you get the df.sh on gitorious.org
http://gitorious.org/sn/scripts/trees/master/mobots/df.sh

View File

@ -1,3 +1,5 @@
#!/bin/bash
###################################################
## ##
## disk_free jabber monitoring bot ##

View File

@ -1,3 +1,5 @@
#!/bin/bash
## ## ## ## ## ## ## ## ##
## ##
## jabber ping bot ##
@ -69,16 +71,28 @@ set -- $dest
for var in "$@"
do
data=$(ping -c 05 $var | grep transmitted | awk '{print $4}')
if [ $data -lt 4 ]; then
echo "alert: $var is unreachable"
echo "alert: $var is unreachable" | sendxmpp -r $res $watchdogs
#result=$(ping -c 05 $var | grep transmitted | awk '{print $4}')
ping -c 03 $var >/dev/null 2>&1
errorcode=$?
if [ $errorcode = "0" ]; then
echo "info: $var is responding"
else
echo "info: $var is reachable"
if [ $errorcode = "1" ]; then
echo "alert: $var is not responding"
## sending jabber message
echo "alert: $var is not responding
ping errorcode: $errorcode" | sendxmpp -r $res $watchdogs
else
if [ $errorcode = "2" ]; then
echo "alert: $var cannot be resolved"
## sending jabber message
echo "alert: $var cannot be resolved
ping errorcode: $errorcode" | sendxmpp -r $res $watchdogs
fi
fi
fi
done
## the end
exit 0