NRPE Check File count
Posted: Tue Jun 16, 2015 12:53 pm
I am migrating some other checks from Nagios Core where I was using a check_wsc_filecount to alert if a file was present in a specific directory. I found a couple of examples but it isn't working. This directory should always be empty and if a file exists we need to be alerted. Here was my check from the Nagios Core:
# checks filecount - filename+path ! warn (-1 = < 1) ! critical (-1 = < 1)
define command {
command_name check_wsc_filecount
command_line $USER1$/check_wsc.pl -H $HOSTADDRESS$ -r <wmi_proxy_server> -t "filecount" -p "$ARG1$,$ARG2$,$ARG3$"
}
./check_wsc.pl -H <host> p -r <wmi_proxy_server> -t "filecount" -p D:\\ClassPathFiles\\webservices\\EAppSubmissionServices\\FileNotifications\\*.TXT,0,0
Result: OK; 0 files found|nbfiles=0;0;0;;
Here is what I am trying with Nagios XI:
check_nrpe -H <host> -t 30 -c CheckFiles -a path='D:\\ClassPathFiles\\webservices\\EAppSubmissinoServices\\FileNotificaitons\\*.TXT' pattern=*.TXT 'master-syntax={%total% Files Found}' MaxWarn=0 MaxCrit=0
No drives found|'count'=0;0;0
Not sure why I am getting No drives found.
./check_nrpe -H <host> -t 30 -c CheckDriveSize -a ShowAll
OK A:\: Total: 0B - Used: 0B (100%) - Free: 0B (0%), C:\: Total: 49.899GB - Used: 26.734GB (54%) - Free: 23.166GB (46%), D:\: Total: 124.997GB - Used: 86.868GB (70%) - Free: 38.129GB (30%), E:\: Total: 0B - Used: 0B (100%) - Free: 0B (0%), : Total: 99.996MB - Used: 30.789MB (31%) - Free: 69.207MB (69%)|'A:\ used'=0B;0;0;0;0 'C:\ used'=26.73367GB;39.91952;44.90946;0;49.89941 'C:\ used %'=53%;79;89;0;100 'D:\ used'=86.8682GB;99.99765;112.49736;0;124.99706 'D:\ used %'=69%;79;89;0;100 'E:\ used'=0B;0;0;0;0 '\\?\Volume{248ea391-cced-11e1-a507-806e6f6e6963}\ used'=30.78906MB;79.99687;89.99648;0;99.99609 '\\?\Volume{248ea391-cced-11e1-a507-806e6f6e6963}\ used %'=30%;79;89;0;100
I basically just need to check a directory and alert if a file is present. Is the NRPE client the best way to accomplish this with Nagios XI?
# checks filecount - filename+path ! warn (-1 = < 1) ! critical (-1 = < 1)
define command {
command_name check_wsc_filecount
command_line $USER1$/check_wsc.pl -H $HOSTADDRESS$ -r <wmi_proxy_server> -t "filecount" -p "$ARG1$,$ARG2$,$ARG3$"
}
./check_wsc.pl -H <host> p -r <wmi_proxy_server> -t "filecount" -p D:\\ClassPathFiles\\webservices\\EAppSubmissionServices\\FileNotifications\\*.TXT,0,0
Result: OK; 0 files found|nbfiles=0;0;0;;
Here is what I am trying with Nagios XI:
check_nrpe -H <host> -t 30 -c CheckFiles -a path='D:\\ClassPathFiles\\webservices\\EAppSubmissinoServices\\FileNotificaitons\\*.TXT' pattern=*.TXT 'master-syntax={%total% Files Found}' MaxWarn=0 MaxCrit=0
No drives found|'count'=0;0;0
Not sure why I am getting No drives found.
./check_nrpe -H <host> -t 30 -c CheckDriveSize -a ShowAll
OK A:\: Total: 0B - Used: 0B (100%) - Free: 0B (0%), C:\: Total: 49.899GB - Used: 26.734GB (54%) - Free: 23.166GB (46%), D:\: Total: 124.997GB - Used: 86.868GB (70%) - Free: 38.129GB (30%), E:\: Total: 0B - Used: 0B (100%) - Free: 0B (0%), : Total: 99.996MB - Used: 30.789MB (31%) - Free: 69.207MB (69%)|'A:\ used'=0B;0;0;0;0 'C:\ used'=26.73367GB;39.91952;44.90946;0;49.89941 'C:\ used %'=53%;79;89;0;100 'D:\ used'=86.8682GB;99.99765;112.49736;0;124.99706 'D:\ used %'=69%;79;89;0;100 'E:\ used'=0B;0;0;0;0 '\\?\Volume{248ea391-cced-11e1-a507-806e6f6e6963}\ used'=30.78906MB;79.99687;89.99648;0;99.99609 '\\?\Volume{248ea391-cced-11e1-a507-806e6f6e6963}\ used %'=30%;79;89;0;100
I basically just need to check a directory and alert if a file is present. Is the NRPE client the best way to accomplish this with Nagios XI?