nixos-healthchecks
nixos-healthchecks provide NixOS-Options to verify if your services are running correctly.
healthchecks.http.nextcloud = {
url = "https://example.com/login";
expectedContent = "Login";
};
services.nextcloud = { ... };
Than run
nix run .#healthchecks
Installation
To use these options, add to your flake inputs:
nixos-healthchecks.url = "github:mrVanDalo/nixos-healthchecks";
and inside the mkFlake
:
imports = [
inputs.nixos-healthchecks.flakeModule
inputs.nixos-healthchecks.nixosModules.default
];
Run nix flake lock
and you're set.
Options
healthchecks.closed
Verify that ports the defined ports are closed for a specific interface. Verification is done by rustscan.
Type: attribute set of (submodule)
Default:
{ }
Example:
{
public = {
host = "example.com";
ports = {
arr = [
7878
8989
8686
];
};
};
}
Declared by:
healthchecks.closed.<name>.host
The host against which the rustscan will be done. Needed because we have more than interface on the machine.
Type: string
Declared by:
healthchecks.closed.<name>.ports
service -> [port, … ] Ports that should be verified as beeing closed.
Type: attribute set of list of signed integer
Default:
{ }
Declared by:
healthchecks.http
Run curl commands to verify if response code is as expected and expectedContent is part of the body.
Type: attribute set of (submodule)
Default:
{ }
Example:
{
github = {
expectedContent = "GitHub";
url = "https://github.com";
};
}
Declared by:
healthchecks.http.<name>.expectedContent
Expected string in the response
Type: null or string
Default:
null
Declared by:
healthchecks.http.<name>.notExpectedContent
Not expected string in the response
Type: null or string
Default:
null
Declared by:
healthchecks.http.<name>.responseCode
Expected response code
Type: signed integer
Default:
200
Declared by:
healthchecks.http.<name>.url
URL to analyze.
Type: string
Declared by:
healthchecks.localCommands
service -> path-to-command command to run on local machine to test remote server. exit code 0 will result in success all other exit codes will result in failure
Type: attribute set of path
Default:
{ }
Declared by: