日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

php接入influxdb,[Linux]安装grafana并且添加influxdb监控

發(fā)布時間:2024/9/15 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php接入influxdb,[Linux]安装grafana并且添加influxdb监控 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

安裝grafana,官網(wǎng)提供了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添加數(shù)據(jù)和查詢數(shù)據(jù)

添加數(shù)據(jù)

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

查詢數(shù)據(jù)

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數(shù)據(jù)源

查詢表數(shù)據(jù)繪制出折線圖

{"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]

]

}

]

}

]

}

}

原文鏈接:https://www.cnblogs.com/taoshihan/p/11968274.html

總結

以上是生活随笔為你收集整理的php接入influxdb,[Linux]安装grafana并且添加influxdb监控的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。