本文只是用做prometheus监控参考,非全面监控,请各位看官,根据实际环境进行调整。
1 环境准备
#系统环境
root@prometheus113:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
#基础软件安装&ntp时间同步
sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
#刷新源
apt-get update
#安装基础软件
apt install net-tools wget vim bash-completion lrzsz unzip zip ntpdate -y
#ntp时间同步
#修改时区
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate ntp3.aliyun.com
echo "*/3 * * * * ntpdate ntp3.aliyun.com &> /dev/null" > /tmp/crontab
crontab /tmp/crontab
#安装docker
#阿里脚本安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
or
apt install docker -y
apt install docker.io -y
2 配置安装prometheus-本机监控
#创建prometheus.yml,这里放在/data/prometheus文件目录下,这个配置用来监控本机
#vim /data/prometheus/prometheus.yml
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Defaul
evaluation_interval: 15s # Evaluate rules every 15 sec