grafana咱們這裏採用docker方式部署node
一、下載鏡像docker
鏡像官網地址:https://hub.docker.com/r/grafana/grafana/tagsjson
[root@prometheus-server ~]# docker pull grafana/grafana:latest
二、啓動瀏覽器
[root@prometheus-server ~]# docker run \ -d \ -p 3000:3000 \ --name=grafana \ -v /etc/localtime:/etc/localtime:ro \ grafana/grafana
三、訪問測試
瀏覽器打開http://10.10.0.13:3000,用戶名密碼:adminspa
四、爲Grafana添加Prometheus數據源3d
Name:定義數據源的名字;
URL:Prometheus 服務的IP地址和端口;
其餘保持默認,而後點擊測試並保存。code
五、建立Dashboardserver
5.1 New Dashboardblog
5.2 選擇模型
5.3 添加CPU使用率圖形
5.4 更改標題
其餘默認保存,其它監控項添加相似,下面爲一個完整Dashboard。
注意:
對於Grafana建立Dashboard界面,若是對Grafana不熟悉,咱們能夠從Grafana官網下載對應模板,而後導入再進行簡單修改,以符合本身的監控Dashboard面板。
模板地址:https://grafana.com/dashboards
特別注意由於node_exporter是比較老的組件,有一些dashboard模板都是基於老版本node_exporter開發,因此一些指標名稱有些不同
例如:
* node_cpu -> node_cpu_seconds_total * node_memory_MemTotal -> node_memory_MemTotal_bytes * node_memory_MemFree -> node_memory_MemFree_bytes * node_filesystem_avail -> node_filesystem_avail_bytes * node_filesystem_size -> node_filesystem_size_bytes * node_disk_io_time_ms -> node_disk_io_time_seconds_total * node_disk_reads_completed -> node_disk_reads_completed_total * node_disk_sectors_written -> node_disk_written_bytes_total * node_time -> node_time_seconds * node_boot_time -> node_boot_time_seconds * node_intr -> node_intr_total
導入模板步驟:
一、查找模板
這裏我選用這個node_exporter模板:https://grafana.com/dashboards/8919
而後下載json文件
二、導入模板
三、導入完成後,能夠看到如下Dashboard界面
以上就是現有模板導入的操做,有時候咱們使用別人的模板有些圖不必定會出圖形,這時候咱們須要看下圖形公式是否正確,相應調整便可,更多模板請參考:https://grafana.com/dashboards