[Linux] 安装grafana并且添加influxdb监控
2023-02-18 15:41:07 时间
安装grafana,官网提供了ubuntu的安装包,直接进行安装
wget https://dl.grafana.com/oss/release/grafana_6.5.1_amd64.deb
dpkg -i grafana_6.5.1_amd64.deb
update-rc.d grafana-server defaults 95 10
service grafana-server start
使用influxdb的http api添加数据和查询数据
添加数据
while true;do curl -i -XPOST 'http://127.0.0.1:8086/write?db=sinamail' --data-binary "webface,ip=10.2.2.1,httpstatus=404 prototype=\"GET /favicon.ico HTTP/1.1\" `date +%s`000000000";done
查询数据
curl -GET 'http://127.0.0.1:8086/query?pretty=true' --data-urlencode "db=sinamail" --data-urlencode "q=SELECT * FROM webface where httpstatus='404'"
添加grafana的influxdb数据源
查询表数据绘制出折线图
{ "xhrStatus": "complete", "request": { "method": "GET", "url": "api/datasources/proxy/1/query", "params": { "db": "sinamail", "q": "SELECT count(\"prototype\") FROM \"webface\" WHERE (\"httpstatus\" = '404') AND time >= now() - 15m GROUP BY time(1m) fill(null)", "epoch": "ms" }, "data": null, "precision": "ms" }, "response": { "results": [ { "statement_id": 0, "series": [ { "name": "webface", "columns": [ "time", "count" ], "values": [ [ 1575211320000, 0 ], [ 1575211380000, 0 ], [ 1575211440000, 0 ], [ 1575211500000, 0 ], [ 1575211560000, 1 ], [ 1575211620000, 0 ], [ 1575211680000, 4 ], [ 1575211740000, 8 ], [ 1575211800000, 0 ], [ 1575211860000, 0 ], [ 1575211920000, 41 ], [ 1575211980000, 8 ], [ 1575212040000, 0 ], [ 1575212100000, 0 ], [ 1575212160000, 0 ], [ 1575212220000, 0 ] ] } ] } ] } }
相关文章
- Golang环境初始化
- 【Django】在大型项目中的django的性能模型字段primary_key
- 【Django】QuerySet以及Pickle 序列化在Django中的深度运用详解
- 【Django】当大型项目采用Django框架对于QueryDict以及模板的表单在Admin 管理工具的使用
- 【Django】聚合在Django的详细解析以及运用在企业级项目里的方法
- Django管理应用程序的高级配置在BookInstance模型的运用【Django】
- 对于Django框架的会话框架的深入研究——在大型项目中使用会话技术【Django】
- centos7安装php7
- Linux CentOS 7下启动、关闭、重启、查看MySQL服务
- phpMyAdmin错误提示解决
- 云原生应用Go语言:你还在考虑的时候,别人已经应用实践
- C++调用Go方法的字符串传递问题及解决方案
- 【云小课】版本管理发展史之Git+——代码托管
- git常用的一些简单命令
- linux系统上国际化失败
- 修改git仓库的远程地址
- 痞子衡嵌入式:在i.MXRT启动头FDCB里调整Flash工作频率也需同步设Dummy Cycle (以IS25WP128为例)
- 《痞子衡嵌入式半月刊》 第 29 期
- 痞子衡嵌入式:从头开始认识i.MXRT启动头FDCB里的lookupTable
- git为单独的仓库设置提交的用户名