Icinga2 DSL - Typecast?

Hello,

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:
https://icinga.com/docs/icinga2/latest/doc/17-language-reference/#types

1 Like

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

https://icinga.com/docs/icinga2/latest/doc/18-library-reference/#typeof