diff --git a/README.md b/README.md index f929963..4d642a8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # lego-monitoring -Simple system monitoring service. Sends alerts in Telegram. Currently supports monitoring: +Simple system monitoring service. Sends alerts in Telegram and/or reports status to [Healthchecks](https://healthchecks.io/). Currently supports monitoring: * CPU/RAM/network usage * temperature readings * [vulnix](https://github.com/nix-community/vulnix) readings (NixOS only) @@ -57,7 +57,7 @@ cp config.example.json config.json ``` Edit `config.json` to suit your usage scenario. The default configuration only sends alerts on service's start and stop. -You may refer to the NixOS option documentation, as its options are the same, except JSON uses snake_case instead of lowerCamelCase. +You may refer to the NixOS option documentation, as its options are the same, except JSON uses snake_case instead of lowerCamelCase, and `enable` NixOS options just make a config section present or absent in JSON. Then enable and start the service: diff --git a/config.example.json b/config.example.json index b875087..5e2d823 100644 --- a/config.example.json +++ b/config.example.json @@ -5,9 +5,11 @@ "stop", "remind" ], - "telegram": { - "creds_secret_path": "/opt/lego-monitoring/tg-creds.txt", - "roomId": "0" + "alert_channels": { + "telegram": { + "creds_secret_path": "/opt/lego-monitoring/tg-creds.txt", + "roomId": "0" + } }, "checks": { diff --git a/docs/nixos-options.md b/docs/nixos-options.md index 63bb9f9..bf01a66 100644 --- a/docs/nixos-options.md +++ b/docs/nixos-options.md @@ -30,8 +30,7 @@ boolean List of enabled check sets\. Each check set is a module which checks something and generates alerts based on check results\. Available check sets: - - start – send an alert when lego-monitoring is started - - stop – send an alert when lego-monitoring is stopped + - self – send an alert when lego-monitoring is started and stopped - remind – periodically (daily by default) remind about ongoing unresolved alerts - cpu – alerts when CPU usage is above threshold - ram – alerts when RAM usage is above threshold @@ -42,7 +41,7 @@ List of enabled check sets\. Each check set is a module which checks something a *Type:* -list of (one of “start”, “stop”, “remind”, “cpu”, “ram”, “temp”, “net”, “vulnix”) +list of (one of “self”, “remind”, “cpu”, “ram”, “temp”, “net”, “vulnix”) @@ -54,8 +53,156 @@ list of (one of “start”, “stop”, “remind”, “cpu”, “ram”, “ +## services\.lego-monitoring\.alertChannels\.healthchecks\.enable + +Whether to enable [Healthchecks](https://healthchecks\.io) notification channel\. + + + +*Type:* +boolean + + + +*Default:* +` false ` + + + +*Example:* +` true ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + +## services\.lego-monitoring\.alertChannels\.healthchecks\.pingingApiEndpoint + + + +Endpoint URL for Healthchecks pinging API\. + + + +*Type:* +string + + + +*Default:* +` "https://hc-ping.com/" ` + + + +*Example:* +` "https://your-healthchecks-instance.com/ping/" ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + +## services\.lego-monitoring\.alertChannels\.healthchecks\.pingingKeysSecretPath + + + +Path to a file containing the pinging keys in a ` slug:key ` format, one on each line (ex: ` lego-cpu:aaaaaaaaaaaaaaaaaaaaaa `)\. +Specify ` default ` as the slug to use this key for check types that don’t have a key explicitly assigned to them\. + +If you are unsure of the exact slug a check will generate, it is recommended to try it out with the default key first, before +assigning a specific one\. + +**Note**: checks will be auto-provisioned, but correct intervals and grace periods have to be configured manually from the web console, +otherwise silent failures will not be recorded until after 1 day (the default healthchecks interval)\. + + + +*Type:* +string + + + +*Default:* +` "" ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + +## services\.lego-monitoring\.alertChannels\.telegram\.enable + + + +Whether to enable Telegram notification channel\. + + + +*Type:* +boolean + + + +*Default:* +` false ` + + + +*Example:* +` true ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + +## services\.lego-monitoring\.alertChannels\.telegram\.credsSecretPath + + + +Path to a file containing Telegram api_id, api_hash, and bot token, separated by the ` , ` character\. + + + +*Type:* +string + + + +*Default:* +` "" ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + +## services\.lego-monitoring\.alertChannels\.telegram\.roomId + + + +ID of chat where to send alerts\. + + + +*Type:* +signed integer + + + +*Default:* +` 0 ` + +*Declared by:* + - [modules/options\.nix](../modules/options.nix) + + + ## services\.lego-monitoring\.checks\.cpu\.criticalPercentage + + CPU load percentage for a critical alert to be sent\. Null means never generate a CPU critical alert\. @@ -608,35 +755,3 @@ one of “CRITICAL”, “ERROR”, “WARNING”, “INFO”, “DEBUG” - [modules/options\.nix](../modules/options.nix) - -## services\.lego-monitoring\.telegram\.credsSecretPath - - - -Path to a file containing Telegram api_id, api_hash, and bot token, separated by the ` , ` character\. - - - -*Type:* -string - -*Declared by:* - - [modules/options\.nix](../modules/options.nix) - - - -## services\.lego-monitoring\.telegram\.roomId - - - -ID of chat where to send alerts\. - - - -*Type:* -signed integer - -*Declared by:* - - [modules/options\.nix](../modules/options.nix) - -