mysql - 世界地图面板 Grafana

标签 mysql sql grafana

我的数据:

enter image description here

New York    10
Paris        8
Mumbai      15
Tokya        7
Sydney       8
London      11

我将如何使用grafana中的WorldMap面板绘制上述数据。 我想显示与该位置相对应的值。

最佳答案

参见:

CREATE TABLE `worldmap` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `country_code` varchar(3) NOT NULL,
      `value` INT NOT NULL,
      `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
    and with data like this:

    INSERT INTO `testdata`.`worldmap`
    (`country_code`,
    `value`,
    `timestamp`)
    VALUES
    ('IE',
    3.0,
    now());
    and this query (although it is probably better to do a GROUP BY and sum here rather than using Grafana’s aggregation):

    SELECT
      UNIX_TIMESTAMP(`timestamp`) as time_sec,
      `value` as value,
      country_code as metric
    FROM worldmap
    WHERE $__timeFilter(`timestamp`)
    ORDER BY `timestamp` ASC

关于mysql - 世界地图面板 Grafana,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52946843/

相关文章:

c++ - 包含 MySQLStore.h 但 HAVE_MYSQL 未定义错误(quickfix VS2015 c++)

c# - 从可视化 foxpro 数据源动态获取架构的速度问题

sql - Oracle 计划作业

json - 我希望 Grafana 计算成功与失败 HTTP 响应的比率,并将这两个指标绘制在单个图表中。我怎样才能实现这个目标?

database - InfluxDB:如何回填以前未测量的测量标签(如果可能的话)?

influxdb - 使用来自 Telegraf 的 influxDB 数据在 Grafana 上绘制 CPU 使用率百分比图

mysql - 在 Rails 4.0 中选择标签和多对多关系

mysql - 如何在 mysql 中声明引用多值主键的外键?

php - 标准条件;逻辑转换 (a+b)(c+d) 到 ((w ? x) ? y) ? z

php - mysqli查询多表