Prometheus+Granfana
?
二、虛機(服務器)方式
prometheus在虛機(服務器)中安裝運行。
命令行啟動
在安裝完成以后,可以直接在命令行啟動。啟動方式通常是:
./prometheus --config.file=prometheus.yml &
或者
nohup /opt/prometheus/prometheus &
如果要使用不同于9090的端口號,可以在命令行參數(shù)?--web.listen-address中指定,如:
./prometheus --config.file=prometheus.yml --web.listen-address=:8091?&
啟動以后,訪問http://xxx.xxx.xxx.xxx:8091,可以看到,端口確實更改了。
順便說一下,要看prometheus的所有命令行參數(shù),可以執(zhí)行如下命令:
./prometheus -h
服務方式啟動
安裝完成以后,也可以把prometheus配置成自啟動的服務,在其中的配置文件中也可以自定義prometheus的啟動端口。步驟如下:
1. 在 /etc/systemd/system目錄下創(chuàng)建新文件 prometheus.service,其中ExecStart字段指定啟動參數(shù)時,設置自定義端口,內(nèi)容如下:
?--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.執(zhí)行命令:
systemctl start?prometheus.service
如果prometheus在運行,有時候要執(zhí)行如下命令:
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
可見端口已經(jīng)是自定義的端口了。
訪問:http://localhost:8099
?
參考文章:https://blog.csdn.net/palet/article/details/82988100
?
Grafana安裝
下載安裝
官網(wǎng)下載地址: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 {} \;
修改密碼:
執(zhí)行grafana-cli admin reset-admin-password yourpassword
則admin賬號密碼被重置為yourpassword
參考資料:https://blog.csdn.net/kk185800961/article/details/83515382
轉載于:https://www.cnblogs.com/wx170119/p/11301741.html
總結
以上是生活随笔為你收集整理的Prometheus+Granfana的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: “下以防灾孽”下一句是什么
- 下一篇: ubuntu18.04 -- 创建第一个