grafana-rrd-server icon indicating copy to clipboard operation
grafana-rrd-server copied to clipboard

SimpleJson is deprecated - which plugin to choose

Open AInteriorB opened this issue 2 years ago • 7 comments
trafficstars

SimpleJson is marked as deprecated with the following information:

Angular plugin This data source plugin uses a deprecated, legacy platform based on AngularJS and will stop working in future releases of Grafana.

Do you have any other recommendation for a working plugin?

AInteriorB avatar Nov 17 '23 12:11 AInteriorB

This might be helpful https://github.com/grafana/grafana-infinity-datasource/discussions/740

cnemo-cenic avatar Jun 28 '24 18:06 cnemo-cenic

struggling with this one a bit, as I want to have alerts on smokeping data in my grafana homelab setup...

you should now use this one now, as prev was deprecated long (?) time ago

https://grafana.com/docs/plugins/yesoreyeram-infinity-datasource

examples

https://github.com/grafana/grafana-infinity-datasource/discussions/34 https://github.com/grafana/grafana-infinity-datasource/discussions/740

note that this server expects only POST and at least targets and range fields as required, defined here: https://github.com/doublemarket/grafana-rrd-server/blob/d571c751dab88a04771c619e6c459295d1ac9aea/rrdserver.go#L228-L229 and https://github.com/doublemarket/grafana-rrd-server/blob/d571c751dab88a04771c619e6c459295d1ac9aea/rrdserver.go#L232-L237

looks like it also could have glob in target, see example below

example of request is this:

###############
## URL
###############

http://smokeping-smokeping-rrd-server-1:9000/query

###############
## Curl Command
###############

curl -X 'POST' -d '{
    "targets": [
        {
            "target": "DNSProbes/*:median",
            "refId": "A",
            "hide": false,
            "type": "timeserie"
        }
    ],
    "range": {
        "from": "2024-10-11T15:04:22.044Z",
        "to": "2024-10-13T15:04:22.044Z"
    }
}' -H 'Accept: application/json;q=0.9,text/plain' -H 'Content-Type: application/json' 'http://smokeping-smokeping-rrd-server-1:9000/query'

also see test for query endpoint https://github.com/doublemarket/grafana-rrd-server/blob/d571c751dab88a04771c619e6c459295d1ac9aea/rrdserver_test.go#L93-L117

for grafana request body example, you can try this

{
    "targets": [
        {
            "target": "DNSProbes/*:median",
            "refId": "A",
            "hide": false,
            "type": "timeserie"
        }
    ],
    "range": {
        "from": "${__timeFrom:date}",
        "to": "${__timeTo:date}"
    }
}

__timeFrom is special variable, __timeFrom:date formats it as ISO date, looks like this is expected format by this go server.

See docs:

  • macroses in body json or url: https://grafana.com/docs/plugins/yesoreyeram-infinity-datasource/latest/query/macros/
  • for time formats https://grafana.com/docs/plugins/yesoreyeram-infinity-datasource/latest/query/time-formats/

good luck! :)

ColCh avatar Oct 13 '24 13:10 ColCh

You saved my day :+1 ---- edit: ---

I'm still struggling with time zones.

    "range": {
        "from": "${__timeFrom:date}",
        "to": "${__timeTo:date}"
    }

shifts the start of my data by 2hrs. However, as far as I can see, the easiest thing were just to extend "from" and let the display window cut down to the selected area.

As far as I can see, the only literal format accepted is "2017-01-17T05:14:42.237Z".
Any similiar well known formats yield a message Query processing error - V is undefined

Any clue how I could manipulate time (or other variables) that go into the query body?

wolfgangr avatar Oct 13 '24 19:10 wolfgangr

Any chance to retrieve combined series? a first try yields Query error - ee is null

{
    "targets": [
        {
            "target": "SDM:mySDM_subs1_totalP:Ptot",
            "refId": "A",
            "hide": false,
            "type": "timeserie"
        }
        {
            "target": "SDM:mySDM_subs2_totalP:Ptot",
            "refId": "B",
            "hide": false,
            "type": "timeserie"
        }
    ],
    "range": {
        "from": "${__timeFrom:date}",
        "to": "${__timeTo:date}"
    }
    
}

wolfgangr avatar Oct 13 '24 19:10 wolfgangr

it not works in my case, as it just places array value in same cell

to get it like rows, i used root data path... pretty hacky

(but for proper use, I think it's needed to use InfluxDB in smokeping, not rrd; but I'm too tired with it and this is okay to me for now)

then I used grafana dashboard to store variables of "target" metrics, then just used "repeat" setting of visualization in grafana

image

this is what I have in "target": "target": "${metric}:median"

this comes from this smokeping rrd files structure (I just selected manually 2 values from here):

image

so graph repeats over those variables

image

you can just import my dashboard and play with it, enjoy

(you might need to customize variables, as I added Yandex here, because ... I need to monitor Russian internet segment as well; and you might not need Yandex here. This thing was configured at smokeping config at first place)

dashboard.json

ColCh avatar Oct 13 '24 21:10 ColCh

@wolfgangr for timezone shift, check your server timezone, that macros just takes timezone from server itself. looks like your server uses UTC timezone, and you are in another timezone

ColCh avatar Oct 13 '24 21:10 ColCh

no, actually both machines are running in MEST.
And actually bot machines run the same debian 12.7
oh, and my Browser is on a age old debian 10.whatever, but on MEST, too.

The problem must happen somewhere in the chain WS-OS -Browser -> Grafana (grafana-machine-OS)-> grafana-rrd-server -> rrdtool (-rrdtool-machine-OS) -> grafana-rrd-server -> Grafana -> Browser

I suspect between grafan-rrd-server and rrdtool.
Mabe time zone correction is done twice.


I think in the long run I'll drop the rrd and collect anything in influx via telegraf and mqtt.
It's just a nasty 2hr gap at the left of all charts. But at least I can combine new data with historic ones.

wolfgangr avatar Oct 13 '24 21:10 wolfgangr