Prometheus+Granfana


 

二、虛機(服務器)方式
prometheus在虛機(服務器)中安裝運行。

命令行啟動
在安裝完成以后,可以直接在命令行啟動。啟動方式通常是:

./prometheus --config.file=prometheus.yml &

或者
nohup /opt/prometheus/prometheus &

如果要使用不同於9090的端口號,可以在命令行參數 --web.listen-address中指定,如:

./prometheus --config.file=prometheus.yml --web.listen-address=:8091 &

啟動以后,訪問http://xxx.xxx.xxx.xxx:8091,可以看到,端口確實更改了。

順便說一下,要看prometheus的所有命令行參數,可以執行如下命令:

./prometheus -h

服務方式啟動
安裝完成以后,也可以把prometheus配置成自啟動的服務,在其中的配置文件中也可以自定義prometheus的啟動端口。步驟如下:

1. 在 /etc/systemd/system目錄下創建新文件 prometheus.service,其中ExecStart字段指定啟動參數時,設置自定義端口,內容如下:

 --web.listen-address=:8091

[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System

[Service]
ExecStart=/opt/proe/prometheus-2.3.1.linux-amd64/prometheus \
  --config.file=/opt/proe/prometheus-2.3.1.linux-amd64/prometheus.yml --web.enable-admin-api \
  --web.listen-address=:8091

[Install]
WantedBy=multi-user.target
2.執行命令:

systemctl start prometheus.service

如果prometheus在運行,有時候要執行如下命令:

systemctl daemon-reload

3.驗證prometheus是否在新端口正常啟動:

輸入如下命令:

netstat -lntp | grep prometheus

[root@k8s-node-3 system]# netstat -lntp |grep prometheus
tcp6 0 0 :::8091 :::* LISTEN 11758/prometheus
可見端口已經是自定義的端口了。

訪問:http://localhost:8099

 


參考文章:https://blog.csdn.net/palet/article/details/82988100

 

Grafana安裝

下載安裝

官網下載地址:https://grafana.com/grafana/download?platform=linux
wget https://dl.grafana.com/oss/release/grafana-6.2.5-1.x86_64.rpm 
sudo yum localinstall grafana-6.2.5-1.x86_64.rpm
 

 

默認安裝路徑
# Home=/usr/share/grafana
# Data=/var/lib/grafana
# Logs=/var/log/grafana
# Plugins=/var/lib/grafana/plugins
# Provisioning=/etc/grafana/provisioning
# PidFile=/var/run/grafana/grafana-server.pid
# Config=/etc/grafana/grafana.ini
# DefualtConfig=/usr/share/grafana/conf/defaults.ini


添加到服務並自啟動
/sbin/chkconfig --add grafana-server
systemctl enable grafana-server.service

啟動服務
service grafana-server start

安裝 zabbix 插件
grafana-cli plugins install alexanderzobnin-zabbix-app


查看安裝
rpm -qa | grep grafana
find / -name grafana

清除(卸載)
rpm -e grafana-5.3.2-1.x86_64
find / -name grafana -exec rm -rf {} \;

修改密碼:

執行grafana-cli admin reset-admin-password yourpassword

則admin賬號密碼被重置為yourpassword


參考資料:https://blog.csdn.net/kk185800961/article/details/83515382


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM