How to add char $ in arguments of CheckCommand

I check disk usage with centreon_plugins.pl with ‘–regexp --display-transform-src=’(…).*’ and --display-transform-dst=‘$1’ to eliminate the label with garbled code(used_E:\ Label:\xD0¼Ӿ\xED):

$ ./centreon_plugins.pl --plugin=os::linux::snmp::plugin --snmp-version=2c --hostname=192.168.1.129 --snmp-community=public --mode=storage --name
OK: All storages are ok | ‘count’=2;;;0; ‘used_C:\ Label: Serial Number b0a30218’=6006063104B;;;0;42935926784 ‘used_E:\ Label:\xD0¼Ӿ\xED Serial Number 34204dae’=70917488640B;;;0;257695936512

$ ./centreon_plugins.pl --plugin=os::linux::snmp::plugin --snmp-version=2c --hostname=192.168.1.129 --snmp-community=public --mode=storage --name --regexp --display-transform-src=‘(…).*’ --display-transform-dst=‘$1’
OK: All storages are ok | ‘count’=2;;;0; ‘used_C:’=6006063104B;;;0;42935926784 ‘used_E:’=70917488640B;;;0;257695936512

But the char ‘$1’ is Not suitable in conf:

object CheckCommand "check-linux-snmp-disk" {
  import "ipv4-or-ipv6"
  command = [ PluginDir + "/thirdparty/centreon-plugins/centreon_plugins.pl" ]
  arguments = {
    "--plugin" = "os::linux::snmp::plugin"
    "--mode" = "storage"
    "--host" = "$address$"
    "--snmp-community" = "$snmp_community$"
    "--snmp-version" = "$snmpVers$"
    "--warning-usage" = {
      value = "$usage_warning$"
    }
    "--critical-usage" = {
      value = "$usage_critical$"
    }
    "--storage" = {
      value = "$usage_mount$"
    }
    "--regexp" = {
      value = "--regexp"
      skip_key = true
    }
    "--name" = {
      value = "--name"
      skip_key = true
    }
    "--display-transform-src" = {
      value = "(..).*"
    }
/*
    "-display-transform-dst" = {
      value = "$1"
    }
*/
  }
  vars.usage_mount = "^(?!(/dev|/run|/sys|/proc))"
}

Is there any way to apply the argument?

you need to escape $ by another $

‘$1’ => ‘$$1’

2 Likes