status-txt: easier for other applications/services to use Nagios data

Wenhua Zhang shiziwen at gmail.com
Mon May 7 03:05:44 CEST 2012


Hi Robert,
Thanks for your advice, it is a good idea.

As till now, status-txt just returns status.dat as plain text. When we
wrote this program, we have thought about many formats, such as JSON,
XML, plain text and so on. We use plain text because it is simple, but
now I found it may be not widely used as JSON and XML. (status-json
can get the nagios data as JSON. You can get it from
http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details)

status-txt is the first version, and we will add more function in the
next version, such as more filters and maybe more output formats.

I think you can push your PHP program to the this email list, maybe
some one will be interested, like me.

Best Wishes,
Wenhua


2012/5/6 Robert Arends <rarends at imc.net.au>:
> Sounds great. Does it output in XML ? Would be good to support that as an option.
> It would be good to have a search option - as in , return all hosts/services/downtime etc matching ".....". If it could do regex on the match would be nice.
>
> I've just written a rough php program to return status.dat as XML.
> It works very well but C++ would be quicker and I wouldn't have to cleanup the code.
>
> I'll run this up during the week to see if it is a good as it sounds like it is.
>
> Thanks rob
>
>
>
> Sent from my iWorld
>
> On 06/05/2012, at 2:08, "Wenhua Zhang" <shiziwen at gmail.com> wrote:
>
>> Thanks for your reply!
>> I hope it will be useful to you.
>> It is the first version and we will add more functions. If you have
>> some advice, please feel free to let me know.
>>
>> Thanks,
>> Best Wishes,
>> Wenhua
>>
>> 2012/5/5 Alex Griffin <agriffin at nagios.com>:
>>> Thanks for posting this, it looks pretty useful!
>>>
>>> Alex Griffin
>>> ---
>>> Tech Team
>>> agriffin at nagios.com
>>>
>>> On 05/02/2012 10:57 PM, 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 at 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 at 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 at 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 at 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 at 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





More information about the Users mailing list