> On 14 Jul 2016, at 00:17, Michael Martinez <mwt...@gmail.com> wrote:
>
> Hi, thanks for replying.
>
> Actually, I made a mistake typing this. I really mean "check_cluster",
> and I was able to figure it out. It basically takes an argument like
> this, which is passed back to the command:
>
> vars.cluster_data = {{
> get_host("ec2-54-198-210-49.compute-1.amazonaws.com").state
> + "," + get_host("ec2-54-162-245-143.compute-1.amazonaws.com").state }}
>
> (NOTE: "state_id" throws an error, while "state" returns a numeric
> value, so I think the documentation is outdated)
>
> **
> Now I need a way to populate the cluster_data variable with a list of
> hosts that belong to a particular hostgroup. Is there a way to
> programmatically do this in Icinga2?

Something like that - you can lookup the possible language features in the 
documentation.
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/library-reference#array-type
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/library-reference#objref-get_objects
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/language-reference#for-loops


var hg_name = “myhostgroup"
var data = []
for (h in get_objects(Host)) {
  if (hg_name in h.groups) {
    data.add(h.name)
  }
}

return data.join(“,”)


>
>
> On Wed, Jul 13, 2016 at 10:18 AM, Michael Friedrich
> <michael.friedr...@netways.de> wrote:
>> Am 12.07.2016 um 20:30 schrieb Michael Martinez:
>>>
>>> Can someone give an example of how to use check_multi with Icinga2?
>>>
>> I'd write a CheckCommand object based on its --help output. You'll
>> obviously need to pass additional "cmd" file configuration in its own
>> language.
>>
>>
>> AFAIK I did write some wiki articles for Icinga 1.x in early 2012 on
>> check_multi, might be a good starting point.
>>
>>
>> Kind regards,
>>
>> Michael
>>
>>
>> --
>> Michael Friedrich, DI (FH)
>> Senior Developer
>>
>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
>> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
>> CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
>> http://www.netways.de | michael.friedr...@netways.de
>>
>> ** OSBConf 2016 - September - osbconf.org **
>> ** OSMC 2016 - November - netways.de/osmc **
>> _______________________________________________
>> icinga-users mailing list
>> icinga-users@lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>
>
>
> --
> ---
> Michael Martinez
> http://www.michael--martinez.com
> _______________________________________________
> 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
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | michael.friedr...@netways.de

** OSBConf 2016 - September - osbconf.org **
** OSMC 2016 - November - netways.de/osmc **
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to