In fact, our configuration is generated from "pieces". Each host has a
certain amount of properties that describes what it is and how it is used.
What we do is to concatenate one piece of ruby code for each property
(smells like puppet ah ;-) ). For example, I would have these various
pieces:

tpl_header.erb
  object Host "<blabla>" {
    // a few init


tpl_linux.erb
  vars.disks["disk /"] = {
    # something
  }
  vars.disks["other disk"] = {
    # something
  }


tpl_type1.erb
  vars.varsForType1="blabla"

tpl_type2.erb
  vars.varsForType2="toto"

tpl_footer.erb
  }

So if host1 has the properties "linux" and "type1", my config file for it
is tpl_header + tpl_linux + tpl_type1 + tpl_footer

If I don't want type2 to have "other disk" checked, then I just need to
call vars.disk.remove("other disk"). The only drawback with this is that
since the property have no ordered, and it is possible that tpl_type1 is
placed before tpl_linux, I must make the test and the removal in the
tpl_footer...

For your info, each of this tpl_ defines a bool variable with the template
name (e.g. vars.tpl_type1 = True). So all or services are just defined as
"apply where vars.tpl_type1 == true" :-)

I hope it's clear enough :-)








2015-09-04 11:15 GMT+02:00 Michael Friedrich <michael.friedr...@netways.de>:

> Am 04.09.2015 um 11:08 schrieb Christophe HAEN:
>
> What pattern are you speaking about ? You mean for an apply rule ? The
> problem with the apply rule is that the whole Apply-for loop would be
> ignored no ?
>
>
> No. Without any relation to apply rules and whatnot, which pattern or
> equality is it for your nodes? Based on that you may design your
> configuration tree properly afterwards, though I'd like to know before
> making suggestions :)
>
> In the other mail you've said you solved it already - how?
>
> Kind regards,
> Michael
>
>
>
> 2015-09-04 10:40 GMT+02:00 Michael Friedrich <michael.friedr...@netways.de
> >:
>
>> Am 04.09.2015 um 10:30 schrieb Christophe HAEN:
>>
>> Hi,
>>
>> this service-apply-for is a super nice feature, but there is one thing I
>> haven't managed to achieve for this specific case, which is to ignore one
>> partition for one type of host. Suppose that I have zillions of linux nodes
>> that are configured in a very similar way. In my linux template, I could
>> define, say :
>>
>> vars.disks["disk /"] = { disk_partition = "/" }
>> vars.disks["disk /otherDisk"] = { disk_partition = "/otherDisk" }
>>
>> Now, if I have a few specific nodes where /otherDisk should be ignored,
>> is there a way to do that ? The only way I can think of achieving this so
>> far is to set the enable_active_check flag based on an "if" statement, but
>> this is far from satisfying, since the check would be defined anyway.
>>
>>
>> Which pattern matches for these nodes?
>>
>> Kind regards,
>> Michael
>>
>>
>>
>> I couldn't find in the doc a way to remove an entry from a dictionary,
>> which would probably solve that issue.
>>
>> Any advice ?
>>
>> Thanks a lot
>> Chris
>>
>> 2015-09-03 20:48 GMT+02:00 Michael Friedrich <
>> michael.friedr...@netways.de>:
>>
>>> Am 30.08.2015 um 15:20 schrieb Dewangga Bachrul Alam:
>>>
>>>> Hello!
>>>>
>>>> Yes, I use first method and its works, but it's so many lines on
>>>> configuration file (each partition/disk have each configuration), that
>>>> could be defined on array. Any hints to simplify the configuration?
>>>>
>>>
>>> Isn't the default example configuration with service-apply-for rules
>>> what you're looking for?
>>>
>>>
>>> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-icinga2-first-steps#services-conf
>>>
>>>
>>> https://github.com/Icinga/icinga2/blob/master/etc/icinga2/conf.d/hosts.conf#L38
>>>
>>> https://github.com/Icinga/icinga2/blob/master/etc/icinga2/conf.d/services.conf#L65
>>>
>>> That way you may pass additional custom attributes as command parameters
>>> (such as thresholds) directly from the host object itself.
>>>
>>> Kind regards,
>>> Michael
>>>
>>>
>>>
>>>> On 08/30/2015 05:32 PM, Assaf Flatto wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> You have two options: 1) write individual checks for each disk.
>>>>> 2) you the flags of the check_disk plugin :
>>>>>
>>>>>
>>>>> Konsole output
>>>>> -l, --local
>>>>>     Only check local filesystems
>>>>> -L, --stat-remote-fs
>>>>>     Only check local filesystems against thresholds. Yet call stat on
>>>>> remote filesystems
>>>>>     to test if they are accessible (e.g. to detect Stale NFS Handles)
>>>>> -M, --mountpoint
>>>>>     Display the mountpoint instead of the partition
>>>>> -m, --megabytes
>>>>>     Same as '--units MB'
>>>>> -A, --all
>>>>>     Explicitly select all paths. This is equivalent to -R '.*'
>>>>>
>>>>> and that can give you the answer you seek .
>>>>>
>>>>> Assaf
>>>>>
>>>>> On 29/08/15 21:28, Dewangga Bachrul Alam wrote:
>>>>>
>>>>>> Hello!
>>>>>>
>>>>>> I got stuck for monitoring all available partition / disk on my linux
>>>>>> server, got clue from there
>>>>>>
>>>>>> https://github.com/Icinga/icinga2/blob/master/doc/3-monitoring-basics.md,
>>>>>> but
>>>>>> still got nothing.
>>>>>>
>>>>>> The output on icingaweb2 should be print all on array
>>>>>> `disk_partitions = [ "/", "/tmp", "/var", "/home" ]` [1]
>>>>>>
>>>>>> But, the output only show "/", the rest are gone.
>>>>>>
>>>>>> Trying, second alternatives using `vars.disks["disk"] = {}`, got
>>>>>> nothing
>>>>>> too, I got `DISK CRITICAL - /sys/kernel/config is not accessible:
>>>>>> Permission denied`. I've tried to disabling selinux on permissive
>>>>>> mode,
>>>>>> it's not help.
>>>>>>
>>>>>> My goal is want to monitor all available disk/partition on linux
>>>>>> server,
>>>>>> and/or monitor the list of partition on `disk_partitions` array.
>>>>>>
>>>>>> [1]
>>>>>>
>>>>>> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/plugin-check-commands
>>>>>> -- The partition(s). Multiple partitions must be defined as array.
>>>>>>
>>>>>> Any help are appreciated.
>>>>>> Thank you.
>>>>>> _______________________________________________
>>>>>> icinga-users mailing list
>>>>>> icinga-users@lists.icinga.org
>>>>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> icinga-users mailing list
>>>>> icinga-users@lists.icinga.org
>>>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>>>
>>>>> _______________________________________________
>>>> icinga-users mailing list
>>>> icinga-users@lists.icinga.org
>>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>>
>>>
>>>
>>> --
>>> Michael Friedrich, DI (FH)
>>> Senior 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 | michael.friedr...@netways.de
>>>
>>> ** OSBConf 2015 - September - osbconf.org **
>>> ** OSMC 2015 - November - netways.de/osmc **
>>>
>>> _______________________________________________
>>> icinga-users mailing list
>>> icinga-users@lists.icinga.org
>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>>
>>
>>
>>
>> --
>> Christophe HAEN
>> CERN PH-LBC 2/R022
>> Phone : +41 (0)2 27 67 31 25
>> Mobile : +41 (0)7 54 11 88 57
>>
>>
>>
>> _______________________________________________
>> icinga-users mailing 
>> listicinga-users@lists.icinga.orghttps://lists.icinga.org/mailman/listinfo/icinga-users
>>
>>
>>
>> --
>> Michael Friedrich, DI (FH)
>> Senior 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 | <michael.friedr...@netways.de>
>> michael.friedr...@netways.de
>>
>> ** OSBConf 2015 - September - osbconf.org **
>> ** OSMC 2015 - November - netways.de/osmc **
>>
>> _______________________________________________
>> icinga-users mailing list
>> icinga-users@lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>
>>
>
>
> --
> Christophe HAEN
> CERN PH-LBC 2/R022
> Phone : +41 (0)2 27 67 31 25
> Mobile : +41 (0)7 54 11 88 57
>
>
>
> _______________________________________________
> icinga-users mailing 
> listicinga-users@lists.icinga.orghttps://lists.icinga.org/mailman/listinfo/icinga-users
>
>
>
> --
> Michael Friedrich, DI (FH)
> Senior 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 | michael.friedr...@netways.de
>
> ** OSBConf 2015 - September - osbconf.org **
> ** OSMC 2015 - November - netways.de/osmc **
>
> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users
>
>


-- 
Christophe HAEN
CERN PH-LBC 2/R022
Phone : +41 (0)2 27 67 31 25
Mobile : +41 (0)7 54 11 88 57
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to