Hi

I'm trying to "simplify" my apply rules by using a custom CheckCommand
configured through the director.

More specifically I want to create an "cron os agnostic" check:
On rhel it must run "check_procs -C crond", on debian it must run
"check_procs -C cron"

I got this tip on OSMC, so I'm trying to implement it.  I was told to
add a custom command and to use the Icinga DSL to compute in the
correct argument.

I tried like this:

Icinga Director > Commands > Commands
Then Add:

Command tab:
Command type: Plugin Check Command
Name: cron os agnostic
Imports: empty
Command: check_procs

Fields tab:
I added procs_critical and procs_warning fields (both optional)

Arguments:
Argument name: -C
Value type: Icinga DSL
Value: if ( host.vars.os == "RedHat" ) { "crond" } else {  "cron" }

In the preview I see:
object CheckCommand "cron os agnostic" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_procs" ]
    arguments += {
        "-C" = "if ( host.vars.os == \"RedHat\" ) { \"crond\" } else
{  \"cron\" }"
    }
}

One thing I noticed that Value type (arguments tab) always changes to
String even for the saved DSL value.

When I then apply this command to a service I get this:

Plugin Output
PROCS OK: 0 processes with command name 'if ( host.vars.os == "RedHat"
) { "crond" } else {  "cron" }'


It's not running the DSL for sure.  But how do I fix it?

Thanks in advance,

Rudy

-- 
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Rudy Gevaert                             e-mail: rudy.geva...@ugent.be
Directie ICT, Afdeling Infrastructuur
Groep Systemen                                      tel: +32 9 264 4750
Universiteit Gent                                   fax: +32 9 264 4994
Krijgslaan 281, gebouw S9, 9000 Gent, Belgie               www.UGent.be
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to