Hi there,
is there someone who has an example for a check_by_ssh-Check created with the director? I found some input but nothing really works, everytime getting some errors while deploying the configuration:
can you please share the steps done inside the Director, including screenshots? That command looks “hand made” with DSL function code. Also, please attach the full rendered config from the commands.conf file.
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:
Puh, that’s deep down. I’m on my ipad now, so just a short hint: resolve_arguments() expects specific argument value types (see the docs). It seems that either command or arguments is of the wrong type. You might want to add checks with typeof(command) == Array and log an error and return early if that is not the case.
Thanks for your reply but I’m sorry, I don’t get it…
It seems to be an Array but if I’m honest I don’t really get how I can set exactly that array. I tried it with defining $by_ssh_command$ and $by_ssh_arguments$ as array and also as strings (and every possible combination) but without any difference. I tried to find out what the macro function exactly does but only found a short part in the documentation like " In addition to these variables the macro function can be used to retrieve the value of arbitrary macro expressions" what not really helps me.
Seems like I have to visit the next Director Workshop
Maybe @mfrosch can you help a bit further, in this specific region I lack the knowledge. I’m currently debugging Nessus scan crashes for 2.11 which really needs to be finished
Yes, a simple command line would be enough, at the moment it is only an idea for very old OS which we can not monitor by agent.
How can I define by_ssh_arguments as Dictionary? Maybe this is the important fact, but I can not find some option for this in the Director?
And something more I have forgotten: In a “normal CheckCommand” I everytime could easy define the arguments as fields an use them, but in that special case there is not defined one variable for -C or I only do not understand it