Hi,

You could also use the "mk_livestatus" broker (available here http://mathias-kettner.de/checkmk_livestatus.html) which can be used to fetch information from Nagios in JSON format by forging your own requests.

Best regards,
Marc-André

On 05/03/2012 05:57 AM, Wenhua Zhang wrote:
Hi all,
Recently, we need a API or application to get the nagios data as other
easily readable format such as XML, JSON or plain text instead of the
default HTML.
status-txt is implemented to duplicate the output of status.cgi in
plain text to achieve this goal, making it easier for other
applications/services to use Nagios data.

Compile status-txt.c to create status-txt.cgi, this cgi accepts
exactly the same URL parameters that status.cgi accepts, and filters
its output appropriately.
In this version, it accepts almost all the arguments passed in the URL
which status.cgi accepts except "style", "navbarsearch", "columns" and
"noheader".
And we will add more functionalities in the next version.

The status-txt.cgi will returns service data that appears in the
"status" table of status.cgi as "host_ip   host_status
[service:service_status;......]", not includes the top portion of the
page, eg:
    196.0.0.1      UP    HTTP_80:OK;
    196.0.0.2      UP    DB_PORT_3306:OK;DB_PORT_3307:OK;
And you can use some arguments to filter its output, such as
"hostgroup", "servicegroup", "host" and so on.

The attachment is the source code, if you have any ideas about it,
please feel free to let me know.
You can also get the source code from github
"https://github.com/shiziwen/nagios-status2txt";.


Thanks,
Best Wishes,
Wenhua


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue.
::: Messages without supporting info will risk being sent to /dev/null

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to