How to query comments via URL extinfo.cgi

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Darren
Posts: 4
Joined: Thu Feb 20, 2014 10:09 am

How to query comments via URL extinfo.cgi

Post by Darren »

Hi,
I am trying to pull comments out for hosts and services using a custom built webpage. This page uses jsonstatus.cgi to query Nagios and extract the required information to display in the format we prefer.
That is all working fine, but im struggling with how to extract the comments without resulting to screenscraping the host comment page via nagios/cgi-bin/extinfo.cgi?type=3

I was wondering if there are any parameters I can pass to extinfo.cgi to pull out the host/service defined if possible? all I get from the jsonstatus.cgi query is that the service has a comment assigned, it doesnt include what that comment actually said.

Hope that makes sense.

We are running Nagios Core 3.2.3

Thanks

Darren
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: How to query comments via URL extinfo.cgi

Post by abrist »

Scraping the comments from the extended cgi is probably the only option. You could take a look at the json branch of core 4 - it has a json api that can query object status and config, and historical information like previous check states and comments.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Darren
Posts: 4
Joined: Thu Feb 20, 2014 10:09 am

Re: How to query comments via URL extinfo.cgi

Post by Darren »

I decided to just grab the num_comments value from the object array of my json service query and add a symbol rather than grabbing the actual text.
This is a neater solution and simpler to code for our external dashboard.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to query comments via URL extinfo.cgi

Post by tmcdonald »

Safe to lock this up then?
Former Nagios employee
Darren
Posts: 4
Joined: Thu Feb 20, 2014 10:09 am

Re: How to query comments via URL extinfo.cgi

Post by Darren »

Yes Please. Thanks for the quick responses
Locked