Assistance with Check_File_Age plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Assistance with Check_File_Age plugin

Post 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
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: Assistance with Check_File_Age plugin

Post by jbrunkow »

Hey @mbishop4! Welcome to the forum. :D

I'm afraid the plugin should probably be run from the libexec folder on your XI server, unless I misunderstand what you're doing...

Code: Select all

/usr/local/nagios/libexec
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. :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Re: Assistance with Check_File_Age plugin

Post by mbishop4 »

Anyone? Even a pointer to the right documentation would be appreciated.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Assistance with Check_File_Age plugin

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Re: Assistance with Check_File_Age plugin

Post 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!
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Re: Assistance with Check_File_Age plugin

Post by mbishop4 »

lmiltchev wrote: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
Thanks for the information and the link.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Assistance with Check_File_Age plugin

Post by lmiltchev »

You are welcome! Let us know if you have any further questions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Re: Assistance with Check_File_Age plugin

Post by mbishop4 »

lmiltchev wrote: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
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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Assistance with Check_File_Age plugin

Post 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.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mbishop4
Posts: 11
Joined: Tue Jul 14, 2020 10:08 am

Re: Assistance with Check_File_Age plugin

Post by mbishop4 »

This helped tremendously, thanks! I have it all working now.
Locked