object CheckCommand "ntopng" {
  command = [ PluginDir + "/check_ntopng.py" ] //constants.conf -> const PluginDir

  arguments = {
    "--host" = {
      value = "$ntopng_host$"
      description = "Address of the host running ntopng"
      required = true
    }
    "--port" = {
      value = "$ntopng_port$"
      description = "Port on which ntopng is listening for connections [default: 3000]"
      required = false
    }
    "--ifid" = {
      value = "$ntopng_interface_id$"
      description = "Id of the ntopng monitored interface where alerts will be searched for"
      required = true
    }
    "--user" = {
      value = "$ntopng_user$"
      description = "Name of an ntopng user"
      required = false
    }
    "--secret" = {
      value = "$ntopng_password$"
      description = "Password to authenticate the ntopng user"
      required = false
    }
    "--checked-host" = {
      value = "$ntopng_checked_host$"
      description = "IP of the host which should be checked for alerts"
      required = true
    }
    "--check-type" = {
      value = "$ntopng_check_type$"
      description = "Which alerts should be checked. Supported: 'host-alerts', 'flow-alerts'"
      required = true
    }
    "--use-ssl" = {
      set_if = "$ntopng_use_ssl$"
      description = "Use SSL to connect to ntopng"
      required = false
    }
    "--unsecure" = {
      set_if = "$ntopng_unsecure_ssl$"
      description = "When SSL is used, ignore SSL certificate verification"
      required = false
    }
    "--perfdata" = {
      value = "$ntopng_perfdata$"
      description = "Icinga2 perfdata of the previous check"
      required = false
    }
    "--timeout" = {
      value = "$ntopng_timeout$"
      description = "Timeout in seconds after which the scripts exits [default: 10s]"
      required = false
    }
  }

  vars.ntopng_host = NtopngHost
  vars.ntopng_port = NtopngPort
  vars.ntopng_interface_id = NtopngInterfaceId
  vars.ntopng_user = NtopngUser
  vars.ntopng_password = NtopngPassword
  vars.ntopng_use_ssl = NtopngUseSsl
  vars.ntopng_unsecure_ssl = NtopngUnsecureSsl
  vars.ntopng_checked_host = "$address$"
  vars.ntopng_perfdata = {{ service.last_check_result.performance_data.join(" ") }}
}
