Versions Compared

Key

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

...

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.


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

Custom graph

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]}]}}

Rest-API

Code Block
languagebash
themeRDark


Forecast graph

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]}]}}

Rest-API

Code Block
languagebash
themeRDark


Builtin graph

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":"daily","graph_index":0,"host_name":"localhost2"}],"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, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]}]}}root@klappanas:~# 

Rest-API

Code Block
languagebash
themeRDark


RRDcached

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

...