天天看點

prometheus專題—(一)環境準備

設定主機名

hostnamectl set-hostname prome-master01


采用公有雲伺服器

172.16.58.78   prome-master01
172.16.58.79   prome-node01

      

設定時區

timedatectl

[root@prometheus_master01 ~]# timedatectl 
      Local time: 六 2021-03-27 22:39:41 CST
  Universal time: 六 2021-03-27 14:39:41 UTC
        RTC time: 六 2021-03-27 14:39:41
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

timedatectl set-timezone Asia/Shanghai      

關閉防火牆 Selinux

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

setenforce 0
sed -i '/^SELINUX/s/enforcing/disabled/' /etc/selinux/config
getenforce      

關閉sshd dns反解

sed -i 's/^#UseDNS yes/UseDNS no/'  /etc/ssh/sshd_config
systemctl restart sshd       

設定國内yum源

mkdir /tmp/yum_repo_bk
/bin/mv -f /etc/yum.repos.d/* /tmp/yum_repo_bk

# 阿裡雲源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# epel源
wget  -O /etc/yum.repos.d/epel-7.repo https://mirrors.aliyun.com/repo/epel-7.repo


yum makecache      

安裝常用指令

yum -y install lrzsz  yum-utils

      

建立資料目錄

# 安裝包目錄
mkdir -pv /opt/tgzs
# 程式目錄
mkdir -pv /opt/app      

設定history檔案ulimint

cat <<EOF >> /etc/profile
export HISTFILESIZE=
export HISTSIZE=
EOF
source /etc/profile      

設定pip

# windows 

%APPDATA%\pip\pip.conf 

先在 windows “檔案資料總管” 位址欄 輸入 %APPDATA% 按回車,打開程式自定義設定檔案夾

然後,建立名為 pip 的檔案夾,用于存放 pip 配置檔案
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com


# linux 
mkdir -pv ~/.pip
cat<< EOF > ~/.pip/pip.conf 
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com
EOF

      

下載下傳prometheus最新版本包

# 位址
# https://github.com/prometheus/prometheus/releases/tag/v2.25.2
# prometheus 
wget -O /opt/tgzs/prometheus-2.25.2.linux-amd64.tar.gz  https://github.com/prometheus/prometheus/releases/download/v2.25.2/prometheus-2.25.2.linux-amd64.tar.gz

# node_exporter
wget -O /opt/tgzs/node_exporter-1.1.2.linux-amd64.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz

# alertmanager
wget -O /opt/tgzs/alertmanager-0.21.0.linux-amd64.tar.gz https://github.com/prometheus/alertmanager/releases/download/v0.21.0/alertmanager-0.21.0.linux-amd64.tar.gz

# pushgateway
wget -O  /opt/tgzs/pushgateway-1.4.0.linux-amd64.tar.gz https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz

# process-exporter
wget -O  /opt/tgzs/process-exporter-0.7.5.linux-amd64.tar.gz https://github.com/ncabatoff/process-exporter/releases/download/v0.7.5/process-exporter-0.7.5.linux-amd64.tar.gz

# blackbox_exporter
wget -O  /opt/tgzs/blackbox_exporter-0.18.0.linux-amd64.tar.gz https://github.com/prometheus/blackbox_exporter/releases/download/v0.18.0/blackbox_exporter-0.18.0.linux-amd64.tar.gz

# redis_exporter
wget -O  /opt/tgzs/redis_exporter-v1.20.0.linux-amd64.tar.gz https://github.com/oliver006/redis_exporter/releases/download/v1.20.0/redis_exporter-v1.20.0.linux-amd64.tar.gz

# mysql_exporter
wget -O  /opt/tgzs/mysqld_exporter-0.12.1.linux-amd64.tar.gz https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz

      

繼續閱讀