notification when a file is found

Morris, Patrick patrick.morris at hp.com
Thu May 13 18:57:54 CEST 2010


akp geek wrote:
> Dear all -
>
>              We are using nagios. I would like to know if there is a 
> way notification can be sent if there is a new file created in a 
> directory? Can you please help?

It's incredibly easy to write a Nagios plugin.  The only major 
requirement is that it return a valid error code so that Nagios can 
interpret the results.  Something like this would work:

-- start check_file.sh --
#!/bin/sh

# $1 = Full path of filename to watch for

$ERRORCODE=0

if [ -e $1 ]; then
   $ERRORCODE=1
fi

exit $ERRORCODE
-- end check_file.sh -- 

------------------------------------------------------------------------------

_______________________________________________
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