Re: [Nagios-users] Querying nagios object information through command line

2012-05-17 Thread Wenhua Zhang
Hi Yu,
If you have any problem or idea about status-txt(or status-json and
statusXML), please fill free to let me know.


2012/5/17 Yu Watanabe yu.watan...@jp.fujitsu.com:
 Hi Wenhua

 This looks interesting as well.
 I will take a look at it.

 Thanks,
 Yu

 Wenhua Zhang さんは��きました:
Hi Yu,
I think status-txt may do some help for you.
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. You can also get the source
code from github https://github.com/shiziwen/nagios-status2txt;.

Besides plain text, there have been some other format you can use, XML and 
JSON.
JOSN: 
http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details
XML: http://svn.jasonantman.com/nagios-xml/statusXML-krzywanski.php,
and this(c version of nagios-xml:
http://svn.jasonantman.com/nagios-xml/php_module/), which maybe more
usefull for light-weight or high-performance purpose.

I hope it can do some help for you.

2012/5/17 Yu Watanabe yu.watan...@jp.fujitsu.com:
 Benny , Ritchie , Daniel

 Thank you for the advice.

 I will take a look at the mklivestatus.

 Thanks.
 Yu

 C. Bensend 、オ、〓マ抱、ュ、�a、キ、ソ:

 Is there a script or a module that can be called through a command line
 and can retrieve nagios object definition , host , service?

 I am thinking of calling from php program.

 I found that config.cgi has an ability of fetching the object definition
 but it seems that it returns html info.

 It would be helpful if someone can share their thoughts.

Livestatus can do this, and it's MUCH quicker/more lightweight/better
(IMHO) than NDOUtils.

http://mathias-kettner.de/checkmk_livestatus.html

Benny


--
The problem with quotes on the internet is that it's very hard to
verify their authenticity.   -- Abraham Lincoln



--
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

__

--
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

--
Live Security

Re: [Nagios-users] Querying nagios object information through command line

2012-05-16 Thread Wenhua Zhang
Hi Yu,
I think status-txt may do some help for you.
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. You can also get the source
code from github https://github.com/shiziwen/nagios-status2txt;.

Besides plain text, there have been some other format you can use, XML and JSON.
JOSN: 
http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details
XML: http://svn.jasonantman.com/nagios-xml/statusXML-krzywanski.php,
and this(c version of nagios-xml:
http://svn.jasonantman.com/nagios-xml/php_module/), which maybe more
usefull for light-weight or high-performance purpose.

I hope it can do some help for you.

2012/5/17 Yu Watanabe yu.watan...@jp.fujitsu.com:
 Benny , Ritchie , Daniel

 Thank you for the advice.

 I will take a look at the mklivestatus.

 Thanks.
 Yu

 C. Bensend さんは��きました:

 Is there a script or a module that can be called through a command line
 and can retrieve nagios object definition , host , service?

 I am thinking of calling from php program.

 I found that config.cgi has an ability of fetching the object definition
 but it seems that it returns html info.

 It would be helpful if someone can share their thoughts.

Livestatus can do this, and it's MUCH quicker/more lightweight/better
(IMHO) than NDOUtils.

http://mathias-kettner.de/checkmk_livestatus.html

Benny


--
The problem with quotes on the internet is that it's very hard to
verify their authenticity.   -- Abraham Lincoln



--
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

--
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

Re: [Nagios-users] status-txt: easier for other applications/services to use Nagios data

2012-05-07 Thread Wenhua Zhang
Hi Mike,
Thanks for your information.
If the new version support the API's for XML and JSON, I think it will
be very useful for many people.
I am looking forward to the new revision.

Best Wishes,
Wenhua


2012/5/7 Mike Guthrie mguth...@nagios.com:
 As a side note it looks like there is already an addon that's been
 written that produces the status data in XML format.

 http://exchange.nagios.org/directory/Addons/APIs/XML/Status-XML-Generator/details


 Although they won't be making it into the 3.4 release, we'll be looking
 at incorporating community developed API's for XML and JSON in the next
 revision of Nagios core since there has been quite a bit of interest in it.


 On 5/6/2012 8:05 PM, Wenhua Zhang wrote:
 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 Arendsrare...@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 Zhangshizi...@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 Griffinagrif...@nagios.com:
 Thanks for posting this, it looks pretty useful!

 Alex Griffin
 ---
 Tech Team
 agrif...@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@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

Re: [Nagios-users] status-txt: easier for other applications/services to use Nagios data

2012-05-06 Thread Wenhua Zhang
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 rare...@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 shizi...@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 agrif...@nagios.com:
 Thanks for posting this, it looks pretty useful!

 Alex Griffin
 ---
 Tech Team
 agrif...@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@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

 --
 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

Re: [Nagios-users] status-txt: easier for other applications/services to use Nagios data

2012-05-05 Thread Wenhua Zhang
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 agrif...@nagios.com:
 Thanks for posting this, it looks pretty useful!

 Alex Griffin
 ---
 Tech Team
 agrif...@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@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

--
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


Re: [Nagios-users] status-txt: easier for other applications/services to use Nagios data

2012-05-03 Thread Wenhua Zhang
Hi,
Thanks for your reply.

As we know, MKLivestatus is a Nagios Event Broker (NEB) Module which can be
used to extend the core of Nagios. This module can provide access to the
live status information kept in the running Nagios process. It serves a
unix socket for data exchange with external scripts/addons, it is stable
and extremely fast.

status-txt is a simple and light way to get the nagios data in plain text,
it likes status-json (
http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details),
try to making it easier for other applications/services to use Nagios data.

I hope status-txt can be useful for those who have the same need as we did
(try to get the nagios data as other easily readable format).

Best Wishes,
Wenhua


2012/5/3 MAD m...@b-care.net

  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  UPHTTP_80:OK;
196.0.0.2  UPDB_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 
 githubhttps://github.com/shiziwen/nagios-status2txt; 
 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 
 listNagios-users@lists.sourceforge.nethttps://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

--
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

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

2012-05-02 Thread Wenhua Zhang
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
/**
 *
 * STATUS-TXT.C -  Nagios Status CGI
 *
 * Copyright (c) 1999-2009 Ethan Galstad (egals...@nagios.org)
 * Last Modified: 04-27-2012
 * MM: Modified version of status CGI to provide TXT
 *
 * License:
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include ../include/config.h
#include ../include/common.h
#include ../include/objects.h
#include ../include/comments.h
#include ../include/macros.h
#include ../include/statusdata.h

#include ../include/cgiutils.h
#include ../include/getcgi.h
#include ../include/cgiauth.h

extern int refresh_rate;
extern time_t  program_start;

extern char main_config_file[MAX_FILENAME_LENGTH];
extern char url_html_path[MAX_FILENAME_LENGTH];
extern char url_docs_path[MAX_FILENAME_LENGTH];
extern char url_images_path[MAX_FILENAME_LENGTH];
extern char url_stylesheets_path[MAX_FILENAME_LENGTH];
extern char url_logo_images_path[MAX_FILENAME_LENGTH];
extern char url_media_path[MAX_FILENAME_LENGTH];
extern char log_file[MAX_FILENAME_LENGTH];

extern char *notes_url_target;
extern char *action_url_target;

extern int suppress_alert_window;

extern int enable_splunk_integration;

extern host *host_list;
extern service *service_list;
extern hostgroup *hostgroup_list;
extern servicegroup *servicegroup_list;
extern hoststatus *hoststatus_list;
extern servicestatus *servicestatus_list;


#define MAX_MESSAGE_BUFFER		4096

#define DISPLAY_HOSTS			0
#define DISPLAY_HOSTGROUPS		1
#define DISPLAY_SERVICEGROUPS   2


/* HOSTSORT structure */
typedef struct hostsort_struct{
	hoststatus *hststatus;
	struct hostsort_struct *next;
}hostsort;

/* SERVICESORT structure */
typedef struct servicesort_struct{
	servicestatus *svcstatus;
	struct servicesort_struct *next;
}servicesort;

hostsort *hostsort_list=NULL;
servicesort *servicesort_list=NULL;

int sort_services(int,int);		/* sorts services */
int compare_servicesort_entries(int,int,servicesort *,servicesort *);	/* compares service sort entries */
void free_servicesort_list(void);
void free_hostsort_list(void);

void show_service_detail(void);

int passes_host_properties_filter(hoststatus *);
int passes_service_properties_filter(servicestatus *);

void document_header(int);
void document_footer(void);
int process_cgivars(void);


authdata current_authdata;
time_t current_time;

char *host_name=NULL;
char *host_filter=NULL;
char *hostgroup_name=NULL;
char *servicegroup_name=NULL;
char *service_filter=NULL;
int show_all_hosts=TRUE;
int show_all_hostgroups=TRUE;
int show_all_servicegroups=TRUE;
int display_type=DISPLAY_HOSTS;
int overview_columns=3;
int max_grid_width=8;

int service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL;
int all_service_status_types=SERVICE_PENDING|SERVICE_OK|SERVICE_UNKNOWN|SERVICE_WARNING|SERVICE_CRITICAL;

int host_status_types=HOST_PENDING|HOST_UP|HOST_DOWN|HOST_UNREACHABLE;
int