feat(uptime-kuma): we have 100% uptime
Some checks failed
lint / check (push) Successful in 23s
build configuration / build_krz01 (push) Failing after 1m29s

This commit is contained in:
Julien Malka 2024-12-07 19:42:36 +01:00
parent d3bfe16f7f
commit b10fee2eee
No known key found for this signature in database
GPG key ID: 6FC74C847011FD83
2 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,30 @@
diff --git a/server/model/group.js b/server/model/group.js
index 5b712ace..ecbced1a 100644
--- a/server/model/group.js
+++ b/server/model/group.js
@@ -31,10 +31,23 @@ class Group extends BeanModel {
*/
async getMonitorList() {
return R.convertToBeans("monitor", await R.getAll(`
- SELECT monitor.*, monitor_group.send_url FROM monitor, monitor_group
- WHERE monitor.id = monitor_group.monitor_id
+ SELECT monitor.*, monitor_group.send_url
+ FROM monitor
+ INNER JOIN monitor_group ON monitor.id = monitor_group.monitor_id
+ WHERE monitor.id IN (
+ SELECT hb.monitor_id
+ FROM heartbeat hb
+ INNER JOIN (
+ SELECT monitor_id, MAX(time) AS latest_time
+ FROM heartbeat
+ GROUP BY monitor_id
+ ) latest_hb
+ ON hb.monitor_id = latest_hb.monitor_id AND hb.time = latest_hb.latest_time
+ WHERE hb.status = 1
+ )
AND group_id = ?
ORDER BY monitor_group.weight
+
`, [
this.id,
]));

View file

@ -3,6 +3,7 @@
lib,
nodes,
sources,
pkgs,
...
}:
let
@ -100,7 +101,17 @@ in
imports = [ (sources.stateless-uptime-kuma + "/nixos/module.nix") ];
nixpkgs.overlays = [ (import (sources.stateless-uptime-kuma + "/overlay.nix")) ];
services.uptime-kuma.enable = true;
services.uptime-kuma = {
enable = true;
package = pkgs.uptime-kuma.overrideAttrs (
_: prev: {
patches = prev.patches ++ [
# Very important patch
./unethical_patch_0.patch
];
}
);
};
services.nginx = {
enable = true;