Plugin help
Lunt, Nick
Nick.Lunt at wesleyan.co.uk
Thu Jun 23 09:48:49 CEST 2005
Hello list,
first off I know there's a seperate list for plugins but I think this question should be OK for this list :)
I have created a bash script that checks if Oracle is running on server x, I cannot used the supplied check_oracle plugin because I do not have Oracle installed on the Nagios machine.
My problem is that even if I deliberately make the script fail it will still show as OK in Nagios. And the status information shows 'no output returned from plugin'.
If the script fails I have it exiting with status code 2, and it exits with a 0 if the script works.
The script is below if that will help. Could someone please tell me how to get user created plugins to give the correct info back to nagios ? I cannot find this in the nagios docs, nor on google. If someone knows where this info is then a link would be appreciated. Or just tell me to RTFM - but please supply a specific M :)
Many thanks
Nick.
// The script:
#!/bin/bash
USERNAME=someuser
PASSWORD=password
HOSTNAME=bishop1
PORT=1552
DB=TEC
RES=0
SQL=/usr/local/instantclient/sqlplus
SQLOUT=/tmp/instantoracle.${DB}.out
SQLFILE=/tmp/instantoracle.${DB}.sql
SQLCOMMAND="select count(*) from tec_t_evt_rep;"
cat > $SQLFILE << EOF
spool $SQLOUT;
$SQLCOMMAND
exit;
EOF
cat $SQLFILE | $SQL ${USERNAME}/${PASSWORD}@//${HOSTNAME}:${PORT}/${DB}
RES=$?
if [ $RES -ne 0 ]; then
EPOCHTIME=`python -c "import time; print str(time.time()).split('.')[0]"`
echo "CRITICAL - $EPOCHTIME $HOSTNAME.$DB Down"
RES=2
else
EPOCHTIME=`python -c "import time; print str(time.time()).split('.')[0]"`
echo "OK - $EPOCHTIME from $HOSTNAME.$DB"
RES=0
fi
exit $RES
// End of script
Wesleyan Administration Services Ltd registered number 5188850 and Wesleyan Unit Trust Managers Ltd registered number 2114859 ("WUTM Ltd")
are wholly owned subsidiary companies of Wesleyan Assurance Society, whose registered number is ZC145.
WUTM Ltd is a member of IMA. For ISA/PEP/Unit Trusts Administration Centre: PO Box Basildon SS15 5WQ Telephone: 0870 601 6129
Wesleyan Assurance Society and WUTM Ltd are authorised and regulated by the Financial Services Authority.
Head Office, Colmore Circus, Birmingham B4 6AR. Telephone: 0121 200 3003 Fax 0121 200 2971.
Website: www.wesleyan.co.uk Telephone calls may be recorded for monitoring and training purposes.
CONFIDENTIALITY NOTICE
This communication and the information it contains is intended for the person or organisation to whom it is addressed. Its contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you are not the intended recipient, please contact us immediately.
The contents of any attachments in this e-mail may contain software viruses, which could damage your own computer system. While every reasonable precaution to minimise this risk has been taken, we cannot accept liability for any damage that you sustain as a result of software viruses. You should carry out your own virus checking procedure before opening any attachment.
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
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