Prometheus + Grafana + worldmap not working

I have set up Blackbox_exporter and Prometheus for ICMP ping latency monitoring, from the Prometheus portal I can see the received data as below.

Element Value
probe_duration_seconds{group=“CT1”,instance=“127.0.0.1:9115”,job=“prometheus”,ping=“219.150.x.x”,state=“singapore”} 0.048388600000000004
probe_duration_seconds{group=“CT1”,instance=“127.0.0.1:9115”,job=“prometheus”,ping=“219.148.x.x”,state=“sydney”} 0.0654866

But when I configured to display the result using worldmap , I can’t make it working, not sure what is wrong so need your help on it.

worldmap is configured as below.

Query: probe_duration_seconds{group=“CT1”}

Endpoint is configured as: https://worldpingdemo.grafana.net/api/plugin-proxy/raintank-worldping-app/api/v2/probes/locations

But there is no circles seen either from Sydney or Singapore.

Just adding some more information, I can generate the graph from the Prometheus portal

And also from the Grafana chart

In the legend format field, I think you need to add: {{state}}. This is the label that the worldmap panel will try to match against the keys in the worldPing endpoint data.

Thanks Daniel,

Thanks for your assistance on this issue. This is actually something I have tried it before, but still with no success. :frowning:

Finally make it working by changing location data to probes and looks like the mentioned json endpoint is not working.

The Probes.json contains the Singapore and Sydney location data

[xianl@fredgrafana data] pwd /var/lib/grafana/plugins/grafana-worldmap-panel/dist/data [xianl@fredgrafana data] cat probes.json

{
“key”: “singapore”,
“latitude”: 1.290270,
“longitude”: 103.851959,
“name”: “Singapore”
},
{
“key”: “south-carolina”,
“latitude”: 33.836082,
“longitude”: -81.163727,
“name”: “South Carolina”
},
{
“key”: “sydney”,
“latitude”: -33.865143,
“longitude”: 151.209900,
“name”: “Sydney”
},

1 Like

Looks like the endpoint works for me. Maybe a firewall problem then?

By the way, you can easily make your own endpoint if you want custom locations rather than the worldPing probe locations.

Thanks Daniel for your assistance and I will make up my own endpoint for this.

I’m sorry for asking question in this post but could you give me hint on how to add json to my worldmap? I’m totaly a noob on these stuff and I don’t know how should I write the url for json and where should I place json file.

best regards

I have simply changing the location data to probes and by modifying the json file located at /var/lib/grafana/plugins/grafana-worldmap-panel/dist/data/probes.json

1 Like

@werookies that’s one way to solve it, especially if it is a static list of probes. Be aware next time you upgrade the plugin then you will lose your changes so save a copy somewhere so you can apply those changes again.

@dorix1990 the problem is that for a website you cannot just place a file somewhere outside of Grafana - you will run into browser security problems. So you can either do the same as the above solution or if you have a webserver (nginx or similar), you can serve a single file:

Think I might add a feature to WorldMap that will read in a custom JSON file. Getting this question quite often.

1 Like

these solutions worked very fine. thanks a lot

@werookies can you provide the format of Data you feed to Grafana?
I have the following structure:
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5
and edited probes.json file:
“{
“key”: “ugkz7”,
“latitude”: 64.5562829,
“longitude”: 40.5962809,
“name”: “ARKHANGELSK”
},
{
“key”: “v04pt”,
“latitude”: 46.3432541,
“longitude”: 47.933211,
“name”: “ASTRAKHAN”
}”
But I can’t make it working with probes.

It looks like you have already calculated geohashes and in that case you do not need the probes.json file. Worldmap has support for geohashes.

Here is an example returning table data from Prometheus:

and the options:

image

The tricky part is knowing that Metric Field should be Value. Definitely room for improvement here in the plugin. (Also this feature was designed for Elasticsearch so the labels need to be changed too)

Could you specify what labels need to be changed?

resultType:"matrix"
result:Array[56]
0:Object
metric:Object
__name__:"all_apps_by_cities"
geohash:"szfy7"
instance:"localhost:8080"
job:"scoring"
values:Array[1]
0:Array[1521640778,1]

For now I’m having following error in console:
anel data error: Error: Missing geohash value
at decodeGeoHash (geohash.js:2)
at eval (data_formatter.js:97)
at Array.forEach ()
at eval (data_formatter.js:95)
at Array.forEach ()
at DataFormatter.setGeohashValues (data_formatter.js:71)
at WorldmapCtrl.onDataReceived (worldmap_ctrl.js:132)
at o.emit (index.js:129)
at t.emit (emitter.ts:13)
at WorldmapCtrl.e.handleQueryResult (metrics_panel_ctrl.ts:297)

With debug I found is JS wollowing thing, but I’m not very good with JS to understand what is happening here.

Sounds like you forgot to change it to table data on the metrics tab.

1 Like

That works just fine, thank you!

1 Like

Hello everyone, I hope you are good.I need your help.I read all topics but I didn’t some things.I have Grafana v6.0.2 ,Prometheus 2.9.2 and WorldMap Plugin.I added datasource Prometheus on the Grafana,I can access to Prometheus on the web interface.Everything is working actualy.But I want add pin for some country or state on the World Map Plugin.I found probes.json on Grafana (/var/lib/grafana/plugin***/data) Should I add some query on the world map? What is the next step? I don’t know.This project very important for me,could you help me pls?