-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetdata.sh
More file actions
43 lines (36 loc) · 1.12 KB
/
netdata.sh
File metadata and controls
43 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
set -euo pipefail
# ---------- helpers ----------
log() { echo -e "\n==> $*"; }
if [[ "${EUID}" -ne 0 ]]; then
echo "Please run as root: sudo $0"
exit 1
fi
NETDATA_PORT="${NETDATA_PORT:-19999}"
# ---------- install netdata ----------
log "Installing Netdata..."
curl -fsSL https://get.netdata.cloud/kickstart.sh > /tmp/netdata-kickstart.sh
bash /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry --non-interactive
rm /tmp/netdata-kickstart.sh
# ---------- configure firewall ----------
if command -v ufw &>/dev/null && ufw status | grep -q "active"; then
log "Allowing Netdata through UFW..."
ufw allow ${NETDATA_PORT}/tcp
fi
# ---------- get server ip ----------
SERVER_IP=$(hostname -I | awk '{print $1}')
log "Done."
echo ""
echo "=========================================="
echo " Netdata Installation Complete!"
echo "=========================================="
echo ""
echo "Access dashboard:"
echo " http://${SERVER_IP}:${NETDATA_PORT}"
echo ""
echo "Config: /etc/netdata/netdata.conf"
echo ""
echo "Commands:"
echo " systemctl status netdata"
echo " systemctl restart netdata"
echo ""