Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin args suggested by API UI don't work from the CLI, but alternate approach with -a instead of -q works #1165

Open
jdunitz opened this issue May 16, 2024 · 0 comments
Labels

Comments

@jdunitz
Copy link

jdunitz commented May 16, 2024

This works:
./check_load -w 0.14,0.13,0.12 -c 0.22,0.21,0.20
CRITICAL - load average: 0.56, 0.37, 0.28|load1=0.560;0.140;0.220;0; load5=0.370;0.130;0.210;0; load15=0.280;0.120;0.200;0;

So putting it in the ncpa plugins directory and building a command through the UI should work. The UI suggested this:
./check_ncpa.py -v -H 192.168.1.7 -t 'atoken' -M 'plugins/check_load' -q 'args= -w0.14,0.13,0.12 -c0.22,0.21,0.20'
An error occurred:
need more than 1 value to unpack
(I added the -v, but otherwise it's what the "show as a nagios command" menu item suggested)

I thought maybe it needed to be URL-encoded:
[root@xi7 libexec]# ./check_ncpa.py -v -H 192.168.1.7 -t 'atoken' -M 'plugins/check_load' -q 'args=-w0.14,0.13,0.12%20-c0.22,0.21,0.20'
An error occurred:
need more than 1 value to unpack
[root@xi7 libexec]#

MB suggested after some head-scratching that this works:

[root@xi7 libexec]# ./check_ncpa.py -H 192.168.1.7 -t 'atoken' -M 'plugins/check_load' -a '-w 0.14,0.13,0.12 -c 0.22,0.21,0.20' -v
Connecting to: https://192.168.1.7:5693/api/plugins/check_load/-w/0.14%2C0.13%2C0.12/-c/0.22%2C0.21%2C0.20?token=atoken&check=1
File returned contained:
{"returncode": 0, "stdout": "OK - load average: 0.02, 0.09, 0.12|load1=0.020;0.140;0.220;0; load5=0.090;0.130;0.210;0; load15=0.120;0.120;0.200;0;", "cmd": "/usr/local/ncpa/plugins/check_load -w 0.14,0.13,0.12 -c 0.22,0.21,0.20"}
OK - load average: 0.02, 0.09, 0.12|load1=0.020;0.140;0.220;0; load5=0.090;0.130;0.210;0; load15=0.120;0.120;0.200;0;
[root@xi7 libexec]#

and indeed, when I put that into the ARG1 field, it works in XI.

This seems like unexpected behavior, or perhaps an unclear error message. I also think the UI should suggest things that work as expected.

@ne-bbahn ne-bbahn added the 3.X.X label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants