prometheus node_exporter部署
curl url | sh 方式:
install.sh
#!/bin/bash
#-------------------VAR------------------------------------------------
ABS_INSTALL_PATH=/usr/local/bin/
ABS_INSTALL_PREFIX=/usr/local/bin/node_exporter
#-------------------FUN------------------------------------------------
install_package(){
if [ -e ${ABS_INSTALL_PREFIX} ];then
echo "====================WARNING====================="
echo "you may have installed node_exporter "
else
yum install wget -y
cd ${ABS_INSTALL_PATH}
wget http://10.0.0.80/envs/yum/prometheus_node_exporter/node_exporter
if [ -e node_exporter ];then
chmod +x node_exporter
groupadd -r prometheus
useradd -r -g prometheus -s /sbin/nologin -M -c "prometheus Daemons" prometheus
cd /usr/lib/systemd/system
wget http://10.0.0.80/envs/yum/prometheus_node_exporter/node_exporter.service
systemctl start node_exporter
systemctl enable node_exporter
else
echo "=node_exporter file not exist"
fi
fi
}
main(){
install_package
}
#-------------------PROGRAM--------------------------------------------
main
node_exporter.service
[Service] User=prometheus Group=prometheus ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target [Unit] Description=node_exporter After=network.target
手动起:
nohup /usr/local/bin/node_exporter --web.listen-address=":9101" &
docker安装
docker run -d --name node_exporter \ --restart=always \ --net="host" \ --pid="host" \ -v "/proc:/host/proc:ro" \ -v "/sys:/host/sys:ro" \ -v "/:/rootfs:ro" \ prom/node-exporter \ --path.procfs=/host/proc \ --path.rootfs=/rootfs \ --path.sysfs=/host/sys \ --collector.filesystem.ignored-mount-points='^/(sys|proc|dev|host|etc)($$|/)' \ --web.listen-address=:19100

浙公网安备 33010602011771号