Hello together,

I'm struggeling with 2 things about own command definitions.

We have started using individual Checks Script, so we have to define own commands. In general this works fine following to documentation, but I stumpled upon two issues:

* How can I append arguments every time? So we have one plugin which must be always caught with -v. When using

    command = [ PluginDir + "/debug" + "-v"]

it will result in wierd issues about not finding the file "debug-v", including spaces will give the same result with space in the error name. I could use a variable, which is never overwritten, but kind of annoying. Any idea?


* How can I append empty arguments based on a variable content? So I could use 2 different variables, but for this checks it is one of two possible values, so I would like to use only one.

So, if valtest is set to foo, append -foo, if it is set too bar, set -bar.

I have tried with this, but it does not work :/

object CheckCommand "vartest" {
        import "plugin-check-command"

        command = [ PluginDir + "/debug" ]

        arguments = {
                "-foo" = {
                        set_if = {{
                            var srv_vars = service.vars
                            if (srv_vars.valtest == "foo" ) {
                                return true
                            } else {
                                return false
                            }
                        }}
                }
                "-bar" = {
                        set_if = {{
                            var srv_vars = service.vars
                            if (srv_vars.valtest == "bar" ) {
                                return true
                            } else {
                                return false
                            }
                        }}
                }
        }
        vars.valtest = "foo"
}

apply Service "vartest" {
    import "generic-service"

    check_command = "vartest"

    assign where host.name == NodeName

}

Thanks in advance.


Kind regards

Dirk

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to