Historical data with numeric measurement from REST API

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
nagmoto
Posts: 195
Joined: Fri Jan 09, 2015 8:05 am

Historical data with numeric measurement from REST API

Post by nagmoto »

I've been trying to get Nagios historical (Archive JSON CGI) data using its REST API (jsonquery.html). I figured out that I can only get a flag "OK" or "NOK" for CPU Load for example, when querying it for past data, unlike when getting status data (Status JSON CGI) where I don't get "OK" or "NOK", but I get the actual numeric values, for example, CPU load numerically (ex: CPU_Load=x.xxx; y.yyy; z.zzz).

In one of the attachments here (Example of data for chart of historical data) we have a chart that shows data from the past about CPU Load. Since I can generate this chart with numeric values, I believe Nagios keeps these values but the REST API for historical data does not expose numbers themselves to the end user.
Attachment 1 - Example of data for chart of historical data.png
The second attachament (Example of statusJSON.cgi with numeric values) shows numeric values which is just what I need, but this represents current data/status. My question is how can I have access to numeric values from the past?? Is it possible to quer statusJSON.cgi setting start and end time so I can get, let's say, a collection of CPU load values from timestamp1 to timestamp2? For example: https://myserver/nagios/cgi-bin/statusj ... 1496274384
Attachment 2 - Example of statusJSON.cgi with numeric values.png

Thanks!
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Historical data with numeric measurement from REST API

Post by scottwilkerson »

The graph you are displaying is created from the RRD file from pnp4nagios. And you can extract them with rrdtool
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nagmoto
Posts: 195
Joined: Fri Jan 09, 2015 8:05 am

Re: Historical data with numeric measurement from REST API

Post by nagmoto »

Can I retrieve same metric data from statusjson.cgi, instead of rrdtool ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Historical data with numeric measurement from REST API

Post by scottwilkerson »

nagmoto wrote:Can I retrieve same metric data from statusjson.cgi, instead of rrdtool ?
No this is not possible.

You can retrieve a single line as you noticed in the perf_data field. That is the info, but just for the latest check.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nagmoto
Posts: 195
Joined: Fri Jan 09, 2015 8:05 am

Re: Historical data with numeric measurement from REST API

Post by nagmoto »

Thanks, please close this thread.