Page 1 of 1

Passing API Key for Plugin

Posted: Tue Jun 30, 2020 8:38 am
by blariv
hi,

trying to pass an API key to work w/ a palo alto monitoring plugin.

I have it working through the command line but once i create the XI command and service with the same key it fails. I've tried hardcoding the key to the command, pass it as an $ARG$ and as a $USER$ variable in the resource.cfg file.

I am not sure why the UI doesn't like the same thing the command line accepts.

Command Line:
check_paloalto -H IPaddress -T TOKEN throughput -i interface
THROUGHPUT OK

UI:
check_paloalto -H $HOSTADDRESS$ -t 300 -T $ARG3$ $ARG1$ -i $ARG2$
THROUGHPUT UNKNOWN - Expected status code: 200 (OK), returned status code was: 403

Re: Passing API Key for Plugin

Posted: Tue Jun 30, 2020 3:13 pm
by benjaminsmith
Hi blariv,

There may be a special character in the API key causing the issue as it does look like the plugin is running otherwise. Is there a $ or ! in the API key? If so try escaping this with a \, see the following guide for more details.

Nagios XI - Special Characters

Additionally, you might try to wrap the API key in single quotes in the arguments field in XI.

If those steps do not correct the issue, please PM the full check command as set in XI or send over your system profile so I can review the configuration. Thanks, Benjamin

Re: Passing API Key for Plugin

Posted: Tue Jun 30, 2020 3:28 pm
by blariv
yes there is an equal sign as the last character in the key.

ive tried the escaping and the single quotes. Pm'ing you w/ the details.

Re: Passing API Key for Plugin

Posted: Wed Jul 01, 2020 11:02 am
by benjaminsmith
Hi @blariv,

Thanks for the check command, other than the = sign at the end, I don't see any other characters that would be an issue here. I did notice that the UI command definition has the arguments out of order.
check_paloalto -H $HOSTADDRESS$ -t 300 -T $ARG3$ $ARG1$ -i $ARG2$
Can you PM a screenshot of the command setup in XI, I just want to make sure that $ARG3$ is the API key and the other values match up. I did some testing on my server here and was able to include an = character in the password without an issue using single quotes around the token, so it should work.
check-arguments.png