mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
service/nextcloud: add monitoring
This commit is contained in:
parent
d28d38bc23
commit
1e5bc4cf7e
5 changed files with 696 additions and 2 deletions
|
@ -33,6 +33,21 @@ in
|
|||
'nextcloud' user.
|
||||
'';
|
||||
};
|
||||
|
||||
exporterPasswordFile = mkOption {
|
||||
type = types.path;
|
||||
example = "/var/lib/nextcloud/password.txt";
|
||||
description = ''
|
||||
Path to a file containing the admin's password, must be readable by
|
||||
'nextcloud' user.
|
||||
'';
|
||||
};
|
||||
exporterPort = mkOption {
|
||||
type = types.port;
|
||||
default = 9205;
|
||||
example = 8080;
|
||||
description = "Internal port for the exporter";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -107,6 +122,37 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
services.prometheus.exporters.nextcloud = {
|
||||
enable = true;
|
||||
url = "https://cloud.${domain}";
|
||||
username = cfg.admin;
|
||||
passwordFile = cfg.exporterPasswordFile;
|
||||
port = cfg.exporterPort;
|
||||
};
|
||||
|
||||
services.prometheus.scrapeConfigs = [
|
||||
{
|
||||
job_name = "nextcloud";
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:${toString cfg.exporterPort}" ];
|
||||
labels = {
|
||||
instance = config.networking.hostName;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
services.grafana.provision = {
|
||||
dashboards.settings.providers = [
|
||||
{
|
||||
name = "Nextcloud";
|
||||
options.path = pkgs.grafana-dashboards.nextcloud;
|
||||
disableDeletion = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
webapps.apps.nextcloud = {
|
||||
dashboard = {
|
||||
name = "Cloud";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue