Checking a service on all hosts _except_...
Marcel Mitsuto Fucatu Sugano
msugano at uolinc.com
Tue Oct 18 18:48:14 CEST 2005
On Tue, 2005-10-18 at 14:21 +0200, Andreas Ericsson wrote:
> Ian Marlier wrote:
> >
> >
> >>From: Andreas Ericsson <ae at op5.se>
> >>Date: Tue, 18 Oct 2005 08:57:20 +0200
> >>To: Ian Marlier <ian.marlier at studentuniverse.com>
> >>Cc: "nagios-users at lists.sourceforge.net" <nagios-users at lists.sourceforge.net>
> >>Subject: Re: [Nagios-users] Checking a service on all hosts _except_...
> >>
> >>Ian Marlier wrote:
> >>
> >>>Hey, all --
> >>>
> >>>This is one of those questions that I'm sure many people have asked before,
> >>>but I haven't been able to find the answer if/when it was given...so sorry
> >>>if I'm making someone repeat him/herself....
> >>>
> >>>Anyway.
> >>>
> >>>I've got an environment with about 65 linux servers, and about 5 windows
> >>>servers. There's a base set of 6 or 7 services that I want to monitor on
> >>>all of them: connectivity, ssh, cron, and a couple of others.
> >>>
> >>>I'm wondering whether it's possible to define a hostgroup (say,
> >>>"windows-servers") with the non-linux boxes listed, and then define a
> >>>service check for all hosts except those.
> >>>
> >>>Something like:
> >>>
> >>>define service {
> >>>name SSH
> >>>host_name *
> >>>except_hostgroup windows-servers
> >>>check_command check_ssh
> >>>.
> >>>.
> >>>.
> >>>}
> >>>
> >>>So, anyone have any thoughts? C'mon, make my life better ;-)
> >>>
> >>
> >>define service {
> >> service_description SSH
> >> host_name *
> >> hostgroup_name !windows-servers
> >> check_command check_ssh
> >>}
> >>
> >>I think that should work. If it doesn't you can always do it the other
> >>way around and create a hostgroup with everything but the
> >>windows-servers in them.
> >
> >
> >
> > Hmmm....that doesn't seem to work, unfortunately, because that would be a
> > very nice solution...
> >
> > I know that I can create the hostgroup -- since I have so few machines that
> > run windows (and it's a number that's going to get smaller), I'm just hoping
> > to avoid having to maintain an "all but 5 machines" type of group...
> >
> > Thanks for the thought, Andreas.
> >
>
> I know the ! should work somewhere in the config. Perhaps you'll have
> better luck if you do
>
> define hostgroup {
> hostgroup_name non-windows-servers
> alias Only FUN servers
> members *,!windows-server1,!windows-server2
> }
>
> Then make a service for that hostgroup to check ssh.
>
You should configure these at nagios.cfg:
---
# REGULAR EXPRESSION MATCHING
# This option controls whether or not regular expression matching
# takes place in the object config files. Regular expression
# matching is used to match host, hostgroup, service, and service
# group names/descriptions in some fields of various object types.
# Values: 1 = enable regexp matching, 0 = disable regexp matching
use_regexp_matching=1
# "TRUE" REGULAR EXPRESSION MATCHING
# This option controls whether or not "true" regular expression
# matching takes place in the object config files. This option
# only has an effect if regular expression matching is enabled
# (see above). If this option is DISABLED, regular expression
# matching only occurs if a string contains wildcard characters
# (* and ?). If the option is ENABLED, regexp matching occurs
# all the time (which can be annoying).
# Values: 1 = enable true matching, 0 = disable true matching
use_true_regexp_matching=1
---
Please tell us if it works,
HTH,
--
Marcel Mitsuto Fucatu Sugano <msugano at uolinc.com>
Universo Online S.A.
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
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