首页 > 其他分享 >安装Prometheus

安装Prometheus

时间:2024-05-16 10:07:44浏览次数:11  
标签:opt service -- prometheus aleadminmanager Prometheus systemctl 安装

官网下载地址,获取最新下载URL.

#切换到root用户
sudo -i

#下载prometheus二进制压缩包,可以自定义版本
wget https://github.com/prometheus/prometheus/releases/download/v2.37.6/prometheus-2.37.6.linux-amd64.tar.gz

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

#查看解压后的文件名
ls -l

mkdir /opt/prometheus -p

#移动解压后的文件名到/opt/,并改名prometheus
mv prometheus-2.37.6.linux-amd64/ /opt/prometheus/prometheus

创建一个专门的`prometheus`用户:

useradd -M -s /usr/sbin/nologin prometheus

更改prometheus用户的文件夹权限:

chown prometheus:prometheus -R /opt/prometheus

创建 systemd 服务

cat > /etc/systemd/system/prometheus.service << "EOF"
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network-online.target

[Service]
Type=simple
User=prometheus
Group=prometheus
Restaadmin=on-failure
ExecStaadmin=/opt/prometheus/prometheus/prometheus \
  --config.file=/opt/prometheus/prometheus/prometheus.yml \
  --storage.tsdb.path=/opt/prometheus/prometheus/data \
  --storage.tsdb.retention.time=60d \
  --web.enable-lifecycle

[Install]
WantedBy=multi-user.target
EOF

配置参数解释:

通过/opt/prometheus/prometheus -h查看帮助详情

--config.file=/opt/prometheus/prometheus/prometheus.yml                 #主配置文件
--storage.tsdb.path=/opt/prometheus/prometheus/data                     #数据库存储目录
--web.console.libraries=/opt/prometheus/prometheus/console_libraries    #指定控制台库目录路径
--web.console.templates=/opt/prometheus/prometheus/consoles             #指定控制台模版目录路径
--storage.tsdb.retention=60d                                            #指明数据保留天数,默认15天
--web.enable-lifecycle                                                  #热加载

启动 Prometheus

systemctl daemon-reload
systemctl staadmin prometheus.service
systemctl status prometheus.service
systemctl enable prometheus.service

安装aleadminmanager

下载aleadminmanager

官网下载地址,获取最新下载URL.

下载aleadminmanager二进制压缩包
wget https://github.com/prometheus/aleadminmanager/releases/download/v0.25.0/aleadminmanager-0.25.0.linux-amd64.tar.gz

#解压
tar xf aleadminmanager-0.25.0.linux-amd64.tar.gz

#查看解压后的文件名
ls -l

#移动解压后的文件名到/opt/,并改名为aleadminmanager
mv aleadminmanager-0.25.0.linux-amd64 /opt/prometheus/aleadminmanager

更改aleadminmanager文件夹权限:

chown prometheus:prometheus -R /opt/prometheus/aleadminmanager

创建 systemd 服务

cat >/etc/systemd/system/aleadminmanager.service << "EOF"

[Unit]
Description=Aleadmin Manager
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStaadmin=/opt/prometheus/aleadminmanager/aleadminmanager \
  --config.file=/opt/prometheus/aleadminmanager/aleadminmanager.yml \
  --storage.path=/opt/prometheus/aleadminmanager/data

Restaadmin=always

[Install]
WantedBy=multi-user.target

EOF

启动 aleadminmanager

systemctl daemon-reload
systemctl staadmin aleadminmanager.service
systemctl enable aleadminmanager.service
systemctl status aleadminmanager.service

检查配置

cd /opt/prometheus/prometheus/
./promtool check config prometheus.yml

重启prometheus或重新加载配置文件(二选一)

#重启
systemctl restaadmin prometheus
或:
#重载,需要--web.enable-lifecycle配置,热加载
curl -X POST http://localhost:9090/-/reload

 

标签:opt,service,--,prometheus,aleadminmanager,Prometheus,systemctl,安装
From: https://www.cnblogs.com/rtnb/p/18195419

相关文章

  • 【ubuntu】安装企业微信
    1.下载Wine环境包:            Wine环境包下载地址:http://archive.ubuntukylin.com/software/pool/partner/ukylin-wine_70.6.3.25_amd64.deb 2.下载企业微信(wine)包:            企业微信(wine)包下载地址:http://archive.ubuntukylin.com/software/pool/par......
  • Mac (Intel) brew 安装 rabbitMQ
    一、安装##rabbitmq依赖erlang环境,先安装erlangbrewinstallerlangbrewinstallrabbitmq##安装主要日志(备份)==>Caveats==>erlangManpagescanbefoundin:/usr/local/opt/erlang/lib/erlang/manAccessthemwith`erl-man`,oraddthisdirectoryto......
  • 3D目标检测框架OpenPCDet安装
    一、介绍前面介绍了一些3D点云目标检测的文章,这篇开始介绍一个通用的3D目标检测代码框架,OpenPCDet是一个简单好用的开源框架,主要是针对点云目标检测,集成了很多现有的算法。https://github.com/open-mmlab/OpenPCDet设计模式支持的算法二、安装过程拉取源码gitclo......
  • Delphi DX10.2安装TeeChartPro2022找不到指定文件
    1、显示报错TeeChartProCompilationstarted:2024-05-1517:12:48Win32v25Enterprise(Delphi10.2andC++Builder10.2Update3)(C++)ERRORTee925Thisversionoftheproductdoesnotsupportcommandlinecompiling.TeeUI925Thisversionoftheproductdoe......
  • 接口自动化框架【python+requests+pytest+allure】需要安装的依赖包
    attrs23.2.0certifi2024.2.2cffi1.16.0charset-normalizer3.3.2colorama0.4.6cryptography42.0.5h110.14.0idna3.6iniconfig2.0.0outcome1.3.0.post0packaging24.0pluggy1.4.0pycparser2.21pyOpenSSL24.1.0PySocks1.7.1pytest8.1.1selenium4.2.0sniffio1.3.1......
  • Ubuntu20.04安装MySQL8主从
    ......
  • 零刻SER AMD安装ESXI全过程
    一、刻录esxi镜像镜像自备,我采用的6.5版本。二、寻找正确驱动查询后,网卡驱动为RTL8111/8168/8411。官网找到:Net55-r8168https://vibsdepot.v-front.de/wiki/index.php/Net55-r8168页面最下边下载驱动。三、下载注入驱动工具VMware-PowerCLI-6.5.0下载完毕后安装。四、驱......
  • Debian12安装VNC及novnc
    在安装VNC前,应该先行安装好GUI桌面,我使用的是KDE。安装VNCsudoaptinstalltigervnc-standalone-servertigervnc-commontightvncserver切换到需连接VNC的用户并设置VNC的密码:suuservncpasswd按提示设置好密码后,安装novnc:sudoaptinstallnovnc切换到需连接V......
  • ubuntu 安装 docker 详细步骤(转)
    什么是Docker?Docker是一个免费的开源工具,设计用于在容器中构建、部署和运行应用程序。安装docker的主机是已知的docker引擎。Docker使用操作系统级虚拟化,并提供容器运行时环境。换句话说,Docker也可以被定义为PaaS(平台即服务)工具。因为docker是一个基于守护进程的服......
  • SD安装animatediff插件
    在线地址https://gitcode.net/ranting8323/sd-webui-animatediff在线安装安装完重启下载animatediff专用模型和8个镜头(可选)https://huggingface.co/guoyww/animatediff/tree/main启用Animatediff公司电脑显卡不行,很多东西做不了。更多玩法可以去b站搜一下视频......