【问题标题】:Is there a way in Thruk to extract the 'Expanded command' somewhere, via JSON, REST, or curl?Thruk 中有没有办法通过 JSON、REST 或 curl 在某处提取“扩展命令”?
【发布时间】:2021-06-22 12:48:28
【问题描述】:

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

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

【问题讨论】:

  • 我对@9​​87654321@不熟悉,但如果你能解释一下“扩展命令”到底是什么,也许可以直接从CLI上的配置或livestatus中得到它

标签: nagios icinga thruk


【解决方案1】:

为此有一个休息端点 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

【讨论】:

  • 我们运行的是没有其余界面的旧版本,最终使用基于浏览器的 webdownloader 下载页面,因为 curl 也无法正确获取它们,然后只是通过它们获取信息。跨度>
猜你喜欢
  • 2019-10-12
  • 1970-01-01
  • 1970-01-01
  • 2019-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-22
  • 1970-01-01
相关资源
最近更新 更多