Skip to content

Commit

Permalink
nixos: add gatus service
Browse files Browse the repository at this point in the history
From unstable.
  • Loading branch information
claha committed Oct 27, 2024
1 parent b829445 commit af77b80
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
./hosts/chewbacca
(import "${nixpkgs-unstable}/nixos/modules/services/monitoring/gatus.nix")
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
Expand Down
1 change: 1 addition & 0 deletions nixos/hosts/chewbacca/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
imports =
[
./hardware-configuration.nix
./../../services/gatus.nix
./../../services/glances.nix
./../../services/jellyfin.nix
./../../services/music-assistant.nix
Expand Down
30 changes: 30 additions & 0 deletions nixos/services/gatus.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ config, pkgs, ... }:

let
tailscaleDevices = [
{ hostname = "chewbacca"; address = "100.110.122.14"; }
{ hostname = "luffy"; address = "100.118.93.10"; }
];
in
{
services.gatus = {
enable = true;
openFirewall = true;
settings = {
endpoints = map
(device:
{
name = device.hostname;
url = "icmp://${device.address}";
interval = "5m";
conditions = [
"[CONNECTED] == true"
];
}
)
tailscaleDevices;
};
};

systemd.services.gatus.serviceConfig.AmbientCapabilities = "CAP_NET_RAW";
}
9 changes: 9 additions & 0 deletions nixos/services/traefik/dynamic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ http:
- adminprefix
service: pihole

gatus:
rule: "Host(`gatus.hallstrom.duckdns.org`)"
service: gatus

middlewares:
sslheader:
headers:
Expand Down Expand Up @@ -81,3 +85,8 @@ http:
loadBalancer:
servers:
- url: "http://192.168.1.24"

gatus:
loadBalancer:
servers:
- url: "http://192.168.1.49:8080"

0 comments on commit af77b80

Please sign in to comment.