On Wed, Oct 19, 2016 at 4:27 PM, Antony Stone
<antony.st...@icinga.open.source.it> wrote:
> On Thursday 20 October 2016 at 00:28:21, Michael Martinez wrote:
>
>> I stumbled on the answer myself:
>>
>> servicenames = [ "1", "2" ]
>> for (item in servicenames) {
>>   object Service "prefix" + item use(item) {
>>     get_service(xxxx, item).state
>>   }
>> }
>
> This, for me, begs the questions:
>
> 1. Where is "prefix" defined?

It's an arbitrary string of your choosing. You don't even have to put
anything there. You just need a single string for the service name.
Item itself is a string so you can just use item if you want.

>
> 2. Does this mean the array can only contain numeric values, and not arbitrary
> strings (which might easily be possible for hostname sequences)?

no, the array can contain any strings. Actually the numeric values you
see in my example are strings because they are in double quotes.

>
> 3. What does "xxxx" refer to in your script snippet above?  It doesn't appear
> to correspond to any of your sample attempts below.

It's just a the name of a Host Object. You put whatever host object
you need in there.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to