Skip to content

Commit d390b4a

Browse files
committed
Readme update
Adds an intro text and resizes some of the images.
1 parent fe039c2 commit d390b4a

File tree

7 files changed

+123
-39
lines changed

7 files changed

+123
-39
lines changed

README.md

Lines changed: 123 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,85 @@
1-
## Worldmap Panel Plugin for Grafana
1+
# Worldmap Panel Plugin for Grafana
22

3-
The Worldmap Panel is a tile map of the world that can be overlaid with circles representing data points from a query. It can be used with time series metrics, with geohash data from Elasticsearch or Table Data.
3+
The Worldmap Panel is a tile map of the world that can be overlaid with circles representing data points from a query. It can be used with time series metrics, with geohash data from Elasticsearch or data in the Table format.
44

55
![Worldmap](https://raw.githubusercontent.com/grafana/worldmap-panel/54f83cfdc7339fee02df00933422c35630677330/src/images/worldmap-world.png)
66

7-
There are currently two ways to connect data with points on a map. Either by matching a tag or series name to a country code/state code (e.g. SE for Sweden, TX for Texas) or by using geohashes to map against geographic coordinates.
7+
## How The Worldmap Works (Theory and Examples)
8+
9+
The Worldmap panel needs two sources of data:
10+
11+
- a location (latitude and longitude)
12+
- data that has a link to a location
13+
14+
The data comes from a database query: Prometheus, InfluxDB, Graphite, Elasticsearch, MySQL etc. It can be in the Time Series format or in the Table format.
15+
16+
### Time Series Format
17+
18+
If it is in the **Time Series format** then the metric name needs to match a key from a list of locations. That key is usually a country code or city name. The list of locations can come from a file or an HTTP endpoint.
19+
20+
The list of locations can be provided in several ways:
21+
22+
- json files with locations and their coordinates (the plugin includes list for countries and US states)
23+
- json endpoints that return a list of locations and their coordinates
24+
25+
Time Series data contains a timestamp, a metric name and a numeric value. In other words, a typical query for a time series database. Here is some time series data from Graphite:
26+
27+
```json
28+
[
29+
{"target": "SE", "datapoints": [[183255.0, 1529755200]]},
30+
{"target": "US", "datapoints": [[192224.0, 1529755200]]}
31+
]
32+
```
33+
34+
Location data should be in the JSON format and should be an array of JSON objects with four properties:
35+
36+
```json
37+
[
38+
{
39+
"key": "SE",
40+
"latitude": 60.128161,
41+
"longitude": 18.643501,
42+
"name": "Sweden"
43+
},
44+
{
45+
"key": "US",
46+
"latitude": 37.09024,
47+
"longitude": -95.712891,
48+
"name": "United States"
49+
}
50+
]
51+
```
52+
53+
The Worldmap will then match the metric name (target in the example data) with a key field from the location data. With this example data there will be two circles drawn on the map, one for Sweden and one for the United States with values 183255 and 192224.
54+
55+
### Table Format
56+
57+
If the data is in the **Table format** then it should have a column that is a geohash or two columns that contain the latitude and longitude (together with the columns for the data).
58+
59+
Table data is tabular data with columns and rows. Here is an example of Table data from InfluxDB:
60+
61+
```json
62+
"series": [
63+
{
64+
"name": "logins.count",
65+
"tags": {
66+
"geohash": "9wvfgzurfzb"
67+
},
68+
"columns": [
69+
"time",
70+
"metric"
71+
],
72+
"values": [
73+
[
74+
1529762933815,
75+
75.654324173059
76+
]
77+
]
78+
}
79+
]
80+
```
81+
82+
This query contains both data (the value `75.654324173059`) and a location (the geohash `9wvfgzurfzb` which is in Colorado). So using these, the Worldmap panel will draw one circle in Colorado, USA with the value 75.654324173059.
883

984
## Time Series Data as the Data Source
1085

@@ -14,29 +89,41 @@ Supported Databases:
1489
- InfluxDB
1590
- OpenTSDB
1691
- Prometheus
92+
- MySQL
93+
- Postgres
94+
- MSSQL
1795
- Elasticsearch
1896

19-
Included location data:
97+
The following location files are included in the plugin:
2098

2199
- Countries (2 letter codes)
22100
- Countries (3 letter codes)
23101
- US states
24102

25-
This works by matching country codes (like US or GB or FR) or US state codes (TX or NY) to a node or a wildcard in a metric namespace. If there is a match in the list of countries or states then a circle will be drawn at the location.
103+
Alternatively, you can provide your own location lists by using:
104+
105+
- A JSON endpoint that returns a list of locations
106+
- A JSONP endpoint that returns a list of locations
107+
108+
This works by matching country codes (like US or GB or FR) or US state codes (TX or NY) to a metric name. If a metric name matches a country in the list of countries then a circle will be drawn at that location.
26109

27110
If you want to match to other data than countries or states, then you will have to provide custom location data. The current way to do that is via a JSON endpoint that returns a json file with location data (See Map Data Options)
28111

29112
The size of the circle depends on the value of the matched metric. Circle size is relative e.g. if you have 3 countries with values 1, 2 and 3 or 100, 200 and 300 then you will get one small circle, one medium circle and one large circle.
30113

31-
#### Query Examples
114+
### Time Series - Graphite and InfluxDB
115+
116+
Here are some examples of Time Series Queries
32117

33-
#### Graphite Query for Countries
118+
#### Graphite Query
34119

35120
Use the aliasByNode function to point to the field containing the country code. See the image below for an example of a graphite query.
36121

37122
![Graphite Query for Countries](https://raw.githubusercontent.com/grafana/worldmap-panel/master/src/images/worldmap-timeseries-query.png)
38123

39-
#### Influx Query for Countries
124+
Example dashboard for Worldmap with Graphite queries on [the Grafana play site](http://localhost:3000/d/000000003/worldmap-panels?panelId=8&fullscreen&edit&orgId=1).
125+
126+
#### InfluxDB Query
40127

41128
The Group By clause should be the country code and an alias is needed too. The alias should be in the form `$tag_<field name>`.
42129

@@ -52,7 +139,7 @@ Use a Group By clause on the field containing the country code and a Then by cla
52139

53140
Under the Worldmap tab, choose either the `countries` or `states` option.
54141

55-
![Worldmap Options for Countries](https://raw.githubusercontent.com/grafana/worldmap-panel/master/src/images/countries-option.png)
142+
![Worldmap Options for Countries](/src/images/countries-option.png)
56143

57144
Using a JSON endpoint to return a custom list of locations:
58145

@@ -84,7 +171,6 @@ Three fields need to be provided by the ElasticSearch query:
84171

85172
![Elasticsearch Query for Worldmap](https://raw.githubusercontent.com/grafana/worldmap-panel/master/src/images/es-options.png)
86173

87-
88174
## Table Data as the Data Source
89175

90176
Supported Databases:
@@ -103,40 +189,12 @@ Similar to the Elasticsearch query above, 3 fields are expected (2 of them are m
103189

104190
## JSON result as the Data Source
105191

106-
107-
Supported Databases:
192+
Supported Databases:
108193

109194
- Warp&nbsp;10 via [grafana-warp10-datasource](https://github.com/cityzendata/grafana-warp10) plugin
110195

111196
It supports any datasource capable of generating a JSON response with a a custom list of locations (the same format that for the JSON enpoint).
112197

113-
### Map Visual Option Settings
114-
115-
**Center**
116-
117-
This settings configures the default center of the map. There are 5 centers to choose from or you can choose a custom center or last GeoHash center..For a custom center there are two fields: latitude and longitude. Examples of values are 37.09024, -95.712891 for the center of the US or 55.378051, -3.435973 for Great Britain. Last GeoHash center will centered the map on the last GeoHash received from the data.
118-
119-
120-
**Initial Zoom**
121-
122-
The initial zoom factor for the map. This is a value between 1 and 18 where 1 is the most zoomed out.
123-
124-
**Min Circle Size**
125-
126-
This is minimum size for a circle in pixels.
127-
128-
**Max Circle Size**
129-
130-
This is the maximum size for a circle in pixels. Depending on the zoom level you might want a larger or smaller max circle size to avoid overlapping.
131-
132-
**Unit**
133-
134-
The Unit is shown in the popover when you hover over a circle. There are two fields the singular form and the plural form. E.g. visit/visits or error/errors
135-
136-
**Show Legend**
137-
138-
Shows/hide the legend on the bottom left that shows the threshold ranges and their associated colors.
139-
140198
### Map Data Options
141199

142200
**Location Data**
@@ -168,6 +226,32 @@ Three fields need to be provided by the ElasticSearch query. They are text field
168226
- Location Name is the field that gives the circle a name. If it is blank, then the geohash value is shown in the popover instead of the location.
169227
- geo_point is the GeoHashGrid field that provides the geohash value.
170228

229+
### Map Visual Option Settings
230+
231+
**Center**
232+
233+
This settings configures the default center of the map. There are 5 centers to choose from or you can choose a custom center or last GeoHash center..For a custom center there are two fields: latitude and longitude. Examples of values are 37.09024, -95.712891 for the center of the US or 55.378051, -3.435973 for Great Britain. Last GeoHash center will centered the map on the last GeoHash received from the data.
234+
235+
**Initial Zoom**
236+
237+
The initial zoom factor for the map. This is a value between 1 and 18 where 1 is the most zoomed out.
238+
239+
**Min Circle Size**
240+
241+
This is minimum size for a circle in pixels.
242+
243+
**Max Circle Size**
244+
245+
This is the maximum size for a circle in pixels. Depending on the zoom level you might want a larger or smaller max circle size to avoid overlapping.
246+
247+
**Unit**
248+
249+
The Unit is shown in the popover when you hover over a circle. There are two fields the singular form and the plural form. E.g. visit/visits or error/errors
250+
251+
**Show Legend**
252+
253+
Shows/hide the legend on the bottom left that shows the threshold ranges and their associated colors.
254+
171255
### Threshold Options
172256

173257
Thresholds control the color of the circles.

src/images/countries-option.png

-9.78 KB
Loading

src/images/es-options.png

-11.7 KB
Loading

src/images/influx-query.png

5.32 KB
Loading

src/images/json-endpoint.png

-3.26 KB
Loading

src/images/jsonp-endpoint.png

-6.15 KB
Loading
7.3 KB
Loading

0 commit comments

Comments
 (0)