Last active
April 29, 2025 02:55
-
-
Save NotYusta/a0aa75ccd11f8966ececd50916a08be2 to your computer and use it in GitHub Desktop.
Install Node Exporter Firewall
This file contains hidden or 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
#!/bin/sh | |
# Function to download and extract cadvisor | |
install_cadvisor() { | |
curl -sLo /bin/node-exporter https://github.com/google/cadvisor/releases/download/v0.52.1/cadvisor-v0.52.1-linux-amd64 | |
chmod +x /bin/node-exporter | |
} | |
# Function to create systemd service for cadvisor | |
create_systemd_service() { | |
cat <<EOF > /etc/systemd/system/cadvisor.service | |
[Unit] | |
Description=Prometheus Node Exporter | |
After=network.target | |
[Service] | |
ExecStart=/bin/node-exporter | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
} | |
# Function to enable and start the service | |
start_service() { | |
systemctl daemon-reload | |
systemctl enable cadvisor --now | |
} | |
# Main function that calls other functions | |
main() { | |
install_cadvisor | |
create_systemd_service | |
start_service | |
} | |
# Run the main function | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment