From 7789cfa8b587590194c7dd558e82f641869d6c40 Mon Sep 17 00:00:00 2001 From: Pothi Kalimuthu <1254302+pothi@users.noreply.github.com> Date: Mon, 24 Jul 2023 07:36:50 +0530 Subject: [PATCH] First version of temparature monitoring and alert script --- scripts/temparature.rsc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/temparature.rsc diff --git a/scripts/temparature.rsc b/scripts/temparature.rsc new file mode 100644 index 0000000..c6c69b4 --- /dev/null +++ b/scripts/temparature.rsc @@ -0,0 +1,21 @@ +# Find temparature and alert if threshold is reached. + +:local t +:local threshold 60 + +:do { + :set t [/system health get value-name=value number=[find name=cpu-temperature]] +} on-error={ :set t -1 } + +:put $t + +:if ( $t < 0 ) do={ + :log warn "Temparature reading could not be fetched." + :error "Temparature reading could not be fetched." +} + +:if ( $t > $threshold ) do={ + :put "Temp exceeded the limit ($limit)." + :log warning "Temp exceeded the limit ($threshold)." +} +:log info "Current temparature: $t"