Netdata Alerts to Telegram with One HTTP POST

Netdata Alerts to Telegram with One HTTP POST

push.tg

Netdata Agent can already email you, or call any HTTPS endpoint through a custom sender. Point either at push.tg and disk, CPU and reachability alerts land in Telegram — no BotFather bot. Checked against Netdata's agent custom-notification and email docs (health_alarm_notify.conf).

Step 1: get your endpoint (30 seconds)

Open @trafficRobot in Telegram and press Start. You get an address like k3x9q@push.tg. Your endpoint is the part before the @: https://push.tg/k3x9q. Every example below uses k3x9q, so swap in your own key.

There's no bot to create, no chat_id to look up and no token to keep safe. Add @trafficRobot to a group and the group gets its own address, so everyone who looks after the machines sees the messages.

Option A: custom HTTP sender (recommended)

On the node, edit the agent notify config:

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config health_alarm_notify.conf

Enable custom notifications and POST plain text with Netdata's docurl helper (same pattern as the official custom-sender example):

SEND_CUSTOM="YES"
DEFAULT_RECIPIENT_CUSTOM="k3x9q"

custom_sender() {
  local msg="${host} ${status_message}: ${alarm} ${raised_for}"
  to="${1}"
  for key in ${to}; do
    httpcode=$(docurl -X POST -d "${msg}" "https://push.tg/${key}")
    if [ "${httpcode}" = "200" ]; then
      info "sent custom notification to ${key}"
      sent=$((sent + 1))
    else
      error "failed custom notification to ${key} HTTP ${httpcode}"
    fi
  done
}

host, status_message, alarm and raised_for are the usual alarm-notify variables. DEFAULT_RECIPIENT_CUSTOM is what ends up in ${1} / to — put your push.tg key there (or a space-separated list of keys).

Option B: email

If the agent already has a working sendmail (or msmtp in Docker), set the recipient to your push.tg address:

SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="k3x9q@push.tg"

Long emails are shortened in the chat. The full copy sits behind a secret link for up to 12h, then it's destroyed. You still need a working local MTA; push.tg only receives.

Test

As user netdata:

sudo su -s /bin/bash netdata
export NETDATA_ALARM_NOTIFY_DEBUG=1
/usr/libexec/netdata/plugins.d/alarm-notify.sh test

That exercises every enabled method for the sysadmin role. For a direct push.tg check:

curl -s -d "Netdata → Telegram check" https://push.tg/k3x9q

Check that the message really arrived. push.tg answers HTTP 200 even when the key is wrong; the body then says {"error":"no such user"}. Confirm in Telegram before you trust disk alerts.

Open @trafficRobot · push.tg

More copy-paste guides

Report Page