One, install the Go environment
Because Promethues is developed in go language, you must first install a go environment
1. Download the installation package address:
-
Linux :go1.8.3.linux-amd64.tar.gz (86MB)
-
Windows :go1.8.3.windows-amd64.msi (78MB)
-
Mac :go1.8.3.darwin-amd64.tar.gz (85MB)
-
Source: go1.8.3.src.tar.gz (15MB)
2. Unzip
tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz
3. Modify environment variables
vim /etc/profile
添加
export PATH=$PATH:/usr/local/go/bin
刷新配置
source /etc/profile
4. Confirm whether the configuration is good
go version
go version go1.8.3 linux/amd64
Two, install Promethues
1. Download the installation package
Official website link: https://prometheus.io/download/
Choose the latest 2.24.0 linux version: https://github.com/prometheus/prometheus/releases/download/v2.24.0/prometheus-2.24.0.linux-amd64.tar.gz
2. Unzip
tar -vxf prometheus-2.24.0.linux-amd64.tar.gz -C /usr/local/
3. Build a soft chain
ln -sv /usr/local/prometheus-2.24.0.linux-amd64/ /usr/local/prometheus
Three, start Promethues
1. Enter /usr/local/prometheus to start Promethues
Note : It is not recommended to start in the background in this way./prometheus --config.file=prometheus.yml &, this will easily cause the previous data to be lost when Promethues restart
$ vim /etc/systemd/system/prometheus.service
--------------------------------------------------
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /usr/local/prometheus/prometheus.yml \
--storage.tsdb.path /data/prometheus/ \
--web.console.templates=/usr/local/prometheus/consoles \
--web.console.libraries=/usr/local/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
--------------------------------------------------
$ cp /usr/local/prometheus/prometheus /usr/local/bin
$ systemctl start prometheus
$ systemctl status prometheus
2. Use promethues' web default access port 9090 to access on the browser
http://promethuess所在host:9090/classic/graph
If the following screen appears, it means your configuration is successful:
Fourth, use and configure Grafana
Refer to my other two articles:
HDFS & Yarn on Promethues + Grafana monitoring (2)-Promethues data source configuration
HDFS & Yarn on Promethues + Grafana monitoring (3)-Grafana Dashboard configuration (take Yarn as an example)