We use Thruk within our business as a front end to different nagios backend servers.
I need to create a list of all the services and their hosts being monitored by these nagios servers but I cannot see an easy way to export a list.
I have been to configuration button in the bottom left corner and have managed to get lists I need loaded but I cannot cleanly copy and paste from this area and there is no export available.
I am wondering if there is another easy way to do this, going via the CLI seems like it would be a longer task.
You can fetch a list of hosts and services from Thruks REST API.
There are some examples here: https://thruk.org/documentation/rest_examples.html
From the command line you can use the thruk cli tool to generate a list:
%> thruk r /csv/hosts?columns=name
this creates a simple text list of all hosts. Removing the /csv prefix will result in a json data structure. Removing the columns=... will export all available columns.
Same can be fetched from the web rest api:
%> curl -H "X-Thruk-Auth-Key: ****" -g 'http://user:password@localhost/thruk/r/csv/hosts?columns=name'
API keys can be created in your user profile page.
The url /r/hosts
retrieves all hosts as they are configured in nagios right now, Thruk config tool can be accessed by ex.: /r/config/objects?:TYPE=host
.
A list of all available rest urls is here:
https://thruk.org/documentation/rest.html#_endpoints