How to reschedule multiple/all services at once

andrew.ford at wellsfargo.com andrew.ford at wellsfargo.com
Mon Jan 9 22:17:17 CET 2012


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.

If you give the following script a hostgroup name, it will grab the members from objects.cache:

#!/usr/local/nagios/bin/perl
use warnings;
use strict;

my $hostgroup = $ARGV[0];
# here's the spot where I should be checking that $hostgroup is defined...
open my $objects,'<','/usr/local/nagios/var/objects.cache' or die "Failure opening objects file: $!\n";
$/ = '}';
while (<$objects>) {
    if (/hostgroup_name\s+($hostgroup)/gs) {
        /members\s+(\S+)/gs;
        my $members = $1;
        my @members = split /,/,$members;
        for my $member (@members) {
            print "$member\n";
        }
    }
}
close $objects;

When you run that you get a list that you can feed to your external command script.
Here's the idea in shell on the command line:

bash# for x in `get_hostgroup_members big_switches`;do trigger_service_script $x;done


Andy Ford
Network Security Engineer | Solutions Design & Automation| Information Security Technology
314-348-4937
andrew.ford at wellsfargo.com

From: Michael Friedrich [mailto:michael.friedrich at univie.ac.at]
Sent: Monday, January 09, 2012 2:54 PM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] How to reschedule multiple/all services at once

On 09.01.2012 20:53, Jake Xu wrote:
Hi everyone,

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

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.

hehe. you just made ricardo and rune proud :-))


It would be useful to have that on the Nagios Core, but AFAIK there isn't any.


for the problem itsself - try OMD. nagios, icinga, shinken as core available whilst the gui decision is up to you.

http://omdistro.org



Thanks in advance,
Jake





------------------------------------------------------------------------------

Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex

infrastructure or vast IT resources to deliver seamless, secure access to

virtual desktops. With this all-in-one solution, easily deploy virtual

desktops for less than the cost of PCs and save 60% on VDI infrastructure

costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox





_______________________________________________

Nagios-users mailing list

Nagios-users at lists.sourceforge.net<mailto: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




--

DI (FH) Michael Friedrich



Vienna University Computer Center

Universitaetsstrasse 7 A-1010 Vienna, Austria



email:     michael.friedrich at univie.ac.at<mailto:michael.friedrich at univie.ac.at>

phone:     +43 1 4277 14359

mobile:    +43 664 60277 14359

fax:       +43 1 4277 14338

web:       http://www.univie.ac.at/zid

           http://www.aco.net



Lead Icinga Core Developer

http://www.icinga.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20120109/ed390e46/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
-------------- next part --------------
_______________________________________________
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