plugin to monitor number of files in a directory
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
plugin to monitor number of files in a directory
Hello
I would like to monitor the amount of files in a directory from a Windows server.
Found that at the site of Nagios that there are some plugins that make this function, for example:
directory_file_count
check_winfile-1.5
count_file.pl
check_file_count
Could you help me what I have to configures the Nagios server and Windows server to do this monitoring?
Example:
I need to monitor the directory c: \ temp if you have more than 50 files send an e-mail with a warning, and if you are over 70 files forward an e-mail to critical.
thank you
Romario Faria
I would like to monitor the amount of files in a directory from a Windows server.
Found that at the site of Nagios that there are some plugins that make this function, for example:
directory_file_count
check_winfile-1.5
count_file.pl
check_file_count
Could you help me what I have to configures the Nagios server and Windows server to do this monitoring?
Example:
I need to monitor the directory c: \ temp if you have more than 50 files send an e-mail with a warning, and if you are over 70 files forward an e-mail to critical.
thank you
Romario Faria
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: plugin to monitor number of files in a directory
Hello,
First we will want to configure NSClient++ with windows, have you done this already?
Please take a look at the following documentation for a guide on how to do this:
http://assets.nagios.com/downloads/nagi ... _Agent.pdf
http://www.nsclient.org/nscp/wiki/doc/installation
I would suggest using the most lightweight of the check_file checks as it is a pretty simple check, it all depends on what you would like to do beyond getting the standard count.
First we will want to configure NSClient++ with windows, have you done this already?
Please take a look at the following documentation for a guide on how to do this:
http://assets.nagios.com/downloads/nagi ... _Agent.pdf
http://www.nsclient.org/nscp/wiki/doc/installation
I would suggest using the most lightweight of the check_file checks as it is a pretty simple check, it all depends on what you would like to do beyond getting the standard count.
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: plugin to monitor number of files in a directory
hello,
The client already installed on Windows servers I want to monitor.
Now to use the plugin suggested check_file what I have to do in the Nagios server and Windows?
Not yet installed any plugin in Nagios so I have some doubts that how to configure it to work.
Example:
The plugin on the Nagios server must fiicar in which directory? / usr / local / nagios / libexec this path is correct?
After adding the plugin in any server I edit file information with this new plugin?
And the Windows client is some configuration needed?
thanks
The client already installed on Windows servers I want to monitor.
Now to use the plugin suggested check_file what I have to do in the Nagios server and Windows?
Not yet installed any plugin in Nagios so I have some doubts that how to configure it to work.
Example:
The plugin on the Nagios server must fiicar in which directory? / usr / local / nagios / libexec this path is correct?
After adding the plugin in any server I edit file information with this new plugin?
And the Windows client is some configuration needed?
thanks
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: plugin to monitor number of files in a directory
You will need to add the plugin to the scripts folder within the NSClient++ directory on your windows system, then we must define it in the nsclient/NSC.ini file as an external script, and create an alias for it to be called from the nagios xi server. These steps are outlined below:
In the scripts section of the following documentation an example is outlined for adding the external script's definition to NSClient++'s configuration file:
http://www.nsclient.org/nscp/wiki/doc/c ... ptSections
For version 0.4.x please view this version:
http://www.nsclient.org/nscp/wiki/doc/c ... IPTSECTION
Let us know if you need help in between these steps or afterwords.
In the scripts section of the following documentation an example is outlined for adding the external script's definition to NSClient++'s configuration file:
http://www.nsclient.org/nscp/wiki/doc/c ... ptSections
For version 0.4.x please view this version:
http://www.nsclient.org/nscp/wiki/doc/c ... IPTSECTION
Let us know if you need help in between these steps or afterwords.
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: plugin to monitor number of files in a directory
hello,
Thanks for the information, now I need an aid in relation to check_file.vbs
He is returning this error:
C:\Program Files\NSClient++\scripts\check_files.vbs(132, 1) Microsoft VBScript runtime error: Class not defined: 'NagiosPlugin'
Thanks for the information, now I need an aid in relation to check_file.vbs
He is returning this error:
C:\Program Files\NSClient++\scripts\check_files.vbs(132, 1) Microsoft VBScript runtime error: Class not defined: 'NagiosPlugin'
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: plugin to monitor number of files in a directory
Hello infrati.fornecedores,
Can you provide us with a link to the specific plugin you are using so that we can give it a test run as well?
Can you provide us with a link to the specific plugin you are using so that we can give it a test run as well?
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: plugin to monitor number of files in a directory
Hello,
This is the vbs script to install mode dretorio the Nagios client.
C: \ Program Files \ NSClient + + \ scripts \ check_files.vbs
This is the vbs script to install mode dretorio the Nagios client.
C: \ Program Files \ NSClient + + \ scripts \ check_files.vbs
Re: plugin to monitor number of files in a directory
You should have the following line in the NSC.ini (or nsclient.ini) file on the windows box:
or could be under [/settings/external scripts/wrapped scripts] in the newer versions of nsclient++
Then you can call the "check_files" command from nagios via check_nrpe, for example you can run something like this:
I would recommend opening the check_files.vbs in a text editor, and reading the comments. There are some usage examples in it.
Code: Select all
[Wrapped Scripts]
check_files=check_files.vbs $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$ $ARG10$ $ARG11$ $ARG12$ $ARG13$ $ARG14$Then you can call the "check_files" command from nagios via check_nrpe, for example you can run something like this:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a '/path:"c:\\tmp" /searchdepth:1 /warning:10 /critical:20'
OK: Testing c://tmp newer than 5 d : 0 w:10 c: 20|count=0;10;20Be sure to check out our Knowledgebase for helpful articles and solutions!
-
infrati.fornecedores
- Posts: 17
- Joined: Tue Jan 08, 2013 6:49 pm
Re: plugin to monitor number of files in a directory
hello, lmiltchev.
The settings that are in the comments of the file check_files already done.
When I run this command
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a '/path:"c:\\tmp" /searchdepth:1 /warning:10 /critical:20'
message is presented below:
C:\Program Files\NSClient++\scripts\check_files.vbs(132, 1) Microsoft VBScript runtime error: Class not defined: 'NagiosPlugin'
he says that the class "Nagios Plugin" was not defined, it is possible to send you the file that you used in the test?
thank you
The settings that are in the comments of the file check_files already done.
When I run this command
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_files -a '/path:"c:\\tmp" /searchdepth:1 /warning:10 /critical:20'
message is presented below:
C:\Program Files\NSClient++\scripts\check_files.vbs(132, 1) Microsoft VBScript runtime error: Class not defined: 'NagiosPlugin'
he says that the class "Nagios Plugin" was not defined, it is possible to send you the file that you used in the test?
thank you
Re: plugin to monitor number of files in a directory
Please, post your NSC.ini (or nsclient.ini) file. Remove the sensitive data - IPs, passwords, etc.
Be sure to check out our Knowledgebase for helpful articles and solutions!