Trying to setup plugin check_numoffiles.sh
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
The final nail ended up being a permission issue with the plugin. I did a chmod 755 on check_numoffiles.sh and restarted the nagios. It seems to be now reporting correctly.
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
Well, I was able to solve the error regarding the (Return code 13 being out of bounds).
This was a permission issue on the plugin it self.
The service is showing green and reporting 0 files.
I dropped three files in the folder, which should have generated a warning.
The service is still green and reporting 0 files. Not sure what I am missing.
I restarted the nagios processes and did a re-check of the service, but still showing the same.
This was a permission issue on the plugin it self.
The service is showing green and reporting 0 files.
I dropped three files in the folder, which should have generated a warning.
The service is still green and reporting 0 files. Not sure what I am missing.
I restarted the nagios processes and did a re-check of the service, but still showing the same.
Re: Trying to setup plugin check_numoffiles.sh
Code: Select all
check_command check_numoffiles.sh!C:\DoceServe\Active\!2!4
See what @mcapra mentioned above -
Also, if your intention is to use this plugin to check the number of files on a remote machine, you would need to put that script on the remote machine and execute it via check_nt, check_nrpe, or check_by_ssh.
Former Nagios Employee
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
The intention is to use the plugin to check the number of files in folder specified in my code above. This is a folder on a remote windows machine.
The remote machine (host) is running the NSClient++ agent on the remote windows host.
I saw some examples of how to use the nsclient cfg file to basically call the script from the agent somehow. It was very unclear.
So, I am trying to figure out what I need to do on the host side with the script itself (check_numoffiles.sh) and/or the ncclient cfg file.
Then I guess I would need to do something different with the service command for the object cfg file.
The remote machine (host) is running the NSClient++ agent on the remote windows host.
I saw some examples of how to use the nsclient cfg file to basically call the script from the agent somehow. It was very unclear.
So, I am trying to figure out what I need to do on the host side with the script itself (check_numoffiles.sh) and/or the ncclient cfg file.
Then I guess I would need to do something different with the service command for the object cfg file.
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
How do I check the number of files in a folder using check_nt?
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Trying to setup plugin check_numoffiles.sh
There's no need to create any special scripts, NSClient++ has this functionality built in using check_nrpe (can't be done with check_nt).joshtate2001 wrote:The intention is to use the plugin to check the number of files in folder
Example
Check the amount of files in a folder (and sub-folders). Generate a warning if more that 500 files exist, critical if more than 1000 files exist.
Command:
Code: Select all
check_nrpe -H 192.168.142.1 -t 30 -c CheckFiles -a path='C:\\NO BACKUP' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
Output:
{12347 Files Found}, found files: 12347 > critical|'found files'=12347;500;1000
http://sites.box293.com/nagios/guides/c ... es-folders
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
Thanks for your help! I have done this code for my service, but I am getting a error on verifying the config in nagios.
Service Code:
I do not specify hostname or port because that is dfned in the Command Difinition:
Service Code:
Code: Select all
define service{
use doceserve-services
host_name doc-e-serve
service_description Fileage Verification of C:\Doceserve\Active
check_command check_nrpe -c CheckFiles -a path='C:\\WJTNagiosTest' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
}
Code: Select all
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
So, based on my code in my command definition:
I changed my service code to this:
The config passes verification in Nagios. However, I am now getting this error in nagios UI.
Code: Select all
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}
Code: Select all
define service{
use doceserve-services
host_name doc-e-serve
service_description Fileage Verification of C:\Doceserve\Active
check_command check_nrpe!CheckFiles!-a path='C:\\WJTNagiosTest' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
}
Exception processing request: Request command contained illegal metachars!
Re: Trying to setup plugin check_numoffiles.sh
There's a specific setting in NSClient to account for this:
From:
http://docs.nsclient.org/faq/#nasty-metacharacters
Code: Select all
[/settings/NRPE/server]
allow nasty characters=true
[/settings/external scripts]
allow nasty characters=true
http://docs.nsclient.org/faq/#nasty-metacharacters
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
- Posts: 29
- Joined: Wed Apr 08, 2015 1:55 pm
Re: Trying to setup plugin check_numoffiles.sh
That got rid of the meta character issue. Now getting.
Command Code:
Service Code:Unknown argument: -a
Code: Select all
define service{
use doceserve-services
host_name doc-e-serve
service_description Fileage Verification of C:\Doceserve\Active
check_command check_nrpe!CheckFiles!-a path='C:\\WJTNagiosTest' pattern=*.* 'master-syntax={%total% Files Found}' MaxWarn=500 MaxCrit=1000
}
Code: Select all
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}