Regex Services?

Goksie Learner perlskuul at gmail.com
Tue Jul 31 01:05:36 CEST 2007


Kerry Milestone wrote:
> Hello,
>
> I am trying to build a services.cfg using regular expressions.  I have 
> enabled the regex options within nagios.cfg
>
> The string I am trying is the following:
> ^(host|gost)\d{1,2}\.\w+\.$
>
> and I have checked my regular expressions with:
> echo 'host1.public.going' | perl -ne 'print if 
> /^(host|gost)\d{1,2}\.\w+\.going$/'
> echo 'gost32.private.going' | perl -ne 'print if 
> /^(host|gost)\d{1,2}\.\w+\.going$/'
>
> yet, I always get when running nagios -v nagios.cfg:
> Error: Could not find any host matching '^(host|gost)\d{1'
> Error: Could not expand hostgroups and/or hosts specified in service 
> (config file '/usr/local/nagios/etc/services.cfg', starting on line
>
> I've tried various other ways of it, and one thing I seem to have 
> noticed is that Nagios seems to parse only square brackets in an 
> expression.  I have compiled a version of the binary with the embedded 
> perl, but this did not help.  I have tried posix expressons too, but not 
> much luck either.
>
> Has anyone one else had some luck with regular expressions within the 
> services.cfg file?  I have a bunch of hosts all running identical services.
>
> I am running Nagios 2.9, both on a Linux platform and FreeBSD.
>
> Many thanks,
> Kerry.
>
>
>
>
>
>   
kerry,

note

^(host|gost)\d{1,2}\.\w+\.$

change it to 
^(host|gost)\d{1,2}\.\w+\.\w+$

and test again.

Learner


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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