Skip to content

Problem: Metric with "tilde" not displayed #338

@divialth

Description

@divialth

The Icinga GraphiteWriter has written perfdata with a tilde in it name. Icingaweb is not able to display this graph, because the tilde char gets replaced with an _. And with the replaced char, graphite is of course not able to find the metric.

Example on disk:

/var/lib/graphite/whisper/icinga2/server1/services/idrac-hardware-coolingdevice/checkhardware/perfdata/test~component/
/var/lib/graphite/whisper/icinga2/server1/services/idrac-hardware-coolingdevice/checkhardware/perfdata/test~component/fan
/var/lib/graphite/whisper/icinga2/server1/services/idrac-hardware-coolingdevice/checkhardware/perfdata/test~component/fan/speed
/var/lib/graphite/whisper/icinga2/server1/services/idrac-hardware-coolingdevice/checkhardware/perfdata/test~component/fan/speed/value.wsp

In the web interface the graph is then displayed with the "broken" image.
Example Link of the webinterface (note the "tilde" in the string)
https://icinga2/icingaweb2/graphite/graph/service?host.name=server1&service.name=idrac-hardware-coolingdevice&service.check_command=checkhardware&multi1=test~component&multi2=fan&multi3=speed&default_template=multi3-service&start=-86400&end=&width=350&height=200&legend=1

This result to this query in the apache graphite access log:
127.0.0.1 - - [30/Apr/2025:09:07:39 +0000] "GET /metrics/expand?query=icinga2.server1.services.idrac-hardware-coolingdevice.checkhardware.perfdata.test_component.fan.speed.value HTTP/1.1" 200 198 "-" "icingaweb2-module-graphite"
As you can see here tilde got replaced with an underscore.

After a bit debugging I have added the tilde char in the file library/Graphite/Graphing/MetricsQuery.php Line 217 to the preg_replace.
The result is, that the graphs are now display correctly.

I am not sure if this cause other problems, and if it was intentional to not include this char here.
But in my tests so far everything looks good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions