/
How-to query historical metrics
How-to query historical metrics
This manual will show you the different options for fetching metrics from Checkmk to push this data to a 3rd party tool.
LAST TESTED ON CHECKMK 2.3.0P1
Table of Contents
Query via Livestatus
Syntax
Columns: rrddata:var1:metric1.max:start:end:step rrddata:var2:metric2.max:start:end:step or Columns: rrddata:m1:fs_used.max,1,*:1614839543:1614929543:1 With "1,*" you can rescale high values. This is only needed for high values like MB. You can rescale such values with "1024,*" or "1024,/"
Example
With this example, you will receive all perfdata for a specific service/host. You can use livestatus for that.
OMD[mysite]:~$ lq "GET services\nFilter: host_name = mysite\nFilter: service_description = Filesystem /\nColumns: host_name\nColumns: service_description\nColumns: rrddata:m1:fs_used.max,1024,/:1614839543:1614929543:30\nOutputFormat: python" [[u"mysite",u"Filesystem /",[1614839400,1614931200,1800,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,333.982,334.178,334.465,334.638,334.773,334.923,335.082,335.249,335.361,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,336.493,336.673]]]
Query via REST-API
With Checkmk 2.1, announced by Werk #13640, the Web API was deprecated. This release now (Checkmk 2.2) removes the Web API.
We recommend migrating all existing scripts that use the Web API to the REST API.
Checkmk Version | Web or Rest API |
---|---|
2.0.0p* | Web-API |
2.1.0p* | Web-API |
2.2.0p* | REST API |
- To access the REST-API Documentation, click on Help → REST API Documentation