Files
homelab-docs/install-node-exporters.sh

58 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Install node_exporter on hosts missing monitoring
# Run this from your PC/terminal
echo "🚀 Installing node_exporter on missing hosts..."
echo ""
# 1. pve-router (10.0.10.2)
echo "📦 Installing on pve-router (10.0.10.2)..."
ssh root@10.0.10.2 "apt update && apt install prometheus-node-exporter -y && systemctl enable --now prometheus-node-exporter"
if [ $? -eq 0 ]; then
echo "✅ pve-router node_exporter installed and running"
else
echo "❌ Failed to install on pve-router"
fi
echo ""
# 2. OVH Gaming VPS (51.222.12.162)
echo "📦 Installing on vps-gaming (51.222.12.162)..."
ssh root@51.222.12.162 "apt update && apt install prometheus-node-exporter -y && systemctl enable --now prometheus-node-exporter && ufw allow 9100/tcp"
if [ $? -eq 0 ]; then
echo "✅ vps-gaming node_exporter installed and running"
else
echo "❌ Failed to install on vps-gaming"
fi
echo ""
# 3. OpenClaw Container (10.0.10.41) - Install on myself!
echo "📦 Installing on OpenClaw container (10.0.10.41)..."
ssh root@10.0.10.41 "apt update && apt install prometheus-node-exporter -y && systemctl enable --now prometheus-node-exporter"
if [ $? -eq 0 ]; then
echo "✅ OpenClaw node_exporter installed (self-monitoring enabled!)"
else
echo "❌ Failed to install on OpenClaw"
fi
echo ""
# Verify all targets
echo "🔍 Verifying node_exporter endpoints..."
echo ""
echo "pve-router:"
curl -s -m 2 http://10.0.10.2:9100/metrics | head -3 || echo "❌ Not responding"
echo ""
echo "vps-gaming:"
curl -s -m 2 http://51.222.12.162:9100/metrics | head -3 || echo "❌ Not responding"
echo ""
echo "OpenClaw:"
curl -s -m 2 http://10.0.10.41:9100/metrics | head -3 || echo "❌ Not responding"
echo ""
echo "✅ Installation complete!"
echo ""
echo "Check Prometheus targets in ~2 minutes:"
echo " http://10.0.10.25:9090/targets"