[Users] convert an check_mk script into a nagios check?

Benjamin Henrion bh at udev.org
Tue Dec 14 10:51:09 EST 2010


Hi,

I want to convert a check_mk local check into a nagios script.

Any hint on how to do that?

I wrote a simple script that checks if an OpenVZ container is up and running:

===========================================================================
root at machine /usr/lib/check_mk_agent/local [538]# cat check_vz-182
#!/bin/bash
SCRIPTNAME=$0
BASENAME=`basename $0`
CTID=`echo $BASENAME | cut -d "-" -f2`
CHECK=`for i in \`vzlist -o ctid -H\`; do echo $i | grep "^${CTID}$" |
awk '{print $1}'; done`
CTNAME=`vzlist -a -o hostname,ctid -H | awk '{print $1 ";" $2}' | grep
"${CTID}$" | cut -d ";" -f1`

if [ "$CHECK" == "$CTID" ] ; then
    status=0
    statustxt=OK
    echo -e "$status $CTID-$CTNAME count=0 $statustxt - Container
$CTID ($CTNAME) is running"
else
    status=2
    statustxt=CRITICAL
    echo -e "$status $CTID-$CTNAME count=0 $statustxt - Container
$CTID ($CTNAME) is not running!!!"
fi
===========================================================================

-- 
Benjamin Henrion <bhenrion at ffii.org>
FFII Brussels - +32-484-566109 - +32-2-4148403
"In July 2005, after several failed attempts to legalise software
patents in Europe, the patent establishment changed its strategy.
Instead of explicitly seeking to sanction the patentability of
software, they are now seeking to create a central European patent
court, which would establish and enforce patentability rules in their
favor, without any possibility of correction by competing courts or
democratically elected legislators."


More information about the Users mailing list