Install Netdata through wgetConfigure Dynamic Configuration through TraefikSetup server as Netdata Parent to centralize metrics collectionEditĀ stream.confConfiguring a Netdata ParentConfigure Alerts to be sent to SlackSetup Netdata ChildrenEditĀ stream.confConfiguring Netdata ChildrenObservability. At your fingertips.
Netdata is an amazing free tool that allows you to observe your server metrics. If you self-host a lot of things, it might be the perfect tool to keep track of usage metrics, uptime monitoring and alerting in case something goes wrong.
However, if you go through Netdata Cloud, you can only observe 5 nodes at a time for free. Thatās what I had been doing. Plus you donāt get the premium alerting integrations like Slack.
After some research, I found that you could easily setup parent and child nodes independently from Netdata Cloud. A parent node is the main Netdata Agent which stores all the metrics while also serving the web dashboard to explore and discover metrics. The child nodes connect to the parent node and send metrics.
With this setup, you can configure everything in one place while also benefiting from using premium alerting.
Iāve put together a small guide on how you can achieve this.
Install Netdata through wget
wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh --disable-telemetry
Ā
Reference:
Configure Dynamic Configuration through Traefik
Point your domain to the server where you have Netdata installed.
Lets call it
netdata.your-domain.com
Ā
Navigate to your Coolify instance
Servers > localhost > Proxy > Dynamic Configurations > + Add
Filename: netdata.yaml
Configuration:
http: middlewares: redirect-to-https: redirectscheme: scheme: https gzip: compress: true # Set this if you need basic auth. You can use a # tool to generate a bcrypt hash of your password # netdata-auth: # basicAuth: # users: # - 'username:hashed_password' routers: netdata-http: middlewares: - redirect-to-https entryPoints: - http service: netdata rule: Host(`netdata.your-domain.com`) netdata-https: entryPoints: - https service: netdata rule: Host(`netdata.your-domain.com`) tls: certresolver: letsencrypt middlewares: - netdata-auth services: netdata: loadBalancer: servers: - url: 'http://host.docker.internal:19999'
Ā
After a few moments, you should be able to access your Netdata Dashboard at netdata.your-domain.com.
Setup server as Netdata Parent to centralize metrics collection
EditĀ stream.conf
To editĀ
stream.conf
, run this on your terminal:cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata sudo ./edit-config stream.conf
Your editor will open, with defaults and commentedĀ
stream.conf
Ā options.Configuring a Netdata Parent
To enable the reception of metrics from Netdata Children, generate a random API key with this command:
uuidgen
Then, copy the UUID generated,Ā editĀ
stream.conf
, find the section that reads like the following and replaceĀ API_KEY
Ā with the UUID you generated:[API_KEY] # Accept metrics streaming from other Agents with the specified API key enabled = yes
Save the file and restart Netdata.
sudo service netdata restart
Ā
Reference:
Configure Alerts to be sent to Slack
Create a Slack App.
Create a Webhook Trigger to a specific channel. Copy the webhook url. Youāll need it later.
SSH into the Netdata Parent server.
Change directory to
/etc/netdata
cd /etc/netdata
Create a new file called
health_alarm_notify.conf
nano health_alarm_notify
Copy the following and fill out the
SLACK_WEBHOOK_URL
and DEFAULT_RECIPIENT_SLACK
# Enable/disable sending notifications to Slack ENABLE_SLACK="YES" # Slack incoming webhook URL SLACK_WEBHOOK_URL="https://hooks.slack.com/services/XXXXXXXXXXX/YYYYYYYYYYY/ZZZZZZZZZZZZZZZZZZZZ" # The default channel to post messages DEFAULT_RECIPIENT_SLACK="#netdata-notifications" # Set a custom username for the bot (optional) # SLACK_USERNAME="Netdata" # Set a custom icon for the bot (optional) # SLACK_ICON_EMOJI=":chart_with_upwards_trend:"
Setup Netdata Children
EditĀ stream.conf
To editĀ
stream.conf
, run this on your terminal:cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata sudo ./edit-config stream.conf
Your editor will open, with defaults and commentedĀ
stream.conf
Ā options.Configuring Netdata Children
To enable streaming metrics to a Netdata Parent,Ā editĀ
stream.conf
, and at theĀ [stream]
Ā section at the top, set:[stream] # Stream metrics to another Netdata enabled = yes # The IP and PORT of the parent destination = PARENT_IP_ADDRESS:19999 # The shared API key, generated by uuidgen api key = API_KEY
Save the file and restart Netdata.
sudo service netdata restart
If you donāt see the name show up correctly, you can set the hostname of the server to have it display correctly.
sudo hostnamectl set-hostname cfy.memox.io
Ā
Reference:
Observability. At your fingertips.
Ā