Hemdal is an extensible alerts and alarms monitoring library for Elixir applications. It proactively monitors local and remote hosts, evaluates health check rules, tracks state transitions, and sends notifications when issues or recoveries occur.
- Extensible Host Execution (
Hemdal.Host):- Execute checks locally (
Hemdal.Host.Local) or remotely via SSH/PTY/SFTP with Trooper. - Proactive connections without requiring agent installations on target servers.
- Worker pooling with dynamic concurrency limits (
max_workers) and queue draining.
- Execute checks locally (
- Robust State Machine (
Hemdal.Check):- Manages check lifecycles with configurable check intervals, recheck intervals, and retry thresholds.
- States:
:normal(OK),:failing(WARN),:broken(FAIL), and:disabled(OFF).
- Event Pipeline (
Hemdal.Event):- Built with GenStage for reliable event production and consumption.
- Logging consumer (
Hemdal.Event.Log) and notification dispatcher (Hemdal.Event.Notification).
- Integrated Notifiers (
Hemdal.Notifier):- Ready-to-use integrations for Slack and Mattermost.
- Easy-to-implement behaviour for custom notification channels (Email, Webhooks, Telegram, PagerDuty, etc.).
- Flexible Configuration Backends (
Hemdal.Config):- Read configuration from Elixir Application Environment (
Env) or JSON files (Json). - Supports dynamic configuration reloads at runtime via
Hemdal.reload_all/0.
- Read configuration from Elixir Application Environment (
Add hemdal to your list of dependencies in mix.exs:
def deps do
[
{:hemdal, "~> 1.2"}
]
endConfigure your hosts and alert checks in config/config.exs:
import Config
config :hemdal, :config_module, Hemdal.Config.Backend.Env
config :hemdal, Hemdal.Config, [
[
id: "disk-space-check",
name: "Disk Space Check",
host: [
id: "localhost-node",
name: "localhost",
module: Hemdal.Host.Local,
max_workers: 2
],
command: [
name: "check_disk",
type: "line",
command: "df -h / | awk 'NR==2 {print $5}'"
],
check_in_sec: 60,
recheck_in_sec: 10,
retries: 3,
notifiers: [
[
module: Hemdal.Notifier.Slack,
token: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
channel: "#monitoring",
username: "HemdalBot"
]
]
]
]Full documentation and guides are available on HexDocs:
This project is licensed under the terms of the MIT License.
- Open an issue or pull request on GitHub.
- Please adhere to our Code of Conduct and review our Contributing Guidelines.
- If you find Hemdal helpful, consider supporting the project:
Enjoy!
