Linux下安装grafana并且添加influxdb监控的方法
安装grafana,官网提供了ubuntu的安装包,直接进行安装
wgethttps://dl.grafana.com/oss/release/grafana_6.5.1_amd64.deb dpkg-igrafana_6.5.1_amd64.deb update-rc.dgrafana-serverdefaults9510 servicegrafana-serverstart
使用influxdb的httpapi添加数据和查询数据
添加数据
whiletrue;docurl-i-XPOST'http://127.0.0.1:8086/write?db=sinamail'--data-binary"webface,ip=10.2.2.1,httpstatus=404prototype=\"GET/favicon.icoHTTP/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*FROMwebfacewherehttpstatus='404'"
添加grafana的influxdb数据源
查询表数据绘制出折线图
{
"xhrStatus":"complete",
"request":{
"method":"GET",
"url":"api/datasources/proxy/1/query",
"params":{
"db":"sinamail",
"q":"SELECTcount(\"prototype\")FROM\"webface\"WHERE(\"httpstatus\"='404')ANDtime>=now()-15mGROUPBYtime(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
]
]
}
]
}
]
}
}
总结
以上所述是小编给大家介绍的Linux下安装grafana并且添加influxdb监控的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。