Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.0.0P1

Table of Contents

Query via Livestatus

Syntax

Code Block
languagebash
themeRDark
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,/"

...

Code Block
languagebash
themeRDark
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

Warning

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.

...

Scroll down this page and look for Service Metrics. You will see the Metric IDs on the right-hand side like below:


Query via Web-API

Checkmk VersionWeb or Rest API
2.0.0p*Web-API
2.1.0p*Web-API
2.2.0p*REST-API

Custom graph (Web-API)

With this example, you can query the metrics of a custom graph in Checkmk

Code Block
languagebash
themeRDark
root@linux:~# curl -k "https://mylinuxhost/mysite/check_mk/webapi.py?action=get_graph&_username=automation&_secret=mysecret&request_format=python&output_format=python" -d 'request={"specification":["custom","custom_graph_1"],"data_range":{"time_range":[1615627389,1616062956]}}'

{'result_code': 0, 'result': {'start_time': 1615626000, 'end_time': 1616063400, 'step': 1800, 'curves': [{'line_type': 'area', 'color': '#00b2ff', 'title': 'Service Costs per Day', 'rrddata': [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]}]}}


Forecast graph (Web-API)

With this example, you can query the metrics of a forecast graph in Checkmk.

Code Block
languagebash
themeRDark
root@linux:~# curl -k "https://mylinuxhost/mysite/check_mk/webapi.py?action=get_graph&_username=automation&_secret=mysecret&request_format=python&output_format=python" -d 'request={"specification":["forecast","forecast_graph_4"],"data_range":{"time_range":[1616062956,1616513102]}}'

{'result_code': 0, 'result': {'start_time': 1616504400, 'end_time': 1616527800, 'step': 1800, 'curves': [{'line_type': 'area', 'color': '#FFFFFF', 'title': 'CPU utilization - lower edge', 'rrddata': [33.345051190851265, 37.67683226938787, 44.50125333428577, 53.2724501059588, 60.44537606761632, 66.75387999685792, 72.64393851155472, 78.29311232060269, 83.75780489204897, 89.06739515972093, 94.1829539622409, 99.15563480780335, 104.09381440605844]}, {'line_type': 'stacked', 'color': '#F4E750', 'title': 'CPU utilization - confidence interval', 'rrddata': [11.100249458703228, 10.146064241405181, 10.102262795192633, 11.3949147901306, 16.27542796258677, 22.884785199874802, 30.331033266252426, 38.25905074392767, 46.55603069680629, 55.163215257233624, 64.15846274796492, 73.43946615261119, 82.78947205187224]}, {'line_type': 'line', 'color': '#0000FF', 'title': 'CPU utilization - original', 'rrddata': [42.2174, 40.4999, 47.7736, 60.8701, None, None, None, None, None, None, None, None, None]}, {'line_type': 'line', 'color': '#FF0000', 'title': 'CPU utilization - fit & forecast', 'rrddata': [38.89517592020288, 42.749864390090465, 49.552384731882086, 58.969907501024096, 68.58309004890971, 78.19627259679532, 87.80945514468094, 97.42263769256652, 107.03582024045211, 116.64900278833774, 126.26218533622335, 135.87536788410895, 145.48855043199455]}]}}


Builtin graph (Web-API)

With this example, you can query the metrics of a built-in graph in Checkmk. You will receive the data for all lines of a specific line.

Code Block
languagebash
themeRDark
root@linux:~# curl -k "https://mylinuxhost/mysite/check_mk/webapi.py?action=get_graph&_username=automation&_secret=mysecret&request_format=python&output_format=python" -d 'request={"specification":["template",{"service_description":"Filesystem /","site":"mysite","graph_index":0,"host_name":"mysite"}],"data_range":{"time_range":[1615627389, 1616062956]}}'
{'result_code': 0, 'result': {'start_time': 1615626000, 'end_time': 1616063400, 'step': 1800, 'curves': [{'line_type': 'area', 'color': '#00ffc6', 'title': 'Used filesystem space', 'rrddata': [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]}, {'line_type': 'stack', 'color': '#e3fff9', 'title': 'Free space', 'rrddata': [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]}, {'line_type': 'line', 'color': '#006040', 'title': 'Filesystem size', 'rrddata': [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 


RRDcached

If you want the values unfiltered, you can access these from the rrd journal.log directly:

...

Info
titleSources

https://docs.checkmk.com/latest/en/livestatus.html

https://docs.checkmk.com/1.6.0/de/web_api_references.html

https://docs.checkmk.com/1.6.0/de/graphing.html


Filter by label (Content by label)
showLabelsfalse
max5
spacesCON
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-troubleshooting-article" and type = "page" and space = "CON"
labelskb-troubleshooting-article

...