Problem with regular expressions and hostgroup_name in a hostgroup definition
John A. Sullivan III
jsullivan at opensourcedevel.com
Fri Jan 25 17:08:34 CET 2008
On Fri, 2008-01-25 at 13:17 +0100, Jacobo García wrote:
> I want to define several hostgroups (for many virtual hosts) that belong
> to the same hostgroup called website:
>
> define hostgroup{
> hostgroup_name websites
> alias All Web Sites
> hostgroup_members ^.*-websites$
> }
>
> define hostgroup{
> hostgroup_name voc-websites
> alias Voc Web Sites
> }
>
> define hostgroup{
> hostgroup_name tck-websites
> alias TCK Web Sites
> }
>
>
> And then define a service that uses the parent hostgroup (website):
>
> define service{
> ; The 'name' of this service template, referenced in other
> service definitions
> name sites-service
> use generic-service
> service_description Sites-service
> is_volatile 0
> check_period 24x7
> max_check_attempts 4
> normal_check_interval 5
> retry_check_interval 1
> contact_groups admins
> notification_options w,u,c,r
> notification_interval 960
> notification_period 24x7
> check_command check_http_path!/
> register 0 ; DONT REGISTER THIS
> DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
> hostgroup_name websites
> }
>
>
> Of course I have regexp enabled in nagios.cfg
>
>
> # REGULAR EXPRESSION MATCHING
> use_regexp_matching=0
>
> # "TRUE" REGULAR EXPRESSION MATCHING
> use_true_regexp_matching=1
>
>
> But this setup does not work as intended, i get the following errors
> when running:
>
> $ sudo /usr/local/nagios/bin/nagios -v /etc/nagios3/nagios.cfg
>
>
> Reading configuration data...
>
> Error: Could not find any hostgroup matching '^.*-websites$' (config
> file '/etc/nagios3/objects/main/hostgroups.cfg', starting on line 33)
> Error: Could not expand member hosts specified in hostgroup (config file
> '/etc/nagios3/objects/main/hostgroups.cfg', starting on line 33)
>
> ***> One or more problems was encountered while processing the config
> files...
>
>
> I am using nagios 3.0 rc1 compiled in ubuntu from sources as explained
> in quickstart guide.
>
> What I am missing?
>
> Thanks for your time in advance
<snip>
We use Nagios regular expressions heavily to monitor our microperimeter
network security setup using ISCS (http://iscs.sourceforge.net). We
have found that more complex regular expressions don't work. e.g.,
dependent_service_description ^Tun.*-\(?:Chattanooga|Midlothian\)$
But simple ones like yours do, e.g.,
dependent_service_description ^Tun.*-Midlothian$
I believe your problem is that you must set
use_regexp_matching=1
to use regular expressions at all. We keep
use_true_regexp_matching=0
because we do not want simple strings being misinterpreted as regular
expressions.
Hope this helps - John
--
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan at opensourcedevel.com
Financially sustainable open source development
http://www.opensourcedevel.com
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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