Page 1 of 1

error while defining arguments for ncpa in NagiosXI

Posted: Fri Sep 13, 2019 7:00 am
by sajid4u2c
Hi All,

I have installed NCPA agent in linux sever and I am trying to use check_logfile plugin for searching the particular pattern in log file

check_logifle plugin I have copied from : https://labs.consol.de/nagios/check_log ... l#download and placed in the plugin folder of ncpa in Linux server

In the destination server the below command is giving the exact output I am looking for:

Code: Select all

./check_logfiles.sh  --logfile=/tmp/test/test1.txt --criticalpattern='hello world'

Code: Select all

output : no eror found ….etc.,
While configuring in NagiosXI, I have used the below command

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H <host> -P 5693 -t 'token' -M /plugin/check_logfiles.sh  -a " --logfile=/tmp/test/test1.txt --criticalpattern='hello world' "
But it is giving me the error:

Code: Select all

     "returncode": 3,
    "stdout": "Option logfile requires an argument 
Please help in defining the exact command in NagiosXI to call the script and execute .

Below is the entry in ncpa.cfg for .sh files:

Code: Select all

[code][plugin directives]
plugin_path = plugins/
.sh = /bin/sh $plugin_name $plugin_args
[/code]

Re: error while defining arguments for ncpa in NagiosXI

Posted: Fri Sep 13, 2019 3:04 pm
by mbellerue
The first thing that jumps out at me from the Consol Labs page is that it specifically warns about running the plugin as an unprivileged user. When you tested the plugin on the server you want to monitor, did you run the plugin as the nagios user, using su - to switch to the nagios user?

Re: error while defining arguments for ncpa in NagiosXI

Posted: Wed Sep 18, 2019 5:39 am
by sajid4u2c
Thanks. Those file permissions were checked and all were normal with Nagios user configured.

Seems problem was in passing the arguments.

The below command is now working and I am able to run . Thanks. Thread can be closed.


-t 'mytoken' -P 5693 -M 'plugins/check_logfiles.sh' -a " --logfile='/tmp/test.log' --criticalpattern="annotation event""

Re: error while defining arguments for ncpa in NagiosXI

Posted: Wed Sep 18, 2019 6:25 am
by scottwilkerson
sajid4u2c wrote:Thanks. Those file permissions were checked and all were normal with Nagios user configured.

Seems problem was in passing the arguments.

The below command is now working and I am able to run . Thanks. Thread can be closed.


-t 'mytoken' -P 5693 -M 'plugins/check_logfiles.sh' -a " --logfile='/tmp/test.log' --criticalpattern="annotation event""
Great!

Locking