Page 1 of 2
Assistance with Check_File_Age plugin
Posted: Tue Jul 28, 2020 8:55 am
by mbishop4
Hello,
I'm new to Nagios and am trying to set up the Check_File_Age plugin to monitor directories on a Windows Server. Here's what I've done so far for testing:
1. Verified that Linux is at 6.10 Centos release (Final)
2. Installed NCPA on the host that I want to monitor
3. Copied the Check_File_Age plugin to the Windows server directory C:\Program Files (x86)\Nagios\NCPA\plugins
4. Ensured that the service is Check_File_Age active
5. Defined the monitoring command as:
check_xi_ncpa!-t '<redacted>' -P 5693 -M 'plugins/check_file_age' -H <redacted> -w 10 -c 20 -f 'c:\\test.txt'
When I run the command it comes back with:
Critical
(No output on stdout) stderr: Usage: check_ncpa.py [options]
check_ncpa.py: error: no such option: -f
Thanks in advance for any assistance.
Mike
Re: Assistance with Check_File_Age plugin
Posted: Tue Jul 28, 2020 4:14 pm
by jbrunkow
Hey
@mbishop4! Welcome to the forum.
I'm afraid the plugin should probably be run from the libexec folder on your
XI server, unless I misunderstand what you're doing...
You may want to have a look at the following document for more information on configuring and testing plugins in
XI.
PLUGINS IN NAGIOS XI
Feel free to link me the document you are following if you feel that I'm lacking context here.

Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 8:14 am
by mbishop4
Anyone? Even a pointer to the right documentation would be appreciated.
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 9:19 am
by lmiltchev
The check_file_age plugin is supposed to be run on Linux. It's not going to work on Windows. I would recommend that you try a different plugin, e.g. Powershell Script. I found this one on the Nagios Exchange:
https://exchange.nagios.org/directory/P ... ry/details
Once you make sure the plugin works "locally", you could call it from the Nagios XI server via NCPA.
https://www.nagios.org/ncpa/help.php#ap ... es-plugins
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 1:53 pm
by mbishop4
jbrunkow wrote:Hey
@mbishop4
You may want to have a look at the following document for more information on configuring and testing plugins in
XI.
PLUGINS IN NAGIOS XI
Thanks for the link!
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 1:54 pm
by mbishop4
Thanks for the information and the link.
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 3:01 pm
by lmiltchev
You are welcome! Let us know if you have any further questions.
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 4:04 pm
by mbishop4
I have this working from a terminal session on the Windows machine. The directions for it say:
1. Copy the plugin in scripts directory of your nsclient folder
2. modify the Path & age in the plugin
3. add the command alias under "/settings/external scripts/wrapped scripts"
1 and 2 were no problem. Can you tell me where or what file I'd edit for step 3?
Re: Assistance with Check_File_Age plugin
Posted: Wed Jul 29, 2020 4:48 pm
by lmiltchev
The directions, listed on the Nagios Exchange are for NSClient++. My understanding was that you were trying to call the plugin via NCPA. You can use either agent but we recommend using NCPA. So, here's what you need to do:
1. Copy the plugin in the "C:\Program Files (x86)\Nagios\NCPA\plugins" directory on the Windows machine, running NCPA.
2. Open the plugin in a text editor, e.g. Notepad++, and modify the path, and number of days, hours, and minutes to match your requirements.
Example:
Code: Select all
$fullPath = "D:\TEMP\"
$numdays = 0
$numhours = 0
$nummins = 45
Save and exit.
3. Test the plugin from the command line by running the command below on the Nagios XI server:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <client ip> -t '<token>' -M 'plugins/check_fileage.ps1' -q ''
Substitute the <client ip> and <token> with the actual IP address of the Windows machine and your NCPA token.
Example:
Code: Select all
[root@main-nagios-xi ~]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'mytoken' -M 'plugins/check_fileage.ps1' -q ''
Old: test.txt
You could also test the command in the GUI, by accessing the NCPA API Endpoint.
example-02.jpg
Let us know if this helped.
Re: Assistance with Check_File_Age plugin
Posted: Thu Jul 30, 2020 11:13 am
by mbishop4
This helped tremendously, thanks! I have it all working now.