• systemctl启动prometheus+grafana环境


    https://blog.csdn.net/qq_20042935/article/details/124324441

    01 配置文件
    在/usr/lib/systemd/system目录新增4个配置文件,分别为:

     pushgateway.service文件,内容如下:

    [Unit]
    Description=Prometheus Push Gateway
    After=network.target

    [Service]
    ExecStart=/opt/prometheus_env/pushgateway-1.4.2.linux-amd64/pushgateway

    User=root
    [Install]
    WantedBy=multi-user.target

    node_exporter.service文件,内容如下:

    [Unit]
    Description=Prometheus Node Exporter
    After=network.target

    [Service]
    ExecStart=/opt/prometheus_env/node_exporter-1.3.1.linux-amd64/node_exporter

    User=root
    [Install]
    WantedBy=multi-user.target

    ③ prometheus.service文件,内容如下:

    [Unit]
    Description=Prometheus Service
    After=network.target

    [Service]
    ExecStart=/opt/prometheus_env/prometheus-2.34.0.linux-amd64/prometheus \
    --config.file=/opt/prometheus_env/prometheus-2.34.0.linux-amd64/prometheus.yml \
    --web.read-timeout=5m \
    --web.max-connections=10 \
    --storage.tsdb.retention=15d \
    --storage.tsdb.path=/prometheus/data \
    --query.max-concurrency=20 \
    --query.timeout=2m

    User=root
    [Install]
    WantedBy=multi-user.target

     grafana.service文件,内容如下:

    [Unit]
    Description=Grafana
    After=network.target

    [Service]
    ExecStart=/opt/prometheus_env/grafana-8.4.7/bin/grafana-server \
    --config=/opt/prometheus_env/grafana-8.4.7/conf/defaults.ini \
    --homepath=/opt/prometheus_env/grafana-8.4.7

    [Install]
    WantedBy=multi-user.target

    0systemctl命令
    重载配置:

    systemctl daemon-reload

    开启服务:

    systemctl start pushgateway
    systemctl start node_exporter
    systemctl start prometheus
    systemctl start grafana

    设置开机启动:

    systemctl enable pushgateway
    systemctl enable node_exporter
    systemctl enable prometheus
    systemctl enable grafana
    查看服务状态:

    systemctl status pushgateway

     其它命令
    开启端口,能被浏览器访问(例如开启:3000)

    firewall-cmd --zone=public --add-port=3000/tcp --permanent

    重启防火墙:

    firewall-cmd --reload

  • 相关阅读:
    详解vue生命周期
    浅谈前端中的mvvm与mvc
    实际项目开发需要注意的tips
    toFixed()一不小心踩了一个坑
    git学习(持续踩坑中🤣)
    webpack基础
    创建git仓库并发布
    注册npm账号
    Invalid left-hand side in assignment
    关于项目中js原型的使用
  • 原文地址:https://www.cnblogs.com/cheyunhua/p/16401009.html
Copyright © 2020-2023  润新知