Migrating Icinga 2 commands

Dear community,

I try to migrate our self programed checks to implemate in Icinga2.

in Icinga 1.8:

define command{
    command_name    count_citrix_sitzungen
    command_line    $USER5$/count_citrix_sitzungen.sh $HOSTADDRESS$ comunnitystring"$ARG1$"

i migrated it to following:

object CheckCommand  "count_citrix_sitzungen" {
  command = [Plugins + "/count_citrix_sitzungen.sh", "$address$", "comunnitystring", "$service.vars.ARG1$"]

But i want it it like :

object CheckCommand  "count_citrix_sitzungen" {
  command = [Plugins + "/count_citrix_sitzungen.sh"]
arguments ={
vars.xxx = ""

but in this case i dont understand, how i can add there the external Arguments: “$address$”, “comunnitystring”, “$service.vars.ARG1$”

Maybe some one can explain me.

thank y!



a few notes:

  • Avoid using the old ARGn attribute naming schema. Instead, use long names following the check command best practice.
  • Always use command arguments for any given parameter, even if you want to set a default value. This allows for better descriptions and readability and also re-using it in a different context.
object CheckCommand "count_citrix_sitzungen" {
  command = [ PluginDir + "/count_citrix_sitzungen" ]

  arguments = {
    "address" = {
       value = "$count_citrix_sitzungen_host$"
       description = "The citrix host"
       skip_key = true //no key parameter
       order = 1 // the argument order is important
    "continent" = {
      value = "$count_citrix_sitzungen_continent$"
      description = "The continent where the citrix sessions should be monitored"
      order = 2 // after the address

  vars.count_citrix_sitzungen_host = "$address$" // set a default, allow to override on the service level
apply Service "citrix-sitzungen" {
  check_command = "count_citrix_sitzungen"
  vars.count_citrix_sitzungen_continent = "europe"

I’m not sure what value ARG1 describes in your old configuration, I am just guessing that it refers to the continent value. Could also be the count threshold, but that’s up to you to clarify.


1 Like