Discussion:
[Check_mk (english)] How to consuming the CheckMk Web API from Ruby
Scharfenberg, Carsten
2018-10-04 13:30:45 UTC
Permalink
Hi all,

I have some questions concerning configuring CheckMk via puppet. Some of them more general while others are quite specific.
This one question is quite specfic. It's about consuming the CheckMk Web API from a puppet module using Ruby code.

The CheckMk Web API uses either JSON or python as body language. For some methods it's possible to choose between them others are only available in python (e.g. get_host/set_host). The general statement ist: JSON is experimental/obsolete (refer to: https://mathias-kettner.com/cms_web_api.html, section 2.2).
So I conclude that I should use python as body language.
On the other hand I'm stuck to ruby when writing puppet modules.
So the questions is: how to deal with python code from ruby?

Some notes on my approaches so far:
Generating the python code for web API requests is simple: I can use a template with the correct predefined syntax and substitute some variables.
But I do not know how to do it the other way round. How would I parse python language objects with ruby?

So I've tried another approach: there are ruby gems that allow to call code from python modules.
The CheckMk Web api client I've written in python works like a charm when using it from the ruby irb command line.
But when integrating it into my final puppet module I receive segmentation faults. It is beyond my knowledge and resources to debug this issue further.

So has anybody ever tried to consume the CheckMK web api (with output_format=python) from ruby or another language that is not python?
How would I do this?

Thanks,
Carsten

Loading...