Last active
November 25, 2021 16:40
-
-
Save sunrise2575/1ef12303c9ff7bb624be1e4260609119 to your computer and use it in GitHub Desktop.
Prometheus Node Exporter 설치 bash 한방 스크립트 (Ubuntu / CentOS 겸용)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIST=$( | |
. /etc/os-release | |
echo $ID | |
) | |
if [[ $DIST == "ubuntu" ]]; then | |
VERSION=$(lsb_release -r | awk '{print $2}' | awk -F . '{print $1$2}') | |
apt install prometheus-node-exporter -y | |
systemctl --now enable prometheus-node-exporter | |
systemctl --now start prometheus-node-exporter | |
fi | |
if [[ $DIST == "centos" ]]; then | |
{ | |
echo '[prometheus]' | |
echo 'name=prometheus' | |
echo 'baseurl=https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch' | |
echo 'repo_gpgcheck=1' | |
echo 'enabled=1' | |
echo 'gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey' | |
echo ' https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm' | |
echo 'gpgcheck=1' | |
echo 'metadata_expire=300' | |
} >/etc/yum.repos.d/prometheus.repo | |
yum install -y node_exporter | |
systemctl --now enable node_exporter | |
systemctl --now start node_exporter | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
prometheus는
/etc/prometheus/prometheus.yml
에서target
을 여러개로 만들 수 있습니다.즉 각 서버에는 prometheus node exporter를 설치하고, 모니터링 서버 1대에만 prometheus를 설치하면 됩니다.