thruk

How to escape / in service name in thruk api call


I have lots of nagios services with forward slash in their names. When I try to acknowledge the service through thruk api, it returns error like below.

request: http://<thruk_url>/r/v1/services/test-host/check_disk_%2Fvar/cmd/acknowledge_svc_problem
response: /r/v1/services/test-host/check_disk_/var/cmd/acknowledge_svc_problem was not found on this server.

The service name is check_disk_/var. I have lots of services like these, thus renaming all of them is not an easy solution.


Solution

  • There is a generic command endpoint as described here: https://thruk.org/documentation/rest_commands.html#_generic-command-endpoint

        %> curl -H "X-Thruk-Auth-Key: ****" \
                -d "cmd=acknowledge_svc_problem" \
                -d "host=hostname" \
                -d "service=servicedescription" \
                -d "comment_data=test" \
              'http://localhost/thruk/r/cmd'