在 Thruk 中,有没有办法通过 json 、rest 或 curl 在某处提取“扩展命令”

问题描述

显示页面上,我可以在 chrome 的查看源中看到它,但我似乎无法通过 curl 获取此信息,因为页面停止加载 - 可能是由于涉及 json/js在格式化页面

有没有办法通过 rest、json 或 curling 获取这些信息?

解决方法

为此有一个休息端点 https://thruk.org/documentation/rest.html#_get-hosts-name-commandline 对于主机和 https://thruk.org/documentation/rest.html#_get-services-host-service-commandline 用于服务。

可从命令行获得:

thruk r /hosts/localhost/commandline 
[
   {
      "check_command" : "check-host-alive","command_line" : "/omd/sites/devel/lib/monitoring-plugins/check_icmp -H 127.0.0.1 -w 3000.0,80% -c 5000.0,100% -p 5","error" : "","host_name" : "localhost","peer_key" : "78bcd"
   }
]

相同的信息可通过 curl 从 https://thrukhost/thruk/r/hosts/localhost/commandline