ganglia / ganglia-web

Ganglia Web Frontend
BSD 3-Clause "New" or "Revised" License
316 stars 168 forks source link

check_ganglia_metric.sh - adjust for icinga2 #286

Open bernhardglomm opened 8 years ago

bernhardglomm commented 8 years ago

not a real issue but rather an improvment request (or an hint to evrybody using icinga2): I want to use "check_ganglia_metric.sh" with icinga2. Since the config syntax of icinga2 has changed significantly I needed to do the following adjustments to get it working: tweek check_ganglia_metric.sh:

27,31c27
<       if [[ $ARG =~ .*=$ ]];then
<       CHECK_ARGS=${CHECK_ARGS}"&"${ARG}
<       else
<       CHECK_ARGS=${CHECK_ARGS}${ARG}
<       fi

---
>     CHECK_ARGS=${CHECK_ARGS}"&"${ARG}

in commands.conf add:

object CheckCommand "GangliaCheckShell" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_ganglia_metric.sh" ]
    arguments = {
        "host="               = "$address$"
        "metric_name="  = "$metric$"
        "operator="         = "$operator$"
        "critical_value="  = "$critical$"
    }
}

note the "=" INSIDE the key!

now create gangliachecks.conf with:

// check load_one
apply Service "Ganglia load_one" {
    import "ganglia-service"
    check_command = "GangliaCheckShell"
    vars.metric = "load_one"
    vars.critical = "2"
    vars.operator = "more"
    assign where match ("*" , host.name)
}

in templates.conf you add:

template Service "ganglia-service" {
  max_check_attempts = 2
  check_interval = 1m
  retry_interval = 30s
}

that's it, restart icinga2 and you'll get icinga2 checking via ganglia for a load_one higher than 2

hope that helps

regards

b

vvuksan commented 8 years ago

Can you submit a pull request for this ?