CentOS8 prometheus

CentOS8 prometheus
lsb_release -a

LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.2.2004 (Core)
Release: 8.2.2004
Codename: Core

yum -y install lrzsz

docker 安装

https://docs.docker.com/engine/install/centos/

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl start docker
docker run hello-world
docker version
#设置开机自启
systemctl enable docker
systemctl status docker

安装 node exporter


sudo docker pull prom/node-exporter:v1.7.0
v1.7.0: Pulling from prom/node-exporter
2abcce694348: Pull complete 
455fd88e5221: Pull complete 
324153f2810a: Pull complete 
Digest: sha256:4cb2b9019f1757be8482419002cb7afe028fdba35d47958829e4cfeaf6246d80
Status: Downloaded newer image for prom/node-exporter:v1.7.0
docker.io/prom/node-exporter:v1.7.0

sudo docker run --name=node-exporter --restart=always -p 29100:9100 -v "/proc:/host/proc:ro"  -v "/sys:/host/sys:ro" -v "/:/rootfs:ro"  -d prom/node-exporter:v1.7.0

sudo docker run --name=node-exporter --restart=always -p 29100:9100 -v "/proc:/host/proc:ro"  -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" --hostname=centos8_1  -d prom/node-exporter:v1.7.0

安装 process-exporter

cat process-exporter.yml

process_names:
  - name: "{{.Comm}}"
    cmdline:
    - '.+'

mkdir /data/
sudo chmod -R 777 /data/
cd /data/
mkdir process-exporter

docker pull ncabatoff/process-exporter:0.7.10

0.7.10: Pulling from ncabatoff/process-exporter
2719841c7194: Pull complete 
Digest: sha256:d59ca15dfcb6bb6c462651fddeaa78bd5586d58b7cae09146de272fc793e3c4b
Status: Downloaded newer image for ncabatoff/process-exporter:0.7.10
docker.io/ncabatoff/process-exporter:0.7.10

docker run --restart=always --name zt_process -d  -p 29256:9256 --privileged -v /proc:/host/proc -v /data/process-exporter:/config ncabatoff/process-exporter:0.7.10 --procfs /host/proc -config.path config/process-exporter.yml

阿里云开放端口

https://zhuanlan.zhihu.com/p/643120884?utm_id=0
二、CentOs 7 防火墙开放端口

  1. 查看正在监听的端口和进程信息:

netstat -ntlp

可以看到tomcat/java、nginx、redis、 mysql等进程正在监听的端口,这些接口都需要通过阿里云安全组以及防火墙同时开启接口才能生效,截图如下:

  1. 以开放80端口为例:

开放端口:firewall-cmd --zone=public --add-port=80/tcp --permanent

重启防火墙:systemctl restart firewalld.service

查看已开启的端口信息:

firewall-cmd --list-ports

  1. 防火墙常用命令:

查看防火墙状态,running代表正在运行:
firewall-cmd --state

停止命令

systemctl stop firewalld.service
启动命令
systemctl start firewalld.service
重启命令
systemctl restart firewalld.service

# 查看已经开放的端口
firewall-cmd --zone=public --list-ports
firewall-cmd --list-ports
# 查询指定端口是否已开
sudo firewall-cmd --query-port=8081/tcp
# 开放端口
firewall-cmd --zone=public --add-port=9001/tcp # --permanent 永久生效
# 关闭端口
firewall-cmd --permanent --zone=public --remove-port=22/tcp
# 重启防火墙生效
service firewalld.service restart

解读telnet命令探测端口是否开放用法

https://developer.aliyun.com/article/583263

[root@localhost ~]# telnet 61.135.169.125 80
Trying 61.135.169.125…
Connected to 61.135.169.125 (61.135.169.125).
Escape character is’^]'.
是的,如上显示,这就说明这个地址的80端口是开放的,很简单吧 //进入这个状态,需要按ctrl+c退出即可

1

注明:安装之前检测系统是否有自带的 MySQL。

rpm -qa | grep mysql # 检查是否安装过 MySQL
rpm -qa | grep mariadb # 检查是否存在 mariadb 数据库(内置的 MySQL 数据库),有则强制删除
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64 # 强制删除
rpm -e --nodeps mariadb-5.5.68-1.el7.x86_64 # 强制删除

腾讯云centos8.2下安装mysql8
https://www.cnblogs.com/wanjinliu/p/15234443.html

你可能感兴趣的:(prometheus,linux,运维)