As you all known, JSON is a standard format used for exchanging data between applications.
This standard is adopted by practically every vendor and by many applications to make information available via REST API.
It is therefore very useful to exploit this information in standard format also in the monitoring field.
A concrete example that I want to show in this post has begun from a customer request relating to NATS monitoring (an open-source messaging system, which is also the default message broker in NetEye).
Starting from this request I identified an interesting possibility to use the metrics available on JSON pages which I will show below.
Initially I tried to find if there was an existing plugin ready to use to monitor NATS or a way to collect metrics via SNMP/REST API. But after a very educational discussion with the solution architect team that use NATS, I decided to the check some specific controls made available natively by the “monitoring” page of NATS itself (an excellent and very interesting example of what I said in the introduction).
In the “monitoring” page NATS expose many useful metrics in JSON format and for this reason I started looking for plugins capable of parsing JSON pages until I found the plugin check_http_json (a generic plugin for Nagios which checks json values from a given HTTP endpoint against argument specified rules and determines the status and performance data for that service).
I have tested check_http_json for a long time and I can confirm that it turns out to be very useful in these scenarios:
identify if a specific JSON key exists (–key_exists option):
'/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'connz' '--key_exists' 'num_connections'
OK: Status OK.
identify if a specific JSON key exists and produce the relative metrics (–key_exists and –key_metric options)
'/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'connz' '--key_exists' 'num_connections' '--key_metric' 'num_connections'
OK: 'num_connections'=14 Status OK. |'num_connections'=14
return CRITICAL or WARNING if the key you are looking for does not exist (–key_exists and –key_metric options)
'/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'connz' '--key_exists_critical' 'mydummykey'
CRITICAL: Status CRITICAL. Key mydummykey did not exist.
'/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'connz' '--key_exists' 'mydummykey'
WARNING: Status WARNING. Key mydummykey did not exist.
check the value related to a key over a threshold and produce a warning/critical situation with its metric in the perfdata (–critical and –key_metric options)
# '/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'connz' '--critical' 'num_connections,20:' '--key_metric' 'num_connections'
CRITICAL: 'num_connections'=10 Status CRITICAL. Value (14) for key num_connections was less than 20.|'num_connections'=10
check the value related to a sub key over a threshold and produce a warning/critical situation (–critical and –key_metric options)
# '/neteye/shared/monitoring/plugins/check_http_json.py' '-H' 'demo.nats.io' '-P' '8222' '-p' 'accountz?acc=$G' --critical'account_detail.sublist_stats.num_subscriptions,3000:' '--key_metric' 'num_subscriptions'
CRITICAL: 'account_detail.sublist_stats.num_subscriptions'=117 Status CRITICAL. Value (117) for key account_detail.sublist_stats.num_subscriptions was less than 3000.|'num_subscriptions'=117
There are other controls made available by this plugin that I report below. For details, please refer to the plugin documentation.
By following this example it is therefore possible to control and monitor practically every specific parameter or metric made available by any vendor / device / application able to expose data in JSON. Furthermore, thanks to the historicized data in InfluxDB and Grafana, it is also possible to create specific dashboards with graphs that give evidence of trends or punctual indicators that can be constantly monitored.
I hope this example can also be useful for monitoring other applications and any other object that exposes data in JSON.
Hi everybody. I’m Giuseppe and I was born in Milan in 1979. Since the early years of university, I was attracted by the Open Source world and operating system GNU\Linux. After graduation I had the opportunity to participate in a project of a startup for the realization of an Internet Service Provider. Before joining Würth Phoenix (now Würth IT Italy) as SI consultant, I gained great experience as an IT consultant on projects related to business continuity and implementation of open source software compliant to ITIL processes of incident, change and service catalog management. My free time is completely dedicated to my wife and, as soon as possible, run away from Milan and his caotic time and trekking discover our beautiful mountain near Lecco for relax and lookup the (clean) sky.
Author
Giuseppe Di Garbo
Hi everybody. I’m Giuseppe and I was born in Milan in 1979. Since the early years of university, I was attracted by the Open Source world and operating system GNU\Linux. After graduation I had the opportunity to participate in a project of a startup for the realization of an Internet Service Provider. Before joining Würth Phoenix (now Würth IT Italy) as SI consultant, I gained great experience as an IT consultant on projects related to business continuity and implementation of open source software compliant to ITIL processes of incident, change and service catalog management. My free time is completely dedicated to my wife and, as soon as possible, run away from Milan and his caotic time and trekking discover our beautiful mountain near Lecco for relax and lookup the (clean) sky.
A safer way to run privileged Windows checks with SystemRunner If you’ve been monitoring Windows for a while, you’ve probably seen this pattern: some checks must run as LocalSystem (S-1-5-18), and the “quick fix” is to run the Icinga Agent Read More
With the upgrade to NetEye 4.44, we've added a lot of new features (https://www.neteye-blog.com/2025/10/neteye-4-44-release-notes/) and, from my point of view, one of the most relevant is the introduction of Elastic Stack 9. This Elasticsearch major release (https://www.elastic.co/guide/en/elastic-stack/9.0/elastic-stack-release-notes.html) includes some new Read More
In NetEye, 'business processes' is a module used to model and monitor the business process hierarchy to obtain a high-level view of the status of critical applications. In short, they allow monitoring controls of individual components to be aggregated into Read More
If you've worked with Elastic APM, you're probably familiar with the APM Server: a component that collects telemetry data from APM Agents deployed across your infrastructure. But what happens when you need to segregate that data by tenant, especially in Read More
In the first part we created hosts and services to monitor a sequence of script using Tornado. The Tornado Rule Now let's continue with the creation of a Tornado rule: open the NetEye web interface and select Tornado dashboard, then Read More