monitor windows service with "$"
Spook ZA
spookza at gmail.com
Wed Oct 7 16:47:13 CEST 2009
On Wed, Oct 7, 2009 at 10:03 AM, DE/HAM Hoppe, Leif
<Leif.Hoppe at hartrodt.com> wrote:
>>
>> Hi List,
>>
>> I currently configure the monitoring of some windows services.
>> Just one service is having some problems.
>>
>> I looked in the registry for the "real" name of the service. It's like "service$DB"
>> When I now try to check this service, I get the following:
>>
>> nagios at nagios:~> /usr/local/nagios/libexec/check_nt -H 10.2.30.190 -p 12489 -v SERVICESTATE -l "service$DB"
>> service: Not found
>>
I did an dirty hack / wrapper to get round this problem.
I called it: /usr/lib64/nagios/plugins/msauxdb.sh and used it to check
things like MSSQL$BKUPEXEC
Nagios uses $ to interpret arguments to commands. So I only pass
BKUPEXEC in and let the wrapper add the MSSQL$
Remember to replace lib64 with lib if you are using a 32bit operating
system or replace it the entire path with the path where your nagios
plugins are installed.
#!/bin/bash
pushd /usr/lib64/nagios/plugins >/dev/null
if [ $# -lt 2 ]; then
echo Invalid Parameters - use $0 HOSTADDRESS database [... database]
exit 2
fi
PARAMS=''
DATABASES=`echo $* |cut -f2- -d\ `
for DATABASE in $DATABASES; do
PARAMS="$PARAMS,MSSQL\$$DATABASE"
done
PARAMS=`echo $PARAMS |sed -e s/^\,//`
OUTPUT=`./check_nt -H $1 -p 12489 -s l3tm3ch3ck -v SERVICESTATE -l $PARAMS`
RETVAL=$?
popd >/dev/null
echo $OUTPUT
exit $RETVAL
If anyone has a better idea I would be interested to know, but as for
now, this works for me.
Regards,
Andrew.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list