Skip to content

Instantly share code, notes, and snippets.

@NotYusta
Last active April 28, 2025 01:31
Show Gist options
  • Save NotYusta/94fecbe4dc76a9e341937367e9362811 to your computer and use it in GitHub Desktop.
Save NotYusta/94fecbe4dc76a9e341937367e9362811 to your computer and use it in GitHub Desktop.
Install Node Exporter Full
#!/bin/sh
set -e # Stop the script if any command fails
TMP_APP_FILE="/tmp/node_exporter_install.sh"
TMP_FW_FILE="/tmp/node_exporter_firewall.sh"
NODE_EXPORTER_APP_URL="https://gist.githubusercontent.com/NotYusta/7f0121db2fb01c60edb3d64ad1b9cd27/raw/dd98f7a7a9ef0dfd552679474a116514a48548ee/install_node_exporter.sh"
NODE_EXPORTER_FW_URL="https://gist.githubusercontent.com/NotYusta/a0aa75ccd11f8966ececd50916a08be2/raw/9884a086c9f55615bab741272340c83214f6d1c3/node_exporter_firewall.sh"
# Prompt user for IP list
echo "Enter IPs separated by commas (e.g., 1.2.3.4,5.6.7.0/24):"
read IP_LIST # Capture the user input
# Fetch and execute node exporter app script, block until finished
curl -sLo "$TMP_APP_FILE" "$NODE_EXPORTER_APP_URL"
curl -sLo "$TMP_FW_FILE" "$NODE_EXPORTER_FW_URL"
# Ensure the firewall script is executable
chmod +x "$TMP_FW_FILE"
chmod +x "$TMP_APP_FILE"
# Execute the firewall script with the provided IP list, block until finished
echo "$IP_LIST" | bash "$TMP_FW_FILE"
# Clean up by removing the firewall script
rm -vf "$TMP_FW_FILE" "$TMP_APP_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment