Reporting Module data to json file

Hello, in the Reporting module you can create a report containing SLA in % for hosts or services and then download the data in PDF, JSON or CSV format. I want to do all those things but from a script. So i wonder if it is possible to create a report and save the data using a curl or MySQL commands?

Best regards Johnny

Try copying the JSON url from your browser and use that with cURL. It will need auth details though.

Are the reports automatically updated so i can use the same URL, or do i need to manually create a new report when i want new information?

I didn’t have access to my Vagrant VM up until now, but that’s also an easy one you should be able to test by yourself. The exported report and JSON url uses the report id. So you can modify the report and just refer to it by using its ID.

Cheers,
Michael

That is the thing though, what i want to achieve is a curl command that can create/update the report for me so i do not have to login and click my way to create a report manually. Then i want to get the report in JSON format as you previously suggested above by a curl command to the URL. In the end i want a script that handles the report.
Do you think this is doable?

I’m not sure if such API endpoint exist to create commands via POST/PUT requests. That might be a thing for a feature request on GitHub. The reporting module is for early adopters, so every idea counts :slight_smile:

Then i have one last question regarding curling the URL of the report. What kind of authentication is needed to pass the login page?

You’ll need to send user/pass as basic auth credentials, and also ensure to set the Accept header accordingly.

curl -u icingaadmin:icinga -H 'Accept: application/json' -X GET 'http://192.168.33.5/icingaweb2/reporting/report/download?type=json&id=1'

Example from the standalone Vagrant box below.

1 Like