check_ncpa not passing arguments?
check_ncpa not passing arguments?
Hello - I'm using NCPA 1.8.1 and trying to get a plugin (check_drbd) working. I need to pass it an argument but it doesn't seem to get through. I know it's finding the plugin because of the output:
xi-server$ ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd -a "-d All"
DRBD UNKNOWN: Could not find device 0
When I run the plugin locally with the "-d All" argument I get the DRBD OK I'm looking for. Is my check_ncpa.py syntax right? I'm following this: https://assets.nagios.com/downloads/ncp ... un-by-ncpa
xi-server$ ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd -a "-d All"
DRBD UNKNOWN: Could not find device 0
When I run the plugin locally with the "-d All" argument I get the DRBD OK I'm looking for. Is my check_ncpa.py syntax right? I'm following this: https://assets.nagios.com/downloads/ncp ... un-by-ncpa
Re: check_ncpa not passing arguments?
Looks right, please run the command from the command line and post the entire output (we do not have DRBD configured here):
Does it differ?
Thank you
Code: Select all
./check_drbd -d allThank you
Re: check_ncpa not passing arguments?
Yes, it works running it locally on the host:
The "DRBD UNKNOWN: Could not find device 0" is what you get if you run it without arguments (it defaults to looking for device 0, which doesn't exist in my case).
Code: Select all
# ./check_drbd -d all
DRBD OK: Dev 1 ConUpT, Dev 3 ConUpT, Dev 6 ConUpT
Re: check_ncpa not passing arguments?
Please edit the check_drbd plugin and change this (around line 265):
To this:
Then run it through NCPA again and post the output.
Code: Select all
&myexit('UNKNOWN',"Could not find device $device");Code: Select all
&myexit('UNKNOWN',"Could not find device $device - $drbd_devices");Re: check_ncpa not passing arguments?
Okay, I've done that. The output is always the same, no matter what arguments I pass:
I could just change the check_drbd script to make the default device "All" and then it works. But it would be nice to get the check_ncpa.py -a working.
Code: Select all
# ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd -a '-d all'
DRBD UNKNOWN: Could not find device 0 - 0
# ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd -a '-d All'
DRBD UNKNOWN: Could not find device 0 - 0
# ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd -a '--help'
DRBD UNKNOWN: Could not find device 0 - 0
Re: check_ncpa not passing arguments?
Please PM me your /usr/local/nagios/etc/ncpa.cfg file.
That's very strange, arguments don't seem to be working for you, I get different output.
Also, please run this on the client and then run the check again:
Then send the output of this command on the client:
Thank you
That's very strange, arguments don't seem to be working for you, I get different output.
Also, please run this on the client and then run the check again:
Code: Select all
service ncpa_listener restartCode: Select all
tail -n100 /usr/local/ncpa/var/ncpa_listener.logRe: check_ncpa not passing arguments?
Okay, I'm finally getting back around to this. After some experimentation I found that the first syntax below fails, but the second one works:
Here are the corresponding snippets from the ncpa_listener log:
I'll PM you that ncpa.cfg, I think the only things I changed was setting debug loglevel and the community_string.
Code: Select all
# ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd --arguments='-d All'
DRBD UNKNOWN: Could not find device 0 - 0
# ./check_ncpa.py -H myhost -t mytoken -M agent/plugin/check_drbd/-d/All/
DRBD OK: Dev 1 ConUpT, Dev 3 ConUpT, Dev 6 ConUpT
Code: Select all
2016-06-06 12:51:53,645 130613 DEBUG Initializing WebSocket
2016-06-06 12:51:53,646 130613 DEBUG Validating WebSocket request
2016-06-06 12:51:53,648 130613 DEBUG Running process with command line: `plugins/check_drbd`
2016-06-06 12:51:53,677 130613 INFO 169.10.69.96 - - [2016-06-06 12:51:53] "GET /api/agent/plugin/check_drbd?token=mytoken&check=1&arguments=-d+All HTTP/1.0" 200 314 0.031747
2016-06-06 12:51:54,443 130613 DEBUG Initializing WebSocket
2016-06-06 12:51:54,443 130613 DEBUG Validating WebSocket request
2016-06-06 12:51:54,444 130613 DEBUG Running process with command line: `plugins/check_drbd -d All`
2016-06-06 12:51:54,475 130613 INFO 169.10.69.96 - - [2016-06-06 12:51:54] "GET /api/agent/plugin/check_drbd/-d/All/?token=mytoken&check=1 HTTP/1.0" 200 322 0.031773
Re: check_ncpa not passing arguments?
Can you run the following commands and show the output?
On the Nagios XI server:
On the remote box:
BTW, I was not able to recreate the issue. Passing arguments (with "-a") seems to be working for me.
...another plugin
On the Nagios XI server:
Code: Select all
./check_ncpa.py -H myhost -t mytoken -P 5693 -M agent/plugin/check_drbd -a '-d All' -v
./check_ncpa.py -H myhost -t mytoken -P 5693 -M agent/plugin/check_drbd -a '--help' -v
Code: Select all
grep plugin_path /usr/local/ncpa/etc/ncpa.cfg
updatedb
locate check_drdbCode: Select all
[root@localhost libexec]# ./check_ncpa.py -H x.x.x.x -t mytoken -P 5693 -M agent/plugin/check_drdb -a '--help'
check_drdb 0.5.3
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Usage: check_drdb [-d <All|Configured|...>] [-e expect] [-p proc] [-r role] [-o states] [-w states] [-c states] [--debug]
Options:
-d STRING [default: 0. Example: 0,1,2 ]
-p STRING [default: /proc/drbd. Use '-' for stdin]
-e STRING [Must be this connected state. Example: Connected]
-r STRING [Must be this node state. Example: Primary]
-o STRING [Change value to OK. Example: StandAlone]
-w STRING [Change value to WARNING. Example: SyncingAll]
-c STRING [Change value to CRITICAL. Example: Inconsistent,WFConnection]
Send email to [email protected] if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to [email protected]Code: Select all
[root@localhost libexec]# ./check_ncpa.py -H x.x.x.x -t mytoken -P 5693 -M agent/plugin/custom_check_mem -a '-w 20 -c 10 -n'
OK - 1018 / 3962 MB (25%) Free Memory, Used: 3237 MB, Shared: 0 MB, Buffers: 158 MB, Cached: 293 MB | total=3962MB free=1018MB used=3237MB shared=0 buffers=158MB cached=293MBBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_ncpa not passing arguments?
So, I was using an old check_ncpa.py on the XI server. I think it came with the XI install? In any case, I got the latest check_ncpa.py from GitHub and now everything works fine.
Re: check_ncpa not passing arguments?
Great! I am closing this thread, and marking it as "resolved". If you have any more questions, please start a new thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!