custom script

Ludse Verhoeven Ludse.Verhoeven at VOPAK.COM
Thu Nov 18 13:40:10 CET 2004


File/directory-permissions for nagios-user okee?




Martinus Nel <martinus.nel at scarceskills.com> 
Sent by: nagios-users-admin at lists.sourceforge.net
18-11-2004 12:58

To
nagios-users at lists.sourceforge.net
cc

Subject
[Nagios-users] custom script






Dear all,

I created a custom check_log script, but I have a minor problem.

Attached is the script.

 From the machine that the script resides, all is ok.

NRPE config:
command[check_log_test]=/usr/local/nagios/check_logs rel1.repost.Aug2604

Output from machine running NRPE:

# /usr/local/nagios/check_logs rel1.repost.Aug2604
*** Repost of all pending candidates started at 10:00:01 PM *** : *** 
Repost finished at 10:27:49 PM ***
#

Good.

Output from machine running Nagios:

# /usr/lib/nagios/plugins/check_nrpe -H xxx.xxx.xxx.xxx -p 5666 -c 
check_log_test
File does not exist.

Not good.

The standard checks work all good, so I know there is nothing wrong with 
nagios / NRPE.

I had a look at the stock check_log, but could not find any help there.
Any help appreciated.

-- 
Martinus Nel
System Administrator
Scarce Skills Ltd.
http://www.scarceskills.com
Tel: +44 (0) 1633 225461

---------------------------------------------------------------------------
DISCLAIMER
This e-mail message and any attachments are confidential and may also be a
privileged communication. It is intended solely for the person(s) to whom 
it
is addressed. If you are not the intended addressee of the message you 
must
take no action based on it. Please reply to this message to let us know 
you
received it in error and also delete the message from your system.
Internet e-mails are not necessarily secure and you should be mindful of
this when e-mailing us.

The contents of an attachment to this e-mail may contain software viruses
which could damage your own computer system. Whilst we have taken every
reasonable precaution to minimise this risk, we cannot accept liability 
for
any damage which you sustain as a result of software viruses. You should
carry out your own virus checks before opening the attachment.
---------------------------------------------------------------------------

#!/bin/sh

# Custom script for Nagios to monitor rel1 log files

# Data that we want to extract from the logs:
#                start and end time
#                any errors

# Define possible exit status.
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3

# Make sure we get the right input.
if [ $# -ne 1 ]
then
        echo "Usage: $0 log_file_name."
        exit $UNKNOWN
fi

LOG_FILE=/home/admin/logs/$1

# Check if file exists.
if [ ! -f $LOG_FILE ]
then
                 echo "File does not exist."
                 exit $CRITICAL
fi

# Get start and end time of log.
START_TIME=`grep "started at" $LOG_FILE`
END_TIME=`grep "finished at" $LOG_FILE`

if [ "$START_TIME" = "" ] || [ "$END_TIME" = "" ]
then
                 echo "No start or end time."
                 exit $CRITICAL
fi

# Find errors.
ERROR=`grep --ignore-case -e "ERROR" -e "Exception" $LOG_FILE`
if [ "$ERROR" != "" ]
then
                 echo "Error found: $ERROR"
                 exit $CRITICAL
fi

# All is OK & send start & end time.
echo "$START_TIME : $END_TIME"
exit $OK


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20041118/c23be440/attachment.html>


More information about the Users mailing list