modules/nixfiles: Add metric for last update check
This commit is contained in:
parent
671f5925c1
commit
cb585b9bd5
@ -25,7 +25,7 @@ in
|
|||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = pkgs.nixfiles-system-upgrade + "/bin/nixfiles-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}";
|
ExecStart = pkgs.nixfiles-system-upgrade + "/bin/nixfiles-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}${optionalString (config.clerie.monitoring.enable) " --node-exporter-metrics-path /var/lib/prometheus-node-exporter/textfiles/nixfiles-system-upgrade.prom"}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
systemd.timers.nixfiles-system-auto-upgrade = {
|
systemd.timers.nixfiles-system-auto-upgrade = {
|
||||||
|
@ -4,6 +4,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
ALLOW_REBOOT=
|
ALLOW_REBOOT=
|
||||||
NO_CONFIRM=
|
NO_CONFIRM=
|
||||||
|
NODE_EXPORTER_METRICS_PATH=
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@ -15,6 +16,11 @@ while [[ $# -gt 0 ]]; do
|
|||||||
NO_CONFIRM=1
|
NO_CONFIRM=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--node-exporter-metrics-path)
|
||||||
|
NODE_EXPORTER_METRICS_PATH=$2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option $1"
|
echo "Unknown option $1"
|
||||||
exit 1
|
exit 1
|
||||||
@ -47,6 +53,11 @@ nix-env -p "/nix/var/nix/profiles/system" --set "${STORE_PATH}"
|
|||||||
echo "Set as boot target"
|
echo "Set as boot target"
|
||||||
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
|
|
||||||
|
if [[ -n "$NODE_EXPORTER_METRICS_PATH" ]]; then
|
||||||
|
echo "Write monitoring check data"
|
||||||
|
echo "nixfiles_system_upgrade_last_check $(date +%s)" > "$NODE_EXPORTER_METRICS_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
BOOTED_SYSTEM_KERNEL="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
BOOTED_SYSTEM_KERNEL="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||||
ACTIVATING_SYSTEM_KERNEL="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
ACTIVATING_SYSTEM_KERNEL="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user