check if windows folder exist
check if windows folder exist
Hello All:
I'm having a request to check if a specific Windows Folder has been modified. However i think is easier to check if the folder exist. If the Folder name has been modified, then it should alert as folder missing, which from our end is the same.
is there a way to get it done?
thanks!
I'm having a request to check if a specific Windows Folder has been modified. However i think is easier to check if the folder exist. If the Folder name has been modified, then it should alert as folder missing, which from our end is the same.
is there a way to get it done?
thanks!
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check if windows folder exist
You can do this with NSClient and the NRPE module for it
Here is an example
https://support.nagios.com/kb/article/f ... der_exists
Here is an example
https://support.nagios.com/kb/article/f ... der_exists
Re: check if windows folder exist
scottwilkerson wrote:You can do this with NSClient and the NRPE module for it
Here is an example
https://support.nagios.com/kb/article/f ... der_exists
great i can see the plugin.
Code: Select all
Nagios Plugins
Nagios Plugins comes with the check_file_age plugin, this will return a critical state if the file does not exist.
Command:
./check_file_age -f /var/log/cron
Output:
FILE_AGE OK: /var/log/cron is 163 seconds old and 18974 bytes | age=163s;240;600 size=18974B;0;0;0-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check if windows folder exist
In the link I gave you , the command you want to look at is in the NSClient++ via check_nrpe section
Code: Select all
./check_nrpe -H 10.25.11.3 -c check_files -a path='C:\\your_folder_' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-allRe: check if windows folder exist
i have tried that as wellscottwilkerson wrote:In the link I gave you , the command you want to look at is in the NSClient++ via check_nrpe sectionCode: Select all
./check_nrpe -H 10.25.11.3 -c check_files -a path='C:\\your_folder_' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-all
Code: Select all
[root@nagios libexec]# ./check_nrpe -H SERVERIP -c check_files -a path=’C:\\Temp’ ’warn= count < 1’ ’crit= count < 1’ top-syntax=’${status}: ${count} files found ${problem_list}’ ’empty-state=critical’ show-all
-bash: 1’: No such file or directory
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check if windows folder exist
Sorry that article has backticks instead of apostrophe
run this
I will be editing the article to correct the issue
run this
Code: Select all
./check_nrpe -H SERVERIP -c check_files -a path='C:\\Temp' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-allRe: check if windows folder exist
Thanks, but it seems that does not like itscottwilkerson wrote:Sorry that article has backticks instead of apostrophe
run thisI will be editing the article to correct the issueCode: Select all
./check_nrpe -H SERVERIP -c check_files -a path='C:\\Temp' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-all
Code: Select all
[root@nagios libexec]# ./check_nrpe -H SERVERIP -c check_files -a path='C:\\Temp' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-all -n
CHECK_NRPE: Invalid packet type received from server.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check if windows folder exist
can you share your nsclient ini file?
also what version are you using?
also what version are you using?
Re: check if windows folder exist
here is the versionscottwilkerson wrote:can you share your nsclient ini file?
also what version are you using?
Code: Select all
[root@nagios libexec]# /usr/local/nagios/bin/nrpe -V
NRPE - Nagios Remote Plugin Executor
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
***************************************************************
** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **
** Read the NRPE SECURITY file for more information **
***************************************************************
***************************************************************
** POSSIBLE SECURITY RISK - TCP WRAPPERS ARE NOT AVAILABLE! **
** Read the NRPE SECURITY file for more information **
***************************************************************
Usage: nrpe [-n] -c <config_file> [-4|-6] <mode>
Options:
-n = Do not use SSL
<config_file> = Name of config file to use
-4 = use ipv4 only
-6 = use ipv6 only
<mode> = One of the following operating modes:
-i = Run as a service under inetd or xinetd
-d = Run as a standalone daemon
-d -s = Run as a subsystem under AIX
Notes:
This program is designed to process requests from the check_nrpe
plugin on the host(s) running Nagios. It can run as a service
under inetd or xinetd (read the docs for info on this), or as a
standalone daemon. Once a request is received from an authorized
host, NRPE will execute the command/plugin (as defined in the
config file) and return the plugin output and return code to the
check_nrpe plugin.
You do not have the required permissions to view the files attached to this post.
Re: check if windows folder exist
Modify the following lines in the nsclient.ini so that they look like this:
and restart tne nsclient++ service.
Test your check by running:
Let us know if this helped.
Code: Select all
insecure = true
extended response = 0Test your check by running:
Code: Select all
./check_nrpe -H SERVERIP -n -c check_files -a path='C:\\Temp' 'warn= count < 1' 'crit= count < 1' top-syntax='${status}: ${count} files found ${problem_list}' 'empty-state=critical' show-allBe sure to check out our Knowledgebase for helpful articles and solutions!