Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

JSON Wizard

Rating
0 votes
Favoured:
0
Current Version
1.1.1
Last Release Date
2019-04-17
Compatible With
  • Nagios XI
Hits
1782
Files:
FileDescription
configwizard-check_json .zipconfigwizard-check_json .zip
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
JSON Wizard
A wizard to create checks that monitor values returned in a web service's JSON response.
1.1.1
------
-string can be regex OR exact match

1.1.0:
-------
- string can take regex(https://www.php.net/manual/en/function.preg-match.php)
- -x option added. Allows one to specify a return_key. Previously and by default it would return the value specified with -k. Now you can check a key (-k [key]) and return a different key (-x [return_key])

php /usr/local/nagios/libexec/check_json.php -u "http://cve.circl.lu/api/last" -k "0.summary" -s /.*microsoft.*/i -r 2 -n 0 -h "" -x 0.id

1.0.5:
-------

A wizard to create checks that monitor values returned in a web service's JSON response.

To run the plugin to evaluate a numeric value:

php /usr/local/nagios/libexec/restful.php -u [url] -k [key] -w [warning threshold] -c [critical threshold] -h [additional optional header]

Strings:

php /usr/local/nagios/libexec/restful.php -u [url] -k [key] -s [string to match] -r [return code to return if string matches key value] -n [return code to return if string value does not match key value] -h [additional optional header]

To illustrate the format of the key, take these examples:

Say we want to make sure Leanne and Kurtis don't stray too far longitudinally. We'd run something like:

php restful.php -w 81:82 -c 80:83 -k 0.address.geo.lng -u https://jsonplaceholder.typicode.com/users

php restful.php -w 81:82 -c 80:83 -k 6.address.geo.lng -u https://jsonplaceholder.typicode.com/users

and say we want to make sure their usernames are not changed:

php restful.php -k 0.username -u https://jsonplaceholder.typicode.com/users -s lgraham -r 0 -n 2

php restful.php -k 6.username -u https://jsonplaceholder.typicode.com/users -s Elwyn.Skiles -r 0 -n 2

I've found Firefox to be pretty useful in helping to identify the structure of a JSON file and find the key I'm interested in.