【问题标题】:Worldmap Panel Grafana世界地图面板格拉法纳
【发布时间】:2018-10-23 10:30:59
【问题描述】:

我的数据:

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

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

【问题讨论】:

    标签: mysql sql grafana


    【解决方案1】:

    见:

    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
    

    【讨论】:

      猜你喜欢
      • 2016-05-07
      • 1970-01-01
      • 2013-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-16
      • 1970-01-01
      相关资源
      最近更新 更多