Icinga / Icinga/icingaweb2-module-graphite
Problem: Metric with "tilde" not displayed
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 73
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in library/Graphite/Graphing/MetricsQuery.php around line 217 and inspect how metric characters are transformed by the preg_replace. Reproduce the query for the documented test~component metric and verify that the generated Graphite request preserves the tilde and the graph displays correctly. Confirm that the character handling does not break other metric names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100