Repository navigation
ZFS integration and Telegram interactivity - #6
Merged
Merged
Conversation
Extend the existing Telegram notifier with three optional, backward-compatible sendMessage fields: parse_mode (MarkdownV2/Markdown/HTML) for formatted text, silent (disable_notification) for quiet delivery, and message_thread_id to post into a forum topic. Omitting them reproduces the prior plain-text behaviour, so existing notifiers are unaffected. Also add examples/notifiers/ops-telegram.yml, the example fragment the other transports had but Telegram lacked. Co-Authored-By: Teo2Peer <teo2din@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an optional Telegram bot that answers operator commands with live Sermo reports. It receives commands over Bot API long polling (getUpdates) -- no inbound socket, no public exposure -- and only ever reads state: it can never change the host. - New self-contained internal/telegrambot package: a getUpdates/sendMessage client (token scrubbed from errors), a long-poll loop with SIGHUP-aware UpdateConfig, a read-only command router (/status, /services, /watches, /sla, /events, /help) and report formatters. It depends only on pure helpers so it builds and tests off the daemon's platform-specific dependencies. - internal/app adapter (telegramreport.go) maps the reload-safe web backend and the state store into the bot's Reporter, so reports match the dashboard. - New top-level telegram_bot config section (token, allowed_chats allow-list, poll_interval, enabled) with validation; wired into sermod startup/shutdown and the reload path alongside DiagnosticLog. - Also carries the telegram notifier's new-key validation and the EN/ES docs (configuration.md, sermo-all.yml, README) for both features. Co-Authored-By: Teo2Peer <teo2din@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
inode64
approved these changes
Jul 29, 2026
… tags sermoctl/sermod failed to compile off Linux: internal/checks imported github.com/google/nftables unconditionally (pulling nftables/xt, which uses Linux-only unix.NFPROTO_* constants) and referenced netlink.FAMILY_V4/V6 (defined only in netlink's *_linux.go files). CI runs on Linux so it stayed green, but local darwin builds broke. Split both along the existing _linux.go/_other.go convention used across the tree (notify, execx, utmp, cli, conn): - firewall_nftables.go gains //go:build linux; a new firewall_nftables_other.go stub keeps nftablesRuleCounter available (honoring context cancellation) and reports nftables counting is Linux-only. - route.go now uses local familyV4/familyV6 constants, defined per platform in route_family_linux.go (from netlink) and route_family_other.go (numeric). No behavior change on Linux. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The token is normally sourced from ${env:...}, which is expanded before
validation, so an unset TELEGRAM_BOT_TOKEN / TELEGRAM_TOKEN resolved to "" and
config validation aborted with "token is required". That was inconsistent with
runtime: telegrambot.Config.active() already treats an empty token as inactive,
and notify.Build() skips a tokenless telegram notifier with a warning.
Align validation with runtime: an empty token now leaves the bot (and the
telegram notifier) inactive instead of failing config load, so a host without
the secret still starts. When a token is present the other requirements
(allowed_chats / chat_id, formatting options) are still enforced. The notifier
name stays defined, so `notify` references to it keep resolving.
Docs (EN/ES) updated to note the token is optional.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a module to check zfs status
Added more functionality to telegram like asking for stats