在官網下載windows的Grafana的壓縮包到指定目錄,解壓縮Grafana壓縮文件到包含當前Grafana版本的文件夾。將該文件夾解壓縮到但願Grafana運行的任何位置。進入conf目錄中複製一份sample.ini,並將sample.ini更名爲custom.ini,打開文件custom.ini中,找到custom.ini中的http_port,將其取消註釋(.ini文件中的註釋爲 ; )端口號默認爲3000。php
進入到 bin目錄下,經過執行 grafana-server.exe中的啓動Grafana(最好使用命令行啓動),若是須要將Grafana做爲windows服務進行,則下載NSSM,具體操做,博客: https://www.jianshu.com/p/41b77a1eb7d3node
首次進入Grafana的web頁面,localhost:3000,默認端口號爲3000,端口號能夠修改custom.ini中的http,默認登陸名密碼爲:admin/admin,進入後修改密碼。react
1.檢查服務器配置一個監控。(監控磁盤是否出問題)linux
集羣由 node_exporter 進行監控內存、cpu、磁盤的狀況,能夠經過 ps aux | grep node_exporter 來檢測是否有node_exporter 進程在運行,若是沒有則進行配置。web
瞭解node_exporter的做用:windows
node-exporter用於採集服務器層面的運行指標,包括機器的loadavg、filesystem、meminfo等基礎監控安全
node-exporter由prometheus官方提供、維護,不會捆綁安裝,但基本上是必備的exporter服務器
2.若是沒有監控微信
下載node_exporter架構
1.將node_exporter安裝到linux的/usr/local/node_exporter上
2.$ tar -zxvf 軟件壓縮包
$ mv 軟件名 node_exporter
$ cd node_exporter
$ ./node_exporter & #啓動node_exporter
3.訪問 ip:9000
整個系統以prometheus爲核心,primetheus經過集成pushgateway、alertmanager、grafana、node_exporter來進行一系列的架構。下面爲總體的架構圖:
webhook_configs:
- url: http://------ip----:8080/webhook
- alert: Bigdata_CPU
#告警規則
expr: 100-(avg(irate(node_cpu_seconds_total{
mode=
"idle"
}[5m])) by(instance)* 100) > 80
for
: 1m
labels:
token: {{ .Values.prometheus.prometheusSpec.externalLabels.env }}-bigdata
priority: P0
status: 告警
#告警內容
annotations:
content:
"大數據告警:IPadress:{{`{{$labels.instance}}`}} CPU使用大於80%(目前使用:{{`{{$value}}`}}%)"
title:
"大數據告警:CPU使用大於80%(目前使用:{{`{{$value}}`}}%)"
|
- alert: Bigdata_Memory
expr: 100 - ((node_memory_MemAvailable_bytes
* 100) / node_memory_MemTotal_bytes
) > 80
for
: 1m
labels:
token: {{ .Values.prometheus.prometheusSpec.externalLabels.env }}-bigdata
priority: P0
status: 告警
annotations:
content:
"大數據告警:IPaddress:{{`{{$labels.instance}}`}} 內存使用大於80%(目前使用:{{`{{$value}}`}}%)!"
title:
"大數據告警:內存使用大於80%(目前使用:{{`{{$value}}`}}%)"
|
- alert: Bigdata_System_Disk
expr: 100 - ((node_filesystem_avail_bytes{
mountpoint=
"/"
,fstype!=
"rootfs"
} * 100) / node_filesystem_size_bytes{
mountpoint=
"/"
,fstype!=
"rootfs"
}) > 90
for
: 1m
labels:
token: {{ .Values.prometheus.prometheusSpec.externalLabels.env }}-bigdata
priority: P0
status: 告警
annotations:
content:
"大數據告警:IPadress:{{`{{$labels.instance}}`}},device:{{`{{$labels.device}}`}},mount:{{`{{$labels.mountpoint}}`}} 磁盤分區使用量大於90%(目前使用:{{`{{$value}}`}}%)!"
title:
"大數據告警:{{`{{$labels.mountpoint}}`}} 磁盤分區使用大於90%(目前使用:{{`{{$value}}`}}%)"
|
- alert: Bigdata_Data_Disk
expr: 100 - ((node_filesystem_avail_bytes{
device!~
'rootfs'
,mountpoint=~
"/mnt/.*"
} * 100) / node_filesystem_size_bytes{
device!~
'rootfs'
,mountpoint=~
"/mnt/.*"
}) > 80
for
: 1m
labels:
token: {{ .Values.prometheus.prometheusSpec.externalLabels.env }}-bigdata
priority: P0
status: 告警
annotations:
content:
"大數據告警:IPadress:{{`{{$labels.instance}}`}},device:{{`{{$labels.device}}`}},mount:{{`{{$labels.mountpoint}}`}} 磁盤分區使用大於80%(目前使用:{{`{{$value}}`}}%)"
title:
"大數據告警:{{`{{$labels.mountpoint}}`}} 磁盤分區使用大於80%(目前使用:{{`{{$value}}`}}%)"
|