add status
This commit is contained in:
parent
bc8f728059
commit
db0d8e7552
2 changed files with 104 additions and 106 deletions
|
|
@ -20,9 +20,6 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
declarativePlugins = [ ];
|
declarativePlugins = [ ];
|
||||||
settings = {
|
settings = {
|
||||||
"auth.anonymous".enabled = true;
|
|
||||||
analytics.feedback_links_enabled = false;
|
|
||||||
users.default_theme = "system";
|
|
||||||
server = {
|
server = {
|
||||||
inherit domain;
|
inherit domain;
|
||||||
root_url = "https://${domain}";
|
root_url = "https://${domain}";
|
||||||
|
|
@ -37,34 +34,10 @@ in
|
||||||
admin_password = "$__file{${credentialDirectory}${passwordName}}";
|
admin_password = "$__file{${credentialDirectory}${passwordName}}";
|
||||||
};
|
};
|
||||||
|
|
||||||
dashboards.default_home_dashboard_path = toString (
|
"auth.anonymous".enabled = true;
|
||||||
(import ../../../lib/status.nix attrs) [
|
analytics.feedback_links_enabled = false;
|
||||||
{
|
users.default_theme = "system";
|
||||||
name = "Matrix";
|
dashboards.default_home_dashboard_path = toString (import ../../../lib/status.nix attrs);
|
||||||
service = "continuwuity.service";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "LaSuite Docs";
|
|
||||||
service = "lasuite-docs.service";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "Forgejo (Git)";
|
|
||||||
service = "forgejo.service";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "SearXNG (Search)";
|
|
||||||
service = "searx.service";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "Redlib";
|
|
||||||
service = "redlib.service";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "GMessages Bridge";
|
|
||||||
service = "matrix-as-gmessages.service";
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
provision = {
|
provision = {
|
||||||
|
|
|
||||||
175
lib/status.nix
175
lib/status.nix
|
|
@ -1,83 +1,108 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
services:
|
|
||||||
|
|
||||||
# {
|
|
||||||
# "collapsed": false,
|
|
||||||
# "gridPos": {
|
|
||||||
# "h": 1,
|
|
||||||
# "w": 24,
|
|
||||||
# "x": 0,
|
|
||||||
# "y": 0
|
|
||||||
# },
|
|
||||||
# "id": 261,
|
|
||||||
# "panels": [],
|
|
||||||
# "title": "Quick CPU / Mem / Disk",
|
|
||||||
# "type": "row"
|
|
||||||
# },
|
|
||||||
pkgs.writers.writeJSON "status.json" {
|
pkgs.writers.writeJSON "status.json" {
|
||||||
title = "Service Status";
|
title = "Service Status";
|
||||||
panels = [
|
panels =
|
||||||
{
|
let
|
||||||
collapsed = false;
|
status = null;
|
||||||
title = "Federated Nexus Service Statuses";
|
offset = if status == null then 8 else 0;
|
||||||
type = "row";
|
in
|
||||||
gridPos = {
|
(lib.optionals (status != null) [
|
||||||
h = 1;
|
{
|
||||||
w = 24;
|
gridPos.w = 100;
|
||||||
x = 0;
|
title = "Status Update";
|
||||||
y = 0;
|
type = "text";
|
||||||
};
|
options.content = status;
|
||||||
}
|
}
|
||||||
]
|
])
|
||||||
++ (lib.imap0 (
|
++ [
|
||||||
index:
|
{
|
||||||
{ name, service }:
|
collapsed = false;
|
||||||
{
|
title = "Federated Nexus Service Statuses";
|
||||||
title = name;
|
type = "row";
|
||||||
type = "stat";
|
gridPos = {
|
||||||
gridPos = rec {
|
h = 8;
|
||||||
h = 3;
|
w = 24;
|
||||||
w = 4;
|
y = offset;
|
||||||
x = index * w;
|
};
|
||||||
y = (index * h) + 8;
|
}
|
||||||
};
|
]
|
||||||
datasource = {
|
++ (lib.imap0
|
||||||
type = "prometheus";
|
(
|
||||||
uid = "prometheus";
|
index:
|
||||||
};
|
{ name, service }:
|
||||||
fieldConfig = {
|
{
|
||||||
defaults = {
|
title = name;
|
||||||
color.mode = "thresholds";
|
type = "stat";
|
||||||
mappings = [
|
gridPos = rec {
|
||||||
{
|
h = 3;
|
||||||
options = {
|
w = 4;
|
||||||
"0".text = "Failed";
|
x = index * w;
|
||||||
"1".text = "Running";
|
y = (index * h) + offset + 8;
|
||||||
|
};
|
||||||
|
datasource = {
|
||||||
|
type = "prometheus";
|
||||||
|
uid = "prometheus";
|
||||||
|
};
|
||||||
|
fieldConfig = {
|
||||||
|
defaults = {
|
||||||
|
color.mode = "thresholds";
|
||||||
|
mappings = [
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
"0".text = "Failed";
|
||||||
|
"1".text = "Running";
|
||||||
|
};
|
||||||
|
type = "value";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
thresholds = {
|
||||||
|
mode = "absolute";
|
||||||
|
steps = [
|
||||||
|
{
|
||||||
|
color = "red";
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
color = "green";
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
type = "value";
|
unit = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
targets = [
|
||||||
|
{
|
||||||
|
expr = "node_systemd_unit_state{name=\"${service}\",state=\"active\"}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
thresholds = {
|
|
||||||
mode = "absolute";
|
|
||||||
steps = [
|
|
||||||
{
|
|
||||||
color = "red";
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
color = "green";
|
|
||||||
value = 1;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
unit = "none";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
targets = [
|
|
||||||
{
|
|
||||||
expr = "node_systemd_unit_state{name=\"${service}\",state=\"active\"}";
|
|
||||||
}
|
}
|
||||||
];
|
)
|
||||||
}
|
[
|
||||||
) services);
|
{
|
||||||
|
name = "Matrix";
|
||||||
|
service = "continuwuity.service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "LaSuite Docs";
|
||||||
|
service = "lasuite-docs.service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "Forgejo (Git)";
|
||||||
|
service = "forgejo.service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "SearXNG (Search)";
|
||||||
|
service = "searx.service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "Redlib";
|
||||||
|
service = "redlib.service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "GMessages Bridge";
|
||||||
|
service = "matrix-as-gmessages.service";
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue