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?

up vote 1 down vote accepted

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

  • 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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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