Skip to content

Instantly share code, notes, and snippets.

@f4rx
Last active August 27, 2019 22:25
Show Gist options
  • Select an option

  • Save f4rx/b548c266a0f97d4d95099c75268bbefc to your computer and use it in GitHub Desktop.

Select an option

Save f4rx/b548c266a0f97d4d95099c75268bbefc to your computer and use it in GitHub Desktop.
install prometheus and node exporter centos7
yum install -y wget
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar xvf node_exporter-0.18.1.linux-amd64.tar.gz
cp node_exporter-0.18.1.linux-amd64/node_exporter /usr/local/bin/node-exporter
groupadd node-exporter
useradd -g node-exporter node-exporter
cat > /etc/systemd/system/node-exporter.service << 'EOF'
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node-exporter
Group=node-exporter
Type=simple
ExecStart=/usr/local/bin/node-exporter
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable node-exporter
yum install -y wget
wget https://github.com/prometheus/prometheus/releases/download/v2.12.0/prometheus-2.12.0.linux-amd64.tar.gz
tar xvf prometheus-2.12.0.linux-amd64.tar.gz
cp prometheus-2.12.0.linux-amd64/prometheus /usr/local/bin/
groupadd prometheus
useradd -g prometheus -d /var/lib/prometheus/ -m prometheus
cat > /etc/systemd/system/prometheus.service << 'EOF'
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yaml \
--storage.tsdb.path /var/lib/prometheus
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable prometheus
mkdir /etc/prometheus/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment