View Full Version : Application layer monitoring?
darrellhyde
08-06-2005, 00:09
Is it possible to have zabbix send an http request to a host it is monitoring, evaluate the output of the request, and then generate an alert condition for that server based on that output?
The goal would be to monitor the availability of an application server like CF, Resin, etc that might crash or become non-operational while the underlying webserver (Apache, IIS, etc) might still be functional.
Thanks!
- Darrell
You can use UserParameters in zabbix_agentd.conf, or an external item script like my own.
http://araw.subverted.net/zabbix/zabbix-1.1alpha10_external_items.diff
if i understood, what you want is :
the zabbix server make the request, get the http response, evaluate something in this response to be sure that the application is running (a key word in the page for example), and if it is not good, send an alert.
if this is what you want, here is what i would make :
install agentd on the server (because the zabbix server can't run your own scripts).
in zabbix_agentd.conf, make a UserParameter that call the script which will get the page and evaluate the response, something like this :
UserParameter=check_appli,/etc/zabbix/name_of_your_script
then add an item to the server, as an agentd item, with the same key : check_appli
then you can make a trigger on this item to send alerts
i had to get the outside temperature from a webpage, it is quite the same thing :
#!/bin/sh
SUCCESS=0
FILE=/etc/zabbix/temp_temper_html.tmp
ERRORLOG=/etc/zabbix/temp_temper_html.error
PSRES=`ps alx | egrep 'wget -t 2 -T 30 -O $FILE http://weather.noaa.gov/weather/current/LFLL.html' | wc -l`
if [ $PSRES -ne 0 ] ; then
echo `date` : script deja en marche >> $ERRORLOG
exit 0
fi
wget -a $ERRORLOG -t 2 -T 30 -O $FILE http://weather.noaa.gov/weather/current/LFLL.html
WGETRET=$?
if [ $WGETRET -ne 0 ] ; then
echo `date` : `whoami` : ERROR wget plante avec $WGETRET >> $ERRORLOG
exit 1
fi
echo `date` : `whoami` : fichier recupere >> $ERRORLOG
RES=`grep "F (" $FILE | head -n 1 | cut -d '(' -f 2 | cut -d ' ' -f 1`
rm $FILE* 2>> $ERRORLOG
test "$RES" -ne 0 -o "$RES" -eq 0
if [ $? -ne "$SUCCESS" ] ; then
echo `date` : `whoami` : ERROR temperature non disponible >> $ERRORLOG
exit 1
else
echo `date` : temperature OK >> $ERRORLOG
echo $RES
exit $SUCCESS
fi
hope it can help you
cadbury
darrellhyde
08-06-2005, 22:33
That's exactly what I'd like to accomplish - thanks! I'll give this a shot and let you know how it goes.
- Darrell
Hi Dareell,
Did this script help you?
Thanks,
Soj
Looks like it'll do it, but we are always open for other ideas :)