监控工具之---Prometheus 安装详解(三)

Prometheus安装

  在centos、ubuntu等系统上安装步骤如下:

  下载prometheus最新安装包

# wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz

   将下载好的安装进行解压

# tar xf prometheus-2.5.0.linux-amd64.tar.gz

   将安装文件中的执行文件放到/usr/local/bin/目录下,方便命令可以直接执行(可选)

# cp prometheus-2.5.0.linux-amd64/{prometheus,promtool} /usr/local/bin/

   使用promtool命令可以查看prometheus配置文件语法格式是否正确

# promtool check config /opt/prometheus-2.12.0.linux-amd64/prometheus.yml

   通过docker安装

# docker run -d -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

Node exporter安装

  安装Node exporter最新安装包

# wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz

   将下载的安装包进行解压

# tar -xf node_exporter-0.18.1.linux-amd64.tar.gz

   进入到解压后的安装包,将执行命令cp到/usr/local/bin目录下

# cp node_exporter /usr/local/bin/

 启动服务方法

  方法一:使用screen命令进行启动

# screen
进入到prometheus或是node_exporter安装目录,将服务启动起来
root@Prometheus:/opt/node_exporter-0.18.1.linux-amd64# screen -ls
There are screens on:
        13286.pts-0.Prometheus  (09/10/2019 09:52:46 AM)        (Detached)
        13129.pts-0.Prometheus  (09/10/2019 09:50:09 AM)        (Detached)
2 Sockets in /run/screen/S-root.
#在此进入程序后台,可以通过screen -r 13286,退出后台,ctrl+ad,退出后台并结束进程ctrl+d

   方法二:使用daemonize方式

猜你喜欢

转载自www.cnblogs.com/weidongliu/p/11496087.html