Skip to content

JSON Sensor

Overview

The JSON Sensor in Onagre allows users to monitor and validate JSON responses from an HTTP endpoint. It ensures that specific fields contain expected values, helping teams verify the correctness of API responses and detect unexpected changes in structured data.

Configuration Options

When setting up a JSON Sensor, the following parameters can be configured:

  • URL: The target endpoint returning JSON data.
  • HTTP Method: The request method to use (GET, POST, etc.).
  • Request Payload (optional): Data to send with POST or PUT requests.
  • Headers (optional): Custom headers to include in the request.
  • Timeout: Maximum time to wait for a response before considering the request as failed.
  • Expected HTTP Status Codes: Define acceptable response codes (e.g., 200 OK).
  • Authentication (optional): Supports Basic Authentication and Bearer Token authentication.
  • JSON Field Path: The key path to extract the value for validation.
  • Expected Value: The expected content of the selected JSON field.
  • Comparison Operator: Defines how the expected value should be compared (e.g., equals, greater than, contains).
  • Check Interval: Defines how often the request should be sent (e.g., every minute, every five minutes).

Response Validation

The JSON Sensor validates responses based on:

  • Exact Value Matching: Checks if the extracted field matches an expected value.
  • Numerical Comparisons: Allows greater than, less than, and range comparisons.
  • String Matching: Supports substring search and case sensitivity options.
  • Boolean Validation: Ensures that a field is true or false.

Alerts and Notifications

If the JSON response does not match the expected conditions, the sensor can trigger alerts via:

  • Slack, Microsoft Teams, Discord, Google Chat, Webhooks, Pushover
  • Email Notifications
  • Onagre’s Dashboard for Incident Tracking

Use Cases

  • Ensuring an API returns the correct status or value in a JSON response.
  • Verifying numerical thresholds, such as server load or active user count.
  • Checking boolean flags, such as feature toggles or system health indicators.
  • Detecting unexpected changes in structured API data.

Deployment

The JSON Sensor can be used with both public and private resources. For internal monitoring, Onagre’s private agent can be deployed to check endpoints that are not accessible from the internet.

Summary

The JSON Sensor is an essential tool for monitoring structured API responses, allowing precise validation of key values and detecting anomalies in real time. With flexible configuration and integration with modern communication tools, it helps teams maintain data integrity and service reliability.