<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I usually combine the classic external command scripts with a smidge of perl to grab the members of the hostgroup that I want to trigger something for.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If you give the following script a hostgroup name, it will grab the members from objects.cache:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>#!/usr/local/nagios/bin/perl<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>use warnings;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>use strict;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>my $hostgroup = $ARGV[0];<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'># here’s the spot where I should be checking that $hostgroup is defined…<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>open my $objects,'<','/usr/local/nagios/var/objects.cache' or die "Failure opening objects file: $!\n";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$/ = '}';<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>while (<$objects>) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>    if (/hostgroup_name\s+($hostgroup)/gs) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>        /members\s+(\S+)/gs;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>        my $members = $1;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>        my @members = split /,/,$members;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>        for my $member (@members) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>            print "$member\n";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>        }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>    }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>close $objects;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>When you run that you get a list that you can feed to your external command script.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Here’s the idea in shell on the command line:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>bash# for x in `get_hostgroup_members big_switches`;do trigger_service_script $x;done <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:#548DD4'>Andy Ford<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:#548DD4'>Network Security Engineer | Solutions Design & Automation| Information Security Technology<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:#548DD4'>314-348-4937<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:#548DD4'>andrew.ford@wellsfargo.com<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Michael Friedrich [mailto:michael.friedrich@univie.ac.at] <br><b>Sent:</b> Monday, January 09, 2012 2:54 PM<br><b>To:</b> nagios-users@lists.sourceforge.net<br><b>Subject:</b> Re: [Nagios-users] How to reschedule multiple/all services at once<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><tt><span style='font-size:10.0pt'>On 09.01.2012 20:53, Jake Xu wrote:</span></tt> <o:p></o:p></p><p class=MsoNormal><tt><span style='font-size:10.0pt'>Hi everyone,</span></tt> <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal><tt><span style='font-size:10.0pt'>From time to time, I need to restart or reschedule all services to verify that some new checks or new hosts are working properly. Is there any easy way to do that? I have a large number of hosts and services, so it would be tedious to click through a bunch of links via the web interface. Using external command is not very feasible as well because I would have to have all host names and service names for the command line commands.</span></tt><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><tt><span style='font-size:10.0pt'>I have seen a pretty good idea on Icinga, a Nagios fork, for this purpose. It has a checkbox associated with each service check and a select-all checkbox to select all checkboxes. </span></tt><o:p></o:p></p></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>hehe. you just made ricardo and rune proud :-))</tt><br><br><br></span><o:p></o:p></p><div><p class=MsoNormal><tt><span style='font-size:10.0pt'>It would be useful to have that on the Nagios Core, but AFAIK there isn't any.</span></tt><o:p></o:p></p></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><br><br><tt>for the problem itsself - try OMD. nagios, icinga, shinken as core available whilst the gui decision is up to you.</tt><br><br><tt><a href="http://omdistro.org">http://omdistro.org</a></tt><br><br><br></span><o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><tt><span style='font-size:10.0pt'>Thanks in advance,</span></tt><o:p></o:p></p></div><div><p class=MsoNormal><tt><span style='font-size:10.0pt'>Jake</span></tt><o:p></o:p></p></div><pre><tt><o:p> </o:p></tt></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt>------------------------------------------------------------------------------<o:p></o:p></tt></pre><pre><tt>Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex<o:p></o:p></tt></pre><pre><tt>infrastructure or vast IT resources to deliver seamless, secure access to<o:p></o:p></tt></pre><pre><tt>virtual desktops. With this all-in-one solution, easily deploy virtual <o:p></o:p></tt></pre><pre><tt>desktops for less than the cost of PCs and save 60% on VDI infrastructure <o:p></o:p></tt></pre><pre><tt>costs. Try it free! <a href="http://p.sf.net/sfu/Citrix-VDIinabox">http://p.sf.net/sfu/Citrix-VDIinabox</a></tt><o:p></o:p></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt>_______________________________________________<o:p></o:p></tt></pre><pre><tt>Nagios-users mailing list<o:p></o:p></tt></pre><pre><tt><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><o:p></o:p></tt></pre><pre><tt><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><o:p></o:p></tt></pre><pre><tt>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. <o:p></o:p></tt></pre><pre><tt>::: Messages without supporting info will risk being sent to /dev/null</tt><o:p></o:p></pre><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><br><br><br></span><o:p></o:p></p><pre><tt>-- <o:p></o:p></tt></pre><pre><tt>DI (FH) Michael Friedrich<o:p></o:p></tt></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt>Vienna University Computer Center<o:p></o:p></tt></pre><pre><tt>Universitaetsstrasse 7 A-1010 Vienna, Austria<o:p></o:p></tt></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt>email:     <a href="mailto:michael.friedrich@univie.ac.at">michael.friedrich@univie.ac.at</a><o:p></o:p></tt></pre><pre><tt>phone:     +43 1 4277 14359<o:p></o:p></tt></pre><pre><tt>mobile:    +43 664 60277 14359<o:p></o:p></tt></pre><pre><tt>fax:       +43 1 4277 14338<o:p></o:p></tt></pre><pre><tt>web:       <a href="http://www.univie.ac.at/zid">http://www.univie.ac.at/zid</a><o:p></o:p></tt></pre><pre><tt>           <a href="http://www.aco.net">http://www.aco.net</a><o:p></o:p></tt></pre><pre><tt><o:p> </o:p></tt></pre><pre><tt>Lead Icinga Core Developer<o:p></o:p></tt></pre><pre><tt><a href="http://www.icinga.org">http://www.icinga.org</a><o:p></o:p></tt></pre></div></body></html>