Example for a check_by_ssh using the Director

Hi,

sorry, I had to delete it to deploy something else and now I can not reproduce it. I’m not sure what I habe made different this time, now I got an error while executen:

Error: Error while evaluating expression: std::bad_cast
Location: in /usr/share/icinga2/include/command-plugins.conf: 2179:16-2179:52
/usr/share/icinga2/include/command-plugins.conf(2177): 
/usr/share/icinga2/include/command-plugins.conf(2178):    var escaped_args = []
/usr/share/icinga2/include/command-plugins.conf(2179):    for (arg in resolve_arguments(command, arguments)) {
                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/share/icinga2/include/command-plugins.conf(2180):     escaped_args.add(escape_shell_arg(arg))
/usr/share/icinga2/include/command-plugins.conf(2181):    }

I first tried it with the two variables defined in /usr/share/icinga2/include/command-plugins.conf:


(tried $by_ssh_arguments$ as string and as array)

Because of the error I tried it with a custom variable vars.command because I’m not sure what the synthax in the command-plugin.conf means:

"-C" = {{
                        var command = macro("$by_ssh_command$")
                        var arguments = macro("$by_ssh_arguments$")

                        if (typeof(command) == String && !arguments) {
                                return command
                        }

                        var escaped_args = []
                        for (arg in resolve_arguments(command, arguments)) {
                                escaped_args.add(escape_shell_arg(arg))
                        }
                        return escaped_args.join(" ")
                }}

grafik

and got the same error.

So it seems like I don’t understand this all and could need an example of someone who has already done something like that.

Thanks, Alicia