[[inputs.icinga2]] - Services object query - specify specfic host and service

Hello,

It looks like this plugin doesn’t query all services objects including hosts and their services. Is there a way to make it happen?

e.g. https://testicinga.com:5665/v1/objects/services/host-name!icinga

[[inputs.icinga2]]
  ## Required Icinga2 server address
  server = "https://testicinga.com:5665"

  ## Collected Icinga2 objects ("services", "hosts")
  ## Specify at least one object to collect from /v1/objects endpoint.
  # objects = ["services"]
  objects = ["services", "hosts"]

  ## Collect metrics from /v1/status endpoint
  ## Choose from:
  ##     "ApiListener", "CIB", "IdoMysqlConnection", "IdoPgsqlConnection"
  # status = []
  status = ["ApiListener", "CIB", "IdoMysqlConnection"]

  ## Credentials for basic HTTP authentication
  username = "user"
  password = "pass"

Please advise,
Thanks

Hello @samtommy,
Im confused, it should collect data from both object types
since you correctly specified both services and hosts in the objects parameter. Are you finding that its not? Do you have any logs to share? Do you have the right version of telegraf (v1.26.0)? Do you have sufficient permissions?

Hi @Anaisdg Thank you for replying.

I’ve Telegraf v1.34 running. The user has all API permissions.

Ok, I think I was mistaken on the results returned for “objects”. Telegraf does provide the “status” of all of them. I was looking for “performance_data” for services like “icinga”, “cluster” etc. Maybe it is not supported I guess. Please advise. Thank you.

{
                            "counter": false,
                            "crit": null,
                            "label": "num_services_problem",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "uptime",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 517952.94497299194,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_up",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 8,
                            "warn": null
                        },

Let me share your question with the telegraf team, I’m not sure.

1 Like

@samtommy we are currently gathering the endpoints /v1/objects/services and /v1/objects/hosts if both objects are specified. We then should collect the performance data above.
Could you please outline which endpoint you get the data above from and the full (redacted) JSON you get as a response?

1 Like

Here is the “curl” result -

/usr/bin/curl  -k -s -S -u user 'https://testicinga.com:5665/v1/objects/services/testicinga.com!icinga?pretty=1'

https://pastebin.com/W3SdUxZH