How to escape dash in CheckCommand parameter?

  • icinga2 - version: r2.14.2-1
  • Debian Bookworm

Hi

Icinga2 is running fine, but running into an issue when adding a TrueNAS zone. A check is defined as follows (see CheckCommand below)

This does not work, the plugin using this CheckCommand complains about authorization error.

I am pretty sure this is caused by the dash in the authorization token: 1-UQT1PVtxAfxxx****

For TrueNAS experts, if I replace TrueNAS API token with the admin password, all works fine…but that is not what I want…I don’t want to expose my admin password in Icinga2 conf files…and account has close to root access.

I am also not able to change the TrueNAS API toke (afaik), it is always generated with a “digit dash token” format.

I have tried several ways to escape the dash (backslash, token in single quotes; double dash…)

Any ideas how to make this work with TrueNAS tokens?

object CheckCommand "freenas" {
         import "plugin-check-command"
         command = [ PluginDir + "/check_truenas_extended_play.py"  ]

         arguments = {
                 "-H" = "$freenas_host$"
                 "-u" = "$freenas_user$"
                 "-p" = "$freenas_pass$"
                 "-t" = "$freenas_type$"
                 "-nv" = ""

         }

         vars.freenas_host = "$address$"
         vars.freenas_user = "admin"
         vars.freenas_pass = "1-UQT1PVtxAfxxxxxxxxxxxxxxxxxxxxxxxxx"
         vars.freenas_type = "alerts"
}

just for fun, would you like to try to add

print(args.passwd)

to line 581 of your script.

let icinga execute the command, if you see the token in output you can compare the differences with your input

Thanks for the suggestion, I tried it, and I figured out that actually the token was passed on correctly.
Issue was that with a token I should not provide a username.
I tested the command outside Icinga successfully, but overlooked that I was not using the username.

Thanks for the help!