1

我是 Nagios 监控世界的新手,我想知道 Nagios 中是否有任何可用的 rest-method 基础 API 来检查最后一个 schedule_downtime 是什么时候添加到特定 Windows 服务器/(或其服务)的?

我尝试了类似下面的方法,它帮助我至少找出了停机时间进入和结束时间,但问题是;仅当当前在计划停机时间下添加服务器时才显示停机时间相关信息(停机时间被删除;然后它不会提供任何信息)

代码:

PS C:\> Invoke-WebRequest -Method GET -uri 'http://nagios.xxxxx.com/nagiosapi/index.php/downtimes?Filter[]=host_alias%20%3D%20**target_server_name**'

输出:

StatusCode        : 200
StatusDescription : OK
Content           : {"success":true,"content":[{"author":"XXXX","comment":"Schedule downtime
                    TEST","duration":7200,"**end_time**":1578662416,"**entry_time**":1578655216,"fixed":1,"host_accept_passive_checks":1,"host_acknowledg...
RawContent        : HTTP/1.1 200 OK
                    Transfer-Encoding: chunked
                    Content-Type: application/json
                    Date: Fri, 10 Jan 2020 11:56:47 GMT
                    Server: Apache/2.4.25 (Unix) mod_fcgid/2.3.9 PHP/5.6.29
                    X-Powered-By: PHP/5.6.29
                    {...
Forms             : {}
Headers           : {[Transfer-Encoding, chunked], [Content-Type, application/json], [Date, Fri, 10 Jan 2020 11:56:47 GMT], [Server, Apache/2.4.25 (Unix) mod_fcgid/2.3.9 PHP/5.6.29]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 12675
4

0 回答 0