The function test() should first replace any X in the input string with u and
replace any bla with blubb. Then prepend "bla" and return it. Just some silly
string operations on str.
in the Host object I expect action_url to be in the end:
"blabla uubrrrm blubb"
which is not the case.
Am 28.05.2015 um 14:44 schrieb Daniel Bossert:
> Hi Klaus
>
> I'm a beginner regarding icinga2; however, it would be more helpful also
> for me to understand your code by using real words instead of 'bla' and
> 'blubb' ...
>
> Kind regards
> Daniel
>
> Am 28.05.15 um 14:35 schrieb Klaus Muth:
>> Oh come on! Nobody?
>> Is nobody ever using functions?
>> Are there functions in icinga2 config just to play Hangman over IRC?
>>
>> Am 27.05.2015 um 07:27 schrieb Klaus Muth:
>>> Hi
>>>
>>> I'm trying to define and use a global function in icinga2 and failing
>>> miserable:
>>>
>>> in functions.conf:
>>> function test(str) {
>>> str = str.replace("X", "u")
>>> return "bla"+str.replace("bla", "blubb")
>>> }
>>>
>>> this does reload without error.
>>>
>>> In host object:
>>> object Host "gnarf" {
>>> import "generic-host"
>>> # more config [...]
>>> action_url = "bla" + test("XXbrrrm bla")
>>> }
>>>
>>> gives me a
>>> critical/config: Error: Invalid field access (for value of type 'Host'):
>>> 'test'
>>>
>>> while using {{ test("ökjsöldfk") }} compiles, but gives me an url of "Object
>>> of type 'icinga::Function'" which is not what expected.
>>>
>>> Would you please point me in the right direction?
>>>
>>> BTW: looking at the hangman example didn't help
>>>
>>> Cheers,
>>>
>>
>> Freundliche Grüße
>
>
Freundliche Grüße
--
Klaus Muth
HAGOS eG Industriestr. 62 fon: (+49) 711 78805-7086
EDV-Programmierung 70565 Stuttgart fax: (+49) 711 78805-957035
http://www.hagos.de Germany mailto:[email protected]
HAGOS Verbund deutscher Kachelofen- und Luftheizungsbauerbetriebe eG
Sitz: Stuttgart
Rechtsform: Genossenschaft
Registergericht: Stuttgart GnR 77
Vorstände: Guido Eichel, Ralf Tigges
Aufsichtsratsvorsitzender: Thomas Müller
USt.-ID-Nr.: DE 147799748
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users