1

I am new to the Nagios monitoring world and I was looking to know if there is any rest-method base API available in Nagios to check when was the last schedule_downtime added against a particular windows server/(or its service) ?

I tried something like below which helped me to at least find out down time entry and end time but issue is; this shows down time related information only if the server is currently added under schedule downtime (The moment down time get removed; then it won't provide any information )

Code:

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

Output:

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
Christopher Schneider
  • 3,745
  • 2
  • 24
  • 38
Nin
  • 99
  • 1
  • 8

0 Answers0