modules/nixfiles: Add metric for last update check
This commit is contained in:
		| @@ -4,6 +4,7 @@ set -euo pipefail | ||||
|  | ||||
| ALLOW_REBOOT= | ||||
| NO_CONFIRM= | ||||
| NODE_EXPORTER_METRICS_PATH= | ||||
|  | ||||
| while [[ $# -gt 0 ]]; do | ||||
| 	case $1 in | ||||
| @@ -15,6 +16,11 @@ while [[ $# -gt 0 ]]; do | ||||
| 			NO_CONFIRM=1 | ||||
| 			shift | ||||
| 		;; | ||||
| 		--node-exporter-metrics-path) | ||||
| 			NODE_EXPORTER_METRICS_PATH=$2 | ||||
| 			shift | ||||
| 			shift | ||||
| 		;; | ||||
| 		*) | ||||
| 			echo "Unknown option $1" | ||||
| 			exit 1 | ||||
| @@ -47,6 +53,11 @@ nix-env -p "/nix/var/nix/profiles/system" --set "${STORE_PATH}" | ||||
| echo "Set as boot target" | ||||
| /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})" | ||||
| ACTIVATING_SYSTEM_KERNEL="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user