Skip to content

JSON API Monitoring with the HTTP Agent Item

Video Lecture

JSON API Monitoring with the HTTP Agent Item JSON API Monitoring with the HTTP Agent Item

 (Pay Per View)

You can use PayPal to purchase a one time viewing of this video for $1.49 USD.

Pay Per View Terms

  • One viewing session of this video will cost the equivalent of $1.49 USD in your currency.
  • After successful purchase, the video will automatically start playing.
  • You can pause, replay and go fullscreen as many times as needed in one single session for up to an hour.
  • Do not refresh the browser since it will invalidate the session.
  • If you want longer-term access to all videos, consider purchasing full access through Udemy or YouTube Memberships instead.
  • This Pay Per View option does not permit downloading this video for later viewing or sharing.
  • All videos are Copyright © 2019-2025 Sean Bradley, all rights reserved.

Description

Many devices and services now provide REST APIs that you can query and get JSON formatted data as a response. In this video I will show you how to create an Item that uses the HTTP Agent type to query an external REST API and extract its data.

In case you don't have a REST API handy that you can query, I have created a test REST API you can use. It has several methods that return test data.

Like with Web Scenarios, the HTTP agent item type is executed from the Zabbix server, or proxy if the host is monitored by proxy.

Note

The returned data is randomized. This is testing data only for the purpose of demonstrating reading it in Zabbix.

Get A List of Example Users and Scores

Request

https://sbcode.net/api/getTestUsers

Response

[
  { "id": 0, "name": "Red Cat", "score": 80 },
  { "id": 1, "name": "Green Dog", "score": 8 },
  { "id": 2, "name": "Blue Bird", "score": 82 },
  { "id": 3, "name": "Yellow Tiger", "score": 19 },
  { "id": 4, "name": "Orange Koala", "score": 22 }
]

JSONPath to extract Yellow Tigers score

$[3].score

JSONPath to extract Yellow Tigers ID

$[3].id

Get a specific Example User and Score by ID

Request

https://sbcode.net/api/getTestUsers/1

Response

{ "id": 1, "name": "Green Dog", "score": 29 }

JSONPath to extract Green Dogs score

$.score

Get A List of Example Users and Scores (Requires Basic Authentication)

Username : user

Password : pass

Request

https://sbcode.net/api/getTestUsersAuth

Response

[
  { "id": 0, "name": "Red Cat", "score": 65 },
  { "id": 1, "name": "Green Dog", "score": 72 },
  { "id": 2, "name": "Blue Bird", "score": 91 },
  { "id": 3, "name": "Yellow Tiger", "score": 89 },
  { "id": 4, "name": "Orange Koala", "score": 47 }
]

JSONPath to extract Red Cats score

$[0].score

Get a specific Example User and Score by ID (Requires Basic Authentication)

https://sbcode.net/api/getTestUsersAuth/1

Response

{ "id": 1, "name": "Green Dog", "score": 45 }

JSONPath to extract Green Dogs score

$.score

Test some JSON path queries on your JSON API responses.

https://jsonpath.com/

Zabbix JSONPath Examples