mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-health: RouterOS v7 path syntax
This commit is contained in:
parent
3ed153520e
commit
af8a24b959
1 changed files with 12 additions and 12 deletions
24
check-health
24
check-health
|
@ -30,7 +30,7 @@
|
|||
:return ($T->0 * 10 + $T->1);
|
||||
}
|
||||
|
||||
:if ([ :len [ / system health find ] ] = 0) do={
|
||||
:if ([ :len [ /system/health/find ] ] = 0) do={
|
||||
$LogPrintExit2 error $0 ("Your device does not provide any health values.") true;
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,9 @@
|
|||
|
||||
$ScriptLock $0;
|
||||
|
||||
:foreach Voltage in=[ / system health find where type="V" ] do={
|
||||
:local Name [ / system health get $Voltage name ];
|
||||
:local Value [ / system health get $Voltage value ];
|
||||
:foreach Voltage in=[ /system/health/find where type="V" ] do={
|
||||
:local Name [ /system/health/get $Voltage name ];
|
||||
:local Value [ /system/health/get $Voltage value ];
|
||||
|
||||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||
:local NumCurr [ $TempToNum $Value ];
|
||||
|
@ -75,9 +75,9 @@ $ScriptLock $0;
|
|||
:set ($CheckHealthLast->$Name) $Value;
|
||||
}
|
||||
|
||||
:foreach PSU in=[ / system health find where name~"^psu.*-state\$" ] do={
|
||||
:local Name [ / system health get $PSU name ];
|
||||
:local Value [ / system health get $PSU value ];
|
||||
:foreach PSU in=[ /system/health/find where name~"^psu.*-state\$" ] do={
|
||||
:local Name [ /system/health/get $PSU name ];
|
||||
:local Value [ /system/health/get $PSU value ];
|
||||
|
||||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||
:if ($CheckHealthLast->$Name = "ok" && \
|
||||
|
@ -96,19 +96,19 @@ $ScriptLock $0;
|
|||
:set ($CheckHealthLast->$Name) $Value;
|
||||
}
|
||||
|
||||
:foreach Temperature in=[ / system health find where type="C" ] do={
|
||||
:local Name [ / system health get $Temperature name ];
|
||||
:local Value [ / system health get $Temperature value ];
|
||||
:foreach Temperature in=[ /system/health/find where type="C" ] do={
|
||||
:local Name [ /system/health/get $Temperature name ];
|
||||
:local Value [ /system/health/get $Temperature value ];
|
||||
|
||||
:if ([ :typeof ($CheckHealthLast->$Name) ] != "nothing") do={
|
||||
:if ([ :typeof ($CheckHealthTemperature->$Name) ] != "num" ) do={
|
||||
$LogPrintExit2 info $0 ("No threshold given for " . $Name . ", assuming 50C.") false;
|
||||
:set ($CheckHealthTemperature->$Name) 50;
|
||||
}
|
||||
:local Validate [ / system health get [ find where name=$Name ] value ];
|
||||
:local Validate [ /system/health/get [ find where name=$Name ] value ];
|
||||
:while ($Value != $Validate) do={
|
||||
:set Value $Validate;
|
||||
:set Validate [ / system health get [ find where name=$Name ] value ];
|
||||
:set Validate [ /system/health/get [ find where name=$Name ] value ];
|
||||
}
|
||||
:if ($Value > $CheckHealthTemperature->$Name && \
|
||||
$CheckHealthTemperatureNotified->$Name != true) do={
|
||||
|
|
Loading…
Reference in a new issue