[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
custom scripts
- To: "hobbit (at) hswn.dk" <hobbit (at) hswn.dk>
- Subject: custom scripts
- From: Payam Jahromi <pjahromi (at) checkpoint.com>
- Date: Mon, 2 Nov 2009 12:40:56 -0800
- Accept-language: en-US
- Acceptlanguage: en-US
- Thread-index: Acpb/Mbi0Yrcqu6JR9GbU7E08abI6w==
- Thread-topic: custom scripts
I am a newbie to Hobbit, and this is probably a simple question to answer. Here is what I'm trying to do:
I have custom scripts I need to incorporate to Hobbit. I saw the page http://hobbitmon.sourceforge.net/docs/hobbit-tips.html#scripts but I still don't completely understand it. If I could get 1 of my scripts set up, then I can probably figure out how to do the rest.
I have 2 types of custom scripts: client and server. Here is an example of each. I just need to know exactly how the script would be set up. Note, I had these running on Nagios before:
1. (server) this is the custom script we ran on our old monitoring (nagios):
#!/bin/sh
WEB_CHECK=`curl http://www.example.com | grep value | wc -l`
if [ $WEB_CHECK -eq 1 ]
then
echo "Result OK"
else
echo "Failed"
exit 2
fi
Question: Need to know how to incorporate this on the hobbit server, and where it would show on the GUI?
2. (client) this is custom script that used "NRPE" on nagios:
- I have a script that runs on 3 clients, let's call it /usr/local/sbin/script.pl
- this script returns an output of a number
- on the hobbit server, I want to be get the result of this script for each client, add them together, then alert based on the number. So here is the script I had on the Nagios server:
#!/bin/sh
# Script to check transactions on ecom-1/2
THRESHOLD=1
SERVER1=`ssh server1 /usr/local/nrpe/script.pl`
SERVER2=`ssh server2 /usr/local/nrpe/script.pl`
SERVER3=`ssh server3 /usr/local/nrpe/script.pl`
TOTAL=`expr $SERVER1 + $SERVER2 + $SERVER3`
if [ $TOTAL -lt $THRESHOLD ] ; then
echo "Number ($TOTAL) Failed"
exit 2
else
echo "Number ($TOTAL) Success"
exit 0
fi
Question: How would I incorporate that in Hobbit?
Thanks!
Payam