feat(uptime-kuma): we have 100% uptime
This commit is contained in:
parent
d3bfe16f7f
commit
b10fee2eee
2 changed files with 42 additions and 1 deletions
30
machines/status01/unethical_patch_0.patch
Normal file
30
machines/status01/unethical_patch_0.patch
Normal 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,
|
||||||
|
]));
|
|
@ -3,6 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
nodes,
|
nodes,
|
||||||
sources,
|
sources,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -100,7 +101,17 @@ in
|
||||||
imports = [ (sources.stateless-uptime-kuma + "/nixos/module.nix") ];
|
imports = [ (sources.stateless-uptime-kuma + "/nixos/module.nix") ];
|
||||||
nixpkgs.overlays = [ (import (sources.stateless-uptime-kuma + "/overlay.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 = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Reference in a new issue