您的位置:首页 > 新闻 > 热点要闻 > 免费广告设计网站_网线制作步骤及方法_软广告经典例子_网络推广优化seo

免费广告设计网站_网线制作步骤及方法_软广告经典例子_网络推广优化seo

2025/4/15 11:22:29 来源:https://blog.csdn.net/baidu_35160588/article/details/143486734  浏览:    关键词:免费广告设计网站_网线制作步骤及方法_软广告经典例子_网络推广优化seo
免费广告设计网站_网线制作步骤及方法_软广告经典例子_网络推广优化seo

提前准备

1.centos7环境

主机名操作系统IPCPU内存部署组件端口描述
localhostCentOS 7.3192.168.111.1292核8GBPrometheus Server
Grafana
Node Exporter
Alertmanager
9010
9006
9009
9008、9007

2.防火墙开放端口

port:9010、9009、9008、9007、9006

#开放端口

firewall-cmd --zone=public --add-port=9006-9010/tcp --permanent

firewall-cmd --reload

#查看开放的端口

firewall-cmd --list-all

3.提前download安装包

如下图所示:

PS:如果是联网情况下,可直接使用:wget https://github.com/prometheus/prometheus/releases/download/v2.20.1/prometheus-2.20.1.linux-amd64.tar.gz

Prometheus 部署

安装包准备

[root@localhost prometheus]# cd /home/prometheus/
[root@localhost prometheus]# wget https://github.com/prometheus/prometheus/releases/download/v2.20.1/prometheus-2.20.1.linux-amd64.tar.gz

解压安装包 && 安装

[root@localhost prometheus]# tar -zxf prometheus-2.20.1.linux-amd64.tar.gz
[root@localhost prometheus]# mv prometheus-2.20.1.linux-amd64 /usr/local/prometheus

添加 prometheus 用户

[root@localhost prometheus]# useradd -M -s /sbin/nologin prometheus

创建目录 && 赋权

[root@localhost prometheus]# mkdir -p /data/prometheus
[root@localhost prometheus]# chown -R prometheus:prometheus /usr/local/prometheus /data/prometheus

配置开机启动脚本

[root@localhost prometheus]# vi /usr/lib/systemd/system/prometheus.service

[Unit]
Description=Prometheus
After=network.target

[Service]
Type=simple
Environment="GOMAXPROCS=4"
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/prometheus/prometheus \
  --config.file=/usr/local/prometheus/prometheus.yml \
  --storage.tsdb.path=/data/prometheus \
  --storage.tsdb.retention=30d \
  --web.console.libraries=/usr/local/prometheus/console_libraries \
  --web.console.templates=/usr/local/prometheus/consoles \
  --web.listen-address=0.0.0.0:9010 \
  --web.read-timeout=5m \
  --web.max-connections=10 \
  --query.max-concurrency=20 \
  --query.timeout=2m \
  --web.enable-lifecycle
PrivateTmp=true
PrivateDevices=true
ProtectHome=true
NoNewPrivileges=true
LimitNOFILE=infinity
ReadWriteDirectories=/data/prometheus
ProtectSystem=full

SyslogIdentifier=prometheus
Restart=always

[Install]
WantedBy=multi-user.target

启动 Prometheus 服务

[root@localhost prometheus]# systemctl daemon-reload && systemctl enable prometheus && systemctl start prometheus
Created symlink from /etc/systemd/system/multi-user.target.wants/prometheus.service to /usr/lib/systemd/system/prometheus.service.

查看 Prometheus 状态

1.systemctl 方式

[root@localhost prometheus]# systemctl status prometheus

2.端口方式

[root@localhost prometheus]# netstat -ntlp | grep 9010

3.web 页面方式


Prometheus 配置

[root@localhost prometheus]# cat /usr/local/prometheus/prometheus.yml | grep -v '^$' | grep -v '^#'

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.
  # scrape_timeout is set to the global default (10s).
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ['192.168.111.129:9010']

Node Exporter 部署

安装包准备

[root@localhost prometheus]# cd /home/prometheus
[root@localhost prometheus]# wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz

解压安装包 && 安装

[root@localhost prometheus]# tar -zxf node_exporter-1.0.1.linux-amd64.tar.gz
[root@localhost prometheus]# mv node_exporter-1.0.1.linux-amd64 /usr/local/node_exporter

Node Exporter 目录赋权

[root@localhost prometheus]# chown -R prometheus:prometheus /usr/local/node_exporter

配置开机启动脚本

[root@localhost prometheus]# vi /usr/lib/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/local/node_exporter/node_exporter \
  --web.listen-address=0.0.0.0:9009 \
  --web.telemetry-path=/metrics \
  --log.level=info \
  --log.format=logfmt
Restart=always

[Install]
WantedBy=multi-user.target

启动 Node Exporter 服务

[root@localhost prometheus]# systemctl daemon-reload && systemctl enable node_exporter && systemctl start node_exporter
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.

查看 Node Exporter 状态

1.systemctl 方式

[root@localhost prometheus]# systemctl status node_exporter


2.端口方式

[root@localhost prometheus]# netstat -ntlp | grep 9009


Prometheus 监控 Node Exporter 配置

# 修改前
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['192.168.111.129:9010']

# 修改后
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['192.168.111.129:9010']

  - job_name: 'node'
    static_configs:
      - targets: ['192.168.111.129:9009']]

重启 Prometheus

[root@localhost prometheus]# systemctl restart prometheus

Web 页面验证

AlertManager 部署

安装包准备

[root@localhost prometheus]# cd /home/prometheus/
[root@localhost prometheus]# wget https://github.com/prometheus/alertmanager/releases/download/v0.21.0/alertmanager-0.21.0.linux-amd64.tar.gz

解压安装包 && 安装

[root@localhost prometheus]# tar -zxf alertmanager-0.21.0.linux-amd64.tar.gz 
[root@localhost prometheus]# mv alertmanager-0.21.0.linux-amd64 /usr/local/alertmanager

AlertManager 数据目录创建 && 目录赋权

[root@localhost prometheus]# mkdir /usr/local/alertmanager/data
[root@localhost prometheus]# chown -R prometheus:prometheus /usr/local/alertmanager

配置开机启动脚本

[root@localhost prometheus]# vi /usr/lib/systemd/system/alertmanager.service

[Unit]
Description=Alertmanager
After=network.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/local/alertmanager/alertmanager \
  --config.file=/usr/local/alertmanager/alertmanager.yml \
  --storage.path=/usr/local/alertmanager/data \
  --web.listen-address=0.0.0.0:9008 \
  --cluster.listen-address=0.0.0.0:9007 \
  --log.level=info \
  --log.format=logfmt
Restart=always

[Install]
WantedBy=multi-user.target

启动 AlertManager 服务

[root@localhost prometheus]# systemctl daemon-reload && systemctl enable alertmanager && systemctl start alertmanager
Created symlink from /etc/systemd/system/multi-user.target.wants/alertmanager.service to /usr/lib/systemd/system/alertmanager.service.

查看 AlertManager 状态

1.systemctl 方式

[root@localhost prometheus]# systemctl status alertmanager

2.端口方式

[root@localhost prometheus]# netstat -ntlp | grep alertmanager

3.web 方式


Prometheus 监控 AlertManager 配置

# 修改前
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['192.168.111.129:9010']

  - job_name: 'node'
    static_configs:
      - targets: ['192.168.111.129:9009']

# 修改后
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['192.168.111.129:9010']

  - job_name: 'node'
    static_configs:
      - targets: ['192.168.111.129:9009]

  - job_name: 'alertmanager'
    static_configs:
      - targets: ['192.168.111.129
:9008']

重启 Prometheus

[root@localhost prometheus]# systemctl restart prometheus

Web 页面验证


Grafana 部署

安装包准备

[root@localhost prometheus]# cd /home/prometheus/
[root@localhost prometheus]# wget https://dl.grafana.com/oss/release/grafana-7.1.3.linux-amd64.tar.gz



解压安装包 && 安装

[root@localhost prometheus]# tar -zxf grafana-7.1.3.linux-amd64.tar.gz 
[root@localhost prometheus]# mv grafana-7.1.3 /usr/local/grafana

Grafana 目录赋权

[root@localhost prometheus]# mkdir /usr/local/grafana/{data,log}
[root@localhost prometheus]# chown -R prometheus:prometheus /usr/local/grafana

Grafana 配置文件配置

[root@localhost prometheus]# cd /usr/local/grafana/conf/
[root@localhost conf]# cp defaults.ini grafana.ini

[root@localhost conf]# vim grafana.ini

# logs = data/log
logs = log

配置开机启动脚本

[root@localhost grafana]# vi /usr/lib/systemd/system/grafana-server.service 

[Unit]
Description=Grafana instance
Documentation=http://docs.grafana.org
Wants=network-online.target
After=network-online.target
After=postgresql.service mariadb.service mysqld.service

[Service]
Type=simple
User=prometheus
Group=prometheus
WorkingDirectory=/usr/local/grafana
ExecStart=/usr/local/grafana/bin/grafana-server \
    --config=/usr/local/grafana/conf/grafana.ini \
    --pidfile=/usr/local/grafana/grafana-server.pid

Restart=on-failure
LimitNOFILE=10000
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

启动 Grafana 服务

[root@localhost prometheus]# systemctl daemon-reload && systemctl enable grafana-server && systemctl start grafana-server
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.

查看 Grafana 状态

systemclt 方式

[root@localhost conf]# systemctl status grafana-server

端口方式

[root@prometheus conf]# netstat -ntlp | grep grafana-serve

web 方式

Grafana操作

1. 初次登录 – 更改密码

2. Grafana 导入 Prometheus 数据
settings --> Data Sources --> Add data Source-->Select Prometheus-->Prometheus URL Setting


Grafana Dashboards Import:Dashboards --> Manage --> Import

遇到的问题

1.安装prometheus时报Failed at step NAMESPACE spawning /usr/local/prometheus

原因分析:可能是内存不足或者文件夹权限问题 (prometheus的数据目录开始定义在了/home/data/develop/prometheus/data,后面改成了/data/prometheus就好了)

2.Grafana端口修改

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com