mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-09 20:31:10 +00:00
72 lines
1.9 KiB
Markdown
72 lines
1.9 KiB
Markdown
# lego-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
|
|
* UPS events
|
|
* [vulnix](https://github.com/nix-community/vulnix) readings (NixOS only)
|
|
|
|
## Setup
|
|
|
|
### NixOS
|
|
|
|
Only flake-based setups are supported.
|
|
|
|
Include the module in your `flake.nix`:
|
|
|
|
```nix
|
|
{
|
|
inputs = {
|
|
# ... your other inputs ...
|
|
lego-monitoring = {
|
|
url = "git+https://gitlab.altau.su/lego/lego-monitoring.git";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = {
|
|
nixpkgs,
|
|
lego-monitoring,
|
|
...
|
|
}: {
|
|
# change `yourhostname` to your actual hostname
|
|
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
|
|
# change to your system:
|
|
system = "x86_64-linux";
|
|
modules = [
|
|
lego-monitoring.nixosModules.default
|
|
./configuration.nix
|
|
# ... your other modules ...
|
|
];
|
|
};
|
|
};
|
|
}
|
|
```
|
|
|
|
See [docs/nixos-options.md](docs/nixos-options.md) for available configuration options.
|
|
|
|
### Non-NixOS
|
|
|
|
Requires [uv](https://github.com/astral-sh/uv), systemd.
|
|
|
|
```bash
|
|
cd /opt
|
|
git clone https://gitlab.altau.su/lego/lego-monitoring.git
|
|
cd lego-monitoring
|
|
uv sync
|
|
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, and `enable` NixOS options just make a config section present or absent in JSON.
|
|
|
|
Then enable and start the service:
|
|
|
|
```bash
|
|
ln -s /opt/lego-monitoring/lego-monitoring.service /etc/systemd/system/lego-monitoring.service
|
|
systemctl enable --now lego-monitoring
|
|
```
|
|
|
|
### UPS monitoring
|
|
|
|
See [docs/ups.md](docs/ups.md) for instructions.
|