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.
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
Thanks!
Historical data with numeric measurement from REST API
-
- Posts: 195
- Joined: Fri Jan 09, 2015 8:05 am
Historical data with numeric measurement from REST API
You do not have the required permissions to view the files attached to this post.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
Re: Historical data with numeric measurement from REST API
The graph you are displaying is created from the RRD file from pnp4nagios. And you can extract them with rrdtool
-
- Posts: 195
- Joined: Fri Jan 09, 2015 8:05 am
Re: Historical data with numeric measurement from REST API
Can I retrieve same metric data from statusjson.cgi, instead of rrdtool ?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
Re: Historical data with numeric measurement from REST API
No this is not possible.nagmoto wrote:Can I retrieve same metric data from statusjson.cgi, instead of rrdtool ?
You can retrieve a single line as you noticed in the perf_data field. That is the info, but just for the latest check.
-
- Posts: 195
- Joined: Fri Jan 09, 2015 8:05 am
Re: Historical data with numeric measurement from REST API
Thanks, please close this thread.