How to use .pl perl script in Nagios


I have Nagios up and running, finally. I have NRPE running on a 2nd machine that I want to monitor. I can monitor diskspace, http, etc. with the default plugins just fine.

BUT, now I have a .PL script check_latestfile from: … file/visit

I can get the .pl script to work from the command line on the machine being monitored.

HOW do I get nagios server to execute the script and return results?

thanks again :slight_smile:

Seeking best practice advice for switch monitoring

I am assuming you want the plugin to execute on the remote machine. You need to read the documentation surrounding NRPE. NRPE needs to be configured so that the source can make a call to that plugin and return the results.

The check_nrpe will need to be in your commands.cfg (or whatever)

define command{

On the remote side you need a cfg file, or in the nrpe.cfg to define a relationship between the incoming nrpe request on the perl plugin you want to execute for example

command[check_bla] = /usr/local/nagios/libexec/

Then just go back to your server and test it with a direct nrpe request to validate

./check_nrpe -H -p -c check_bla

If that doesn’t work keep working on nrpe until it does. Then once it works just get your nagios conf files setup as needed (see the thousands of related documents)

In short RTFM