Promethus安装指南

由于Prometheus是go语言写的,所以不需要编译,安装的过程非常简单,仅需要解压然后运行。
Prometheus官方下载地址:https://prometheus.io/download/

安装Prometheus server

# 解压
# tar
xf prometheus-2.4.3.linux-amd64.tar.gz

# 运行
# cd prometheus-2.4.3.linux-amd64/
# ./prometheus --config.file=prometheus.yml

node_exporter安装

# 解压
# tar
xf node_exporter-0.16.0.linux-amd64.tar.gz

# 运行
# cd node_exporter-0.16.0.linux-amd64/
# ./node_exporter

# 验证node_exporter是否安装成功
# curl 127.0.0.1:9100

# 查看性能指标
# curl 127.0.0.1:9100/metrics

配置(关闭之前运行的node_exporter及prometheus)

创建目录

# mkdir /etc/prometheus

# 拷贝上面解压的prometheus.yml文件到/etc/prometheus
# cp /root/prometheus-2.4.3.linux-amd64/prometheus.yml /etc/prometheus/

添加启动脚本

下载地址:https://github.com/youerning/blog/tree/master/prometheus

# cp node-exporter.service /etc/init.d/node-exporter
# cp prometheus.service /etc/init.d/prometheus 
# chmod +x /etc/init.d/node-exporter
# chmod +x /etc/init.d/prometheus

# 创建工作目录(Prometheus的数据会存在这,启动脚本里面我写的是/data)
# mkdir /data

# 启动服务
# service prometheus start
# service node-exporter start

启动prometheus服务如果出现报错:

 start-stop-daemon: command not found

解决方法:

# 安装依赖包
# yum install gcc-c++ ncurses-devel -y

# wget http://ftp.de.debian.org/debian/pool/main/d/dpkg/dpkg_1.17.25.tar.xz
#
tar -xf  dpkg_1.17.25.tar.xz
# cd dpkg-1.17.25
# ./configure
# make
# cd utils
# make 
# cp start-stop-daemon /usr/sbin/
原文地址:https://www.cnblogs.com/yezl/p/9830958.html