]> granicus.if.org Git - icinga2/commitdiff
Add pdv unit to influxdbwriter if not empty + doc 5675/head
authorFabian Röhl <FRoehl@freicon.de>
Fri, 13 Oct 2017 12:54:00 +0000 (14:54 +0200)
committerFabian Röhl <FRoehl@freicon.de>
Fri, 13 Oct 2017 12:54:00 +0000 (14:54 +0200)
refs #5627

doc/14-features.md
lib/perfdata/influxdbwriter.cpp

index fe5761eceeb0abf3d680753d6fc7f52d8bc546e9..7357b1d6ca336d29df153381102e0d48b05c91da 100644 (file)
@@ -269,7 +269,7 @@ expects the InfluxDB daemon to listen at `127.0.0.1` on port `8086`.
 
 Measurement names and tags are fully configurable by the end user. The InfluxdbWriter
 object will automatically add a `metric` tag to each data point. This correlates to the
-perfdata label. Fields (value, warn, crit, min, max) are created from data if available
+perfdata label. Fields (value, warn, crit, min, max, unit) are created from data if available
 and the configuration allows it.  If a value associated with a tag is not able to be
 resolved, it will be dropped and not sent to the target host.
 
index aa35fec0e0a0e17cd23a3f87b41b494afb85014f..9b9bd7410c1836d266d91d004082c028b522b18f 100644 (file)
@@ -264,6 +264,9 @@ void InfluxdbWriter::SendPerfdata(const Dictionary::Ptr& tmpl, const Checkable::
                                if (pdv->GetMax())
                                        fields->Set("max", pdv->GetMax());
                        }
+                       if (!pdv->GetUnit().IsEmpty()) {
+                               fields->Set("unit", pdv->GetUnit());
+                       }
 
                        SendMetric(tmpl, pdv->GetLabel(), fields, ts);
                }