首页 > 其他分享 >Prometheus安装

Prometheus安装

时间:2024-05-23 09:11:46浏览次数:26  
标签:exporter amd64 root apps prometheus Prometheus linux 安装

二进制安装Prometheus-server
下载:https://prometheus.io/download/

  • 安装
[root@jgswy-pro packet]# mkdir /data/apps
[root@jgswy-pro packet]# cd /data/apps/
[root@jgswy-pro apps]# ls
prometheus-2.45.5.linux-amd64.tar.gz
[root@jgswy-pro apps]# tar xvf prometheus-2.45.5.linux-amd64.tar.gz
[root@jgswy-pro apps]# ln -sv /data/apps/prometheus-2.45.5.linux-amd64 /data/apps/prometheus
"/data/apps/prometheus" -> "/data/apps/prometheus-2.45.5.linux-amd64"
[root@jgswy-pro apps]# ll
总用量 90516
lrwxrwxrwx. 1 root root       40 5月  21 10:03 prometheus -> /data/apps/prometheus-2.45.5.linux-amd64
drwxr-xr-x. 4 1001  127      132 5月   2 17:45 prometheus-2.45.5.linux-amd64
-rw-r--r--. 1 root root 92686411 5月  21 09:59 prometheus-2.45.5.linux-amd64.tar.gz
  • 编写service文件
# cat /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target

[Service]
Restart=on-failure
WorkingDirectory=/data/apps/prometheus/
ExecStart=/data/apps/prometheus/prometheus --config.file=/data/apps/prometheus/prometheus.yml --web.enable-lifecycle
[Install]
WantedBy=multi-user.target
  • 启动服务监听9090端口
# systemctl daemon-reload && systemctl restart prometheus && systemctl enable prometheus.service
Created symlink from /etc/systemd/system/multi-user.target.wants/prometheus.service to /etc/systemd/system/prometheus.service.

# ss -tnl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port
LISTEN      0      128                                        *:22                                                     *:*
LISTEN      0      100                                127.0.0.1:25                                                     *:*
LISTEN      0      128                                     [::]:22                                                  [::]:*
LISTEN      0      100                                    [::1]:25                                                  [::]:*
LISTEN      0      128                                     [::]:9090                                                [::]:*

二进制安装node_exporter

[root@jgswy-pro apps]# tar xvf node_exporter-1.8.0.linux-amd64.tar.gz
node_exporter-1.8.0.linux-amd64/
node_exporter-1.8.0.linux-amd64/NOTICE
node_exporter-1.8.0.linux-amd64/node_exporter
node_exporter-1.8.0.linux-amd64/LICENSE
[root@jgswy-pro apps]# ln -sv /data/apps/node_exporter-1.8.0.linux-amd64 /data/apps/node_exporter
"/data/apps/node_exporter" -> "/data/apps/node_exporter-1.8.0.linux-amd64"

[root@jgswy-pro apps]# systemctl daemon-reload && systemctl restart node-exporter && systemctl enable node-exporter.service
Created symlink from /etc/systemd/system/multi-user.target.wants/node-exporter.service to /etc/systemd/system/node-exporter.service.

端口监听9100
# ss -tnl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port
LISTEN      0      128                                        *:22                                                     *:*
LISTEN      0      100                                127.0.0.1:25                                                     *:*
LISTEN      0      128                                     [::]:22                                                  [::]:*
LISTEN      0      100                                    [::1]:25                                                  [::]:*
LISTEN      0      128                                     [::]:9090                                                [::]:*
LISTEN      0      128                                     [::]:9100                                                [::]:*

配置采集node数据

[root@jgswy-pro prometheus]# vi prometheus.yml
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
 
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

rule_files:


scrape_configs:
 
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "prometheus-node"

    static_configs:
      - targets: ["localhost:9100"]


[root@jgswy-pro prometheus]# systemctl restart prometheus
  • 验证

安装grafana
地址:https://grafana.com/grafana/download?pg=get&plcmt=selfmanaged-box1-cta1

# yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-11.0.0-1.x86_64.rpm

# systemctl restart grafana-server && systemctl enable grafana-server
监听端口3000
[root@jgswy-pro prometheus]# ss -tnl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port
LISTEN      0      128                                        *:22                                                     *:*
LISTEN      0      100                                127.0.0.1:25                                                     *:*
LISTEN      0      128                                     [::]:22                                                  [::]:*
LISTEN      0      128                                     [::]:3000                                                [::]:*

安装blackbox_exporter

[root@jgswy-pro apps]# tar xvf blackbox_exporter-0.25.0.linux-amd64.tar.gz
blackbox_exporter-0.25.0.linux-amd64/
blackbox_exporter-0.25.0.linux-amd64/NOTICE
blackbox_exporter-0.25.0.linux-amd64/blackbox_exporter
blackbox_exporter-0.25.0.linux-amd64/LICENSE
blackbox_exporter-0.25.0.linux-amd64/blackbox.yml

[root@jgswy-pro apps]# ln -sv blackbox_exporter-0.25.0.linux-amd64 blackbox_exporter
"blackbox_exporter" -> "blackbox_exporter-0.25.0.linux-amd64"

[root@jgswy-pro apps]# vi /etc/systemd/system/blackbox-exporter.service
[Unit]
Description=Prometheus Blackbox Exporter
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/data/apps/blackbox_exporter/blackbox_exporter \
--config.file=/data/apps/blackbox_exporter/blackbox.yml \
--web.listen-address=:9115
Restart=on-failure
[Install]
WantedBy=multi-user.target


[root@jgswy-pro apps]# systemctl restart blackbox-exporter.service && systemctl enable blackbox-exporter.service

标签:exporter,amd64,root,apps,prometheus,Prometheus,linux,安装
From: https://www.cnblogs.com/OpenSourceSite/p/18203443

相关文章

  • win11安装MySQL
    目录[-]1. 1.下载2. 2.安装 参考文档:https://dev.mysql.com/doc/refman/8.4/en/ 1.下载    mysql官网下载msi安装程序:https://dev.mysql.com/downloads/file/?id=526927 2.安装    运行下载的mis程序,逐步安装。安装模式: complete;  ......
  • Windows中实现将bat或exe文件作为服务_且实现命令行安装、配置、启动、删除服务
    一、背景描述在Windows环境下进行日常的项目开发过程中,有时候需要将bat文件或exe文件程序注册为Windows的服务实现开机自己运行(没有用户登陆,服务在开机后也可以照常运行)、且对于那些没有用户交互界面的exe程序来说只要在后台运行即可,无需在桌面显示该exe程序窗口内容、无......
  • R语言中安装 rgdal 包
     001、R语言中安装 rgdal出现如下报错>install.packages("rgdal")将程序包安装入‘C:/Users/liujiaxin/AppData/Local/R/win-library/4.3’(因为‘lib’没有被指定)Warningininstall.packages:package‘rgdal’isnotavailableforthisversionofRAversi......
  • CentOS 7 安装 nginx-rtmp
    一、安装依赖库1.gcc$gcc-vUsingbuilt-inspecs.COLLECT_GCC=gcc......Threadmodel:posixgccversion4.8.520150623(RedHat4.8.5-44)(GCC)#未安装:yuminstall-ygccgcc-c++2.pcre$rpm-qapcrepcre-8.32-17.el7.x86_64#未安装:yuminstall-y......
  • ROS学习篇1安装(Ubuntu18.04 Bionic +ROS Melodic)
    设置sources.listsudosh-c'echo"debhttp://packages.ros.org/ros/ubuntu$(lsb_release-sc)main">/etc/apt/sources.list.d/ros-latest.list'sudoapt-keyadv--keyserver'hkp://keyserver.ubuntu.com:80'--recv-keyC1CF6E31E6......
  • 【ubuntu】22.04安装Redis Insight及AnotherRedisDesktopManager
    一、RedisInsight1、官网下载https://redis.io/insight/#insight-form  2、安装sudodpkg-iRedisInsight-linux-amd64.deb 3、运行  二、AnotherRedisDesktopManager1、官网下载https://github.com/qishibo/AnotherRedisDesktopManager/releases/tag/v1.......
  • ubuntu(乌班图):阿里云安装源sources.list内容+附件
    #debcdrom:[Ubuntu22.04.4LTS_JammyJellyfish_-Releaseamd64(20240220)]/jammymainrestricted#Seehttp://help.ubuntu.com/community/UpgradeNotesforhowtoupgradeto#newerversionsofthedistribution.debhttp://mirrors.aliyun.com/ubuntu/jammy......
  • CentOS 7安装mediainfo以及ffmpeg工具
    基于CentOS7.9的基础镜像,安装mediainfo以及ffmpeg工具一、安装FROMcentos:centos7.9.2009RUNyuminstallepel-release-yRUNyuminstallmediainfo-yRUNrpm-Uvhhttps://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpmRUNyuminstallf......
  • 如何全程使用docker部署jeecg平台,无需安装开发环境(主要是如何使用Docker来进行Maven打
    在部署jeecg平台时,文档中即使通过docker部署,也需要安装开发环境编译一部分内容,本文记录使用docker替代安装环境的过程。使用docker的目的是在平台选型的过程中,不希望麻烦的安装环境,同时如果选型不满意,无需卸载环境就能恢复一个干净的系统。部署环境:UbuntuServer20.04docker,......
  • 技嘉主板设置U盘启动安装系统方法
    博主以H410MS2为例 开机后按F2键进入BIOS设置界面。 使用左右移动按键找到Boot选项。在Boot选项内找到CSMSupport栏位,将Disabled(关闭)选项改为Enabled(启用)如图所示。 在下面选项栏位找到OtherPCIdevices,将UEFI改为Legacy,按F10保存退出。 开机后按F12选择对应的U盘......