Am 30.10.2014 um 18:45 schrieb Shaw, Brian:

Michael,

Thank you for the link. Unfortunately, the regex doesn’t work either. If my config is:

apply Service "Disk Space - /partition" {

  import "disk-check"

vars.nrpe_remote_arglist = "10% /partition"

  assign where regex("^App 1 Name.*", host.groups)

}

I will see:

warning/Service: Apply rule 'Disk Space - /partition' for host does not match anywhere!

In the checkconfig output.

If I spell out the full name of the host group like this:

apply Service "Disk Space - /partition" {

  import "disk-check"

vars.nrpe_remote_arglist = "10% /partition"

  assign where "App 1 Name DBs" in host.groups

}

The error goes away and the disk check appears on the correct machines.

While this workaround works, it would be much easier to manage over time if either the match() rule or the regex() rule worked.

Can you confirm if this is a bug, in which case I’d be glad to file a ticket, or if this is working as designed, or equally possible, I have no idea what I’m doing and have mucked up the configuration. If the latter is true, I’d appreciate the above code block being corrected.


I cannot confirm this being a bug or not, I just don't have time to test it now for myself. If you think it is one, and it looks like one, please do so in opening one at dev.icinga.org

But please be advised, that we don't immediately answer/comment/handle bugs. We'll keep them reviewed in our weekly dev meetings though.

Also, for regex(), what type is it?  Is it Perl or Java or something else?


Don't really get what you mean by that. If you want to know how regex() as function is evaluated, look into the source code ;-)

https://github.com/Icinga/icinga2/blob/master/lib/base/scriptutils.cpp#L44

kind regards,
Michael


Thank you.

Brian

*From:*icinga-users [mailto:[email protected]] *On Behalf Of *Michael Friedrich
*Sent:* Thursday, October 30, 2014 10:41 AM
*To:* [email protected]
*Subject:* Re: [icinga-users] apply Service assign rules

Am 30.10.2014 um 15:37 schrieb Shaw, Brian:

    Is there any documentation on when and how you can use “assign
    where match”?  I’m trying to do something like the following:

    apply Service "Disk Space - /partition” {

      import "disk-check"

      vars.nrpe_remote_arglist = "10% /partition"

      assign where match ("App 1 Name*", host.groups)

    }

    In our environment we have a number of host groups that start with
    the same application name but end with something unique such as
    “App 1 Name Web”, “App 1 Name DBs”, “App 2 Name Web”, “App 2 Name
    DBs”.  I want to check for a shared partition that is unique to
    all the “App 1 Name” machines but is different than the data
    partition that is unique to all “App 2 Name” machines.

    This exact type of assign statement works fine for “object
    HostGroup” blocks.

    If “assign where match” doesn’t work in the “apply Service” block,
    is there another shorthand way to locate my groups or do I have to
    list each group specifically and manage that list over time?


Maybe regex() fulfills your requirement better than match().
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2#function-calls




Thanks for your help.

Brian

NOTICE:

This message, and any attachments, contain(s) information that may be confidential or protected by privilege from disclosure and is intended only for the individual or entity named above. No one else may disclose, copy, distribute or use the contents of this message for any purpose. Its unauthorized use, dissemination or duplication is strictly prohibited and may be unlawful. If you receive this message in error or you otherwise are not an authorized recipient, please immediately delete the message and any attachments and notify the sender.




_______________________________________________
icinga-users mailing list
[email protected]  <mailto:[email protected]>
https://lists.icinga.org/mailman/listinfo/icinga-users



-- 
Michael Friedrich, DI (FH)
Application Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected] <mailto:[email protected]>

** OSMC 2014 - November - netways.de/osmc **
** OpenNebula Conf 2014 - Dezember - opennebulaconf.com **
** OSDC 2015 - April - osdc.de **
** Puppet Camp Berlin 2015 - April - netways.de/puppetcamp **



_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users


--
DI (FH) Michael Friedrich

[email protected]  || icinga open source monitoring
https://twitter.com/dnsmichi || lead core developer
[email protected]       || https://www.icinga.org/team
irc.freenode.net/icinga      || dnsmichi

_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to