Icinga2 DSL - Typecast?


I am testing a function that operates on the comparison of two custom vars. The function works well, but the asumption is that the comparison operates on two integers. When I modified one customvar via API, I made the mistake to to set the customvar-integer within " ". After this I got some errors in the logs, because my modified customvar was now a string :wink:

Now to the question:
How can I make sure to compare two integers? Do I have the possibility to typecast variables?

Can this be incorporated to your function and help you sort the issue:

1 Like

Thanks. You pointed me in the right direction.
I think typeof() is what I need: