Decimal to hex then to ascii, on a time series

Hello everyone,

I am running Grafana v10.4.1 in a container on Kubernetes
i am using the OpenNMS Grafana performance data source.

The data is stored as a decimal value and sent to Grafana as a decimal. I want to graph the data on a time series graph. after a bunch of data conversions, I found the data had to be converted from a Decimal to hex and then to Ascii to get a human-readable value.

example of the end result will be ‘10.0%’, ‘25.8%’, etc

yes the percent symbol is included after the conversion

any help would be appreciated.
There is no way for me to change the data source on the NMS side

Thank you in advance

why can’t you just specify units and decimals? why do you need hex/ascii?

1 Like

Hello, the data comes in as Decimal like this ‘52974935093285’ and i need to convert that value to hex and then the hex result to Ascii. like below


decimal to hex

represent this as hex is not a problem and could be done just by changing unit to Hexadecimal:


but as for further conversion I don’t think that would be possible to do in Grafana at the moment

may be you can think of introducing some middleware between your data source and Grafana, i.e. Node-RED

ya thats what i figured but just thought someone else had todo the same. i did find it might be possible with apache echarts but i have looked into it yet. Thanks for assistance on this

yes it can be done with Business Chart leveraging js/ts within it. please post the data as text not an image.

and you want this as a timeseries? but how can that be when you have datetime and some ascii?

The data source is OpenNMS Plugin for Grafana plugin for Grafana | Grafana Labs

yes as a time series and how is why I’m here

this is what is returned in json format. could i not just run the values from fglinkMonitorPacketLoss into js with apache echarts to get the desired results?

{
  "state": "Done",
  "series": [
    {
      "name": "",
      "length": 12,
      "fields": [
        {
          "name": "Time",
          "type": "time",
          "config": {},
          "values": [
            1722017700000,
            1722018000000,
            1722018300000,
            1722018600000,
            1722018900000,
            1722019200000,
            1722019500000,
            1722019800000,
            1722020100000,
            1722020400000,
            1722020700000,
            1722021000000
          ],
          "state": null
        },
        {
          "name": "fgLinkMonitorPacketLoss",
          "type": "number",
          "config": {},
          "values": [
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            3544385881675673600,
            null,
            null,
            null
          ],
          "state": {
            "calcs": {
              "sum": 31899472935081062000,
              "max": 3544385881675673600,
              "min": 3544385881675673600,
              "logmin": 3544385881675673600,
              "mean": 3544385881675673600,
              "last": null,
              "first": 3544385881675673600,
              "lastNotNull": 3544385881675673600,
              "firstNotNull": 3544385881675673600,
              "count": 9,
              "nonNullCount": 9,
              "allIsNull": false,
              "allIsZero": false,
              "range": 0,
              "diff": 0,
              "delta": 0,
              "step": 0,
              "diffperc": 0,
              "previousDeltaUp": true
            }
          }
        }
      ]
    }
  ],

yes you can parse that json (fgLinkMonitorPacketLoss) and do whatever you want in Business Chart (artist formerly known as apache echarts) But you will also need the Time

first pass. then you can manage the data within the code section to do your conversion. plenty of examples here

https://echarts.volkovlabs.io/d/pL5iH7FVk/home?orgId=1&refresh=5s

and docu here