No perfdata when CRITICAL : Plugin timed out

Hello :wave:

We are developing a simple web page on which we’ll have status informations of some hosts.
Perfdata are enabled and are written in a InfluxDB database.

In the host_template we added a tag named state_id :

host_template = {
measurement = "$host.check_command$"
tags = {
  hostname = "$$"
  state_id = "$host.state_id$"

The idea is to get the state id of the host (from doc : The host’s current state. Can be one of 0 (up), 1 (down) and 2 (unreachable).) in InfluxDB and then query IndluxDB to create some graphs.

When the host is reacheable perfdatas are well written in the measurement table “hostalive”. However, when the host isn’t reacheable, perfdatas aren’t written. Indeed, when it’s OK, value for pl and rta exists. But when it isn’t OK (i.e when the script timed out), values don’t exist and thus nothing is written in InfluxDB.

Have you got any idea on how we can get the state_id in InfluxDB even if the host doesn’t answer ?

It might be doable by modifying the check_ping script. Something that we would like not to do.

Regards :+1:



this feature is made for storing performance data from host/service checks within influx.
The default hostalive check is a ping, perfdata is RTT and packetloss, with service checks
it depends on the perfdata output delivered by the check script. These are stored as metrics,
if your check did not deliver a metric while in a critical state then there are no values in influxdb.
Minimum data for influx are timestamp, measurement and field set, tags are optional - but useful.

If you want additional meta data like hoststate or thresholds within influx, you have add
the following lines to influxdb.conf (outside of the template definitions):
enable_send_thresholds = true
enable_send_metadata = true

You can also add custom vars from Icinga2 within the templates which are stored as tags.