如何在 thruk api 调用中转义 / in service name

How to escape / in service name in thruk api call

我有很多名称中带有正斜杠的 nagios 服务。当我尝试通过 thruk api 确认服务时,出现如下 returns 错误。

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.

服务名称是check_disk_/var。我有很多这样的服务,因此重命名它们并不是一个简单的解决方案。

这里有一个通用的命令端点: 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'