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

Directory Tree

JSON Wizard

Rating
0 votes
Favoured:
0
Current Version
1.2.1
Last Release Date
2019-11-04
Compatible With
  • Nagios XI
Hits
9303
Files:
FileDescription
configwizard-check_json.zipconfigwizard-check_json.zip
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
JSON Wizard
A wizard to create checks that monitor values returned in a web service's JSON response.
1.2.1
------
-verbiage added
-String check statuses changed from fields to drop downs

1.2
------
-Added service field
-Fixed some logic
-Cleaned up code a bit


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.