1

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?

TryTryAgain
  • 1,112
  • 4
  • 22
  • 40

1 Answers1

2

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

lazyfrosch
  • 790
  • 4
  • 10