parsing tac.cgi output
Andy Moran
amoran at apple.com
Fri Jan 4 19:09:00 CET 2013
Thanks for the suggestions!
--Andy
On Jan 3, 2013, at 3:09 AM, Páll Guðjón Sigurðsson <palli at ok.is> wrote:
> Hi andy,
>
> as for the tac.cgi i think your best bet is to parse the html.
>
> Alternatively if you have pynag installed on the nagios server you can use this script:
>
> import pynag.Parsers
> s = pynag.Parsers.status()
> s.parse()
>
> all_services = s.data['servicestatus']
> unhandled_problems = [service for service in all_services if service['current_state'] != '0' and service['problem_has_been_acknowledged'] == '0' ]
>
> print len(unhandled_problems)
>
>
>
> If your script is not running on the nagios server itself, consider using mklivestatus to get the total number of problems (either shell script or pynag)
>
> Kind regards,
> Pall Sigurdsson
>
>
> ----- Original Message -----
> From: "Andy Moran" <amoran at apple.com>
> To: "Nagios Users List" <nagios-users at lists.sourceforge.net>
> Sent: Wednesday, January 2, 2013 7:00:41 PM
> Subject: [Nagios-users] parsing tac.cgi output
>
>
> Does tac.cgi have a way to output JSON or XML or another machine-parsable output?
>
> Specifically I'm looking to have an external script query the number of un-acknowledged critical problems in the nagios cluster.
>
>
> Apologies if this has been asked before.
>
> Cheers!
>
> --Andy
>
> ------------------------------------------------------------------------------
> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
> and much more. Keep your Java skills current with LearnJavaNow -
> 200+ hours of step-by-step video tutorials by Java experts.
> SALE $49.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122612
> _______________________________________________
> 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
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> 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
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
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