I'm trying to make an action_url which will dynamically link from IcingaWeb2 to Grafana graphs. I have it working up to a point, but I'd like to add another variable...the $SERVICECHECKCOMMAND$ service.check_command variable, and it's not working...I assume I need to set that environment variable somewhere?

I'd like this to work:

action_url = "http://grafana-server.example/grafana/dashboard/db/generic-check?var-device=$HOSTNAME$&var-check=$SERVICEDESC$&var-checkmetric=$SERVICECHECKCOMMAND$&var-datatype=perfdata&var-value=value"

$HOSTNAME$ and $SERVICEDESC$ are working.

I've added environment variables to the default template before, but that was for mail host/service notifications, I'm having no luck getting it to work for action_url.

Anyone familiar with where I can set something like:

env = {
    "SERVICECHECKCOMMAND" = "$service.check_command$",
    "SERVICEDESC" = "$service.name$",
    "HOSTNAME" = "$host.name$",
    "SERVICEDISPLAYNAME" = "$service.display_name$",

for action_urls? Or am I looking in the wrong direction?


You cannot really use macros for that, because *_url is a configuration field.

The web interfaces try to do some expansion, but can't handle everything.

I'd recommend something like this in apply Service:

action_url = "http://" + host.name + "/test.cgi?check=" + check_command

Hope that helps

| improve this answer | |
  • That did it, very helpful. And forced me to get using apply rules, which I need to start using. Thanks. – TryTryAgain May 22 '16 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.