prometheus安装全过程

Posted tengfei520

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了prometheus安装全过程相关的知识,希望对你有一定的参考价值。

#安装prometheus

技术图片
wget https://github.com/prometheus/prometheus/releases/download/v2.5.0/prometheus-2.5.0.linux-amd64.tar.gz
tar -xvf prometheus-2.5.0.linux-amd64.tar.gz
cd prometheus-2.5.0.linux-amd64/
mv * /home/work/prometheus/
cd /home/work/prometheus/
mkdir {data,cfg,logs,bin} -p
mv prometheus promtool bin/
mv prometheus.yml cfg/
vim /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/bin/prometheus --config.file=/home/work/prometheus/cfg/prometheus.yml --storage.tsdb.path=/home/work/prometheus/data
Restart=on-failure

[Install]
WantedBy=multi-user.target

vim /home/work/prometheus/cfg/prometheus.yml
View Code

 

#安装node_exporter

技术图片
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.darwin-amd64.tar.gz
tar -zxvf node_exporter-0.17.0-rc.0.linux-amd64.tar.gz -C cd /home/work/prometheus/
cd /home/work/prometheus/
mv node_exporter-0.17.0-rc.0.linux-amd64 node_exporter
vim /etc/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
View Code

 

#安装grafana

技术图片
wget https://dl.grafana.com/oss/release/grafana-6.1.3-1.x86_64.rpm 
yum -y localinstall grafana-6.1.3-1.x86_64.rpm
View Code

 


#安装alertmanager

技术图片
wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz 
tar -xvf alertmanager-0.20.0.linux-amd64.tar.gz -C /home/work/prometheus/ 
cd /home/work/prometheus/ && mv alertmanager-0.20.0.linux-amd64/ alertmanager 
cd alertmanager/ 
mkdir {bin,cfg,data} 
mv alertmanager amtool bin/ 
mv alertmanager.yml cfg/ 
vim /usr/lib/systemd/system/alertmanager.service 
[Unit]
Description=alertmanager
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root
ExecStart=/home/work/prometheus/alertmanager/bin/alertmanager --config.file=/home/work/prometheus/alertmanager/cfg/alertmanager.yml --web.listen-address=10.10.2.17:9093 --cluster.listen-address=0.0.0.0:8001 --storage.path=/home/work/prometheus/alertmanager/data --log.level=info
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
View Code

 

#安装pushgateway

技术图片
wget https://github.com/prometheus/pushgateway/releases/download/v1.0.1/pushgateway-1.0.1.linux-amd64.tar.gz
tar xzvf pushgateway-1.0.1.linux-amd64.tar.gz
mv pushgateway-1.0.1.linux-amd64 /home/work/prometheus/pushgateway
./pushgateway &
View Code

 

以上是关于prometheus安装全过程的主要内容,如果未能解决你的问题,请参考以下文章

k8s 安装 prometheus 过程记录

prometheus配置详解

Prometheus 2.17.0 新特性

Prometheus 2.17.0 新特性

zabbix 集成 prometheus 数据

prometheus自定义metrics