Grafana配置es数据源问题

    xiaoxiao2021-04-15  328

    最近在使用Grafana对Elasticsearch的数据进行展示问题。下面我将在Grafana中使用Elasticsearch作为数据源绘制网络的IO图以及disk的IO图

    系统为:centos7.x ,ip为:A

    安装grafana

    $ yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm

    将grafana-server添加到系统启动项及启动:

    $ systemctl enable grafana-server.service $ systemctl daemon-reload //#重新载入 systemd,扫描新的或有变动的单元 $ systemctl start grafana-server $ systemctl status grafana-server

    然后在浏览器中输入:http://A:3000,用户和密码都是admin

    es相关

    es相关操作都是在kibnan中操作的 es中新建索引及mapping: PUT /test?pretty //新建索引 POST test/test_type/_mapping //增加mapping,其中必须有一个date类型的字段 { "test_type": { "properties": { "appId": { "type": "keyword" }, "createTime": { "type": "date" }, "detail": { "type": "keyword" }, "ip": { "type": "keyword" }, "level": { "type": "keyword" }, "module": { "type": "keyword" }, "tag": { "type": "keyword" }, "threadName": { "type": "keyword" }, "type": { "type": "keyword" } } } } 向其中插入数据: PUT test/test_type/1 { "createTime": "2019-05-09T11:58:41+0800", "ip": "2345332", "appId": "11000000", "threadName": "Thrad-acceptor-2", "level": "error", "type": "eror", "tag": "ta1", "module": "mdule1", "detail": "soe description" }

    此处的date类型,由于es中默认日期是utc时间,由于utc与北京时间相差8个小时。如果此处仅插入时间,那么在8个小时后才能显示。故此处需要将utc时间改为北京时间。如上插入即是改变之后的。

    grafana界面配置

    首先增加data source,如图所示

    然后增加dashboards,如下图所示


    最新回复(0)