Hi, Tks for the feedback.
After tracing the script and check the Array output, I got the way it is evaluated:
# php /usr/local/nagios/libexec/check_json.php -u '<URL>/api/v2/health' -k 0.nodes.0.services.status -s normal -r 0 -n 2
OK - Value 'normal' matched 'normal'
Search found 4 matches
- Fri Sep 25, 2020 12:32 am
- Forum: Nagios XI
- Topic: How to get JSON output using API Key.
- Replies: 6
- Views: 247
- Wed Sep 23, 2020 11:42 pm
- Forum: Nagios XI
- Topic: How to get JSON output using API Key.
- Replies: 6
- Views: 247
Re: How to get JSON output using API Key.
I ran the command using the syntax and it doesn't work. So, I used the syntax below: php /usr/local/nagios/libexec/check_json.php -u 'https://<$KEYID>:<$SECRET>@<$URL>:<$PORT>/api/v2/health' -k 'status' -s 'normal' -r 0 -n 2 PHP Notice: Array to string conversion in /usr/local/nagios/libexec/check_j...
- Wed Sep 23, 2020 8:28 pm
- Forum: Nagios XI
- Topic: How to get JSON output using API Key.
- Replies: 6
- Views: 247
Re: How to get JSON output using API Key.
Hi cdienger, Thanks for your reply. I got to run the command using the syntax below: php /usr/local/nagios/libexec/check_json.php -u 'https://<KEYID>:<SECRET>@<URL>' -k "status" -s 'normal' -r 0 -n 2 However, it brings me the output below: PHP Notice: Array to string conversion in /usr/loc...
- Wed Sep 23, 2020 1:55 am
- Forum: Nagios XI
- Topic: How to get JSON output using API Key.
- Replies: 6
- Views: 247
How to get JSON output using API Key.
Hi, There. I am trying to get some JSON output and check the status of the services we have. However, this API requires an authentication method which we are using API Keys. I've tried check_json script, but it doesn't show an option to provide the keyid:secret. Is any way to accomplish that? Thanks.