Mikrotik-Device : CRS112-8P-4S
\
MikroTik RouterOS 6.48.4 (CRS112-8P-4S)
[admin@MikroTik] > :put [/system health get]
psu1-voltage=275;psu2-voltage=484;temperature=45
[admin@MikroTik] > /system health print
temperature: 45C
psu1-voltage: 27.5V
psu2-voltage: 48.4V
\
MikroTik RouterOS 6.49.1 (CRS112-8P-4S)
[admin@MikroTik] > :put [/system health get]
psu1-voltage=275;psu2-voltage=484;temperature=45
[admin@MikroTik] > /system health print
temperature: 45C
psu1-voltage: 27.5V
psu2-voltage: 48.4V
MikroTik RouterOS 7.1rc6 (CRS112-8P-4S)
[admin@MikroTik] > /system health print
Columns: NAME, VALUE, TYPE
NAME VALUE TYPE
0 temperature 46 C
1 psu1-voltage 27.5 V
2 psu2-voltage 48.4 V
[admin@MikroTik] > :put [/system health get]
**** NOT Working ****
[admin@MikroTik] > :foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
.id=*e;name=temperature;type=C;value=46
.id=*1c21;name=psu1-voltage;type=V;value=27.5
.id=*1c22;name=psu2-voltage;type=V;value=48.4
Mikrotik-Device : hEX S
\
MikroTik RouterOS 6.48.5 (hEX S)
[admin@MikroTik] > :put [/system health get]
temperature=60;voltage=477
[admin@MikroTik] > /system health print
voltage: 47.7V
temperature: 60C
\
MikroTik RouterOS 6.49.1 (hEX S)
[admin@MikroTik] > :put [/system health get]
temperature=61;voltage=477
[admin@MikroTik] > /system health print
voltage: 47.7V
temperature: 61C
\
MikroTik RouterOS 7.1rc6 (hEX S)
[admin@MikroTik] > /system health print
Columns: NAME, VALUE, TYPE
NAME VALUE TYPE
0 voltage 0.5 V
**** Missing Temp & false Voltage ****
[admin@MikroTik] > :put [/system health get]
**** NOT Working ****
[admin@MikroTik] > :foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
.id=*d;name=voltage;type=V;value=0.5
Mikrotik-Device : hEX
MikroTik RouterOS 6.48.5 (hEX)
[admin@MikroTik] > :put [/system health get]
temperature=42;voltage=273
[admin@MikroTik] > /system health print
voltage: 27.3V
temperature: 42C
MikroTik RouterOS 6.49.1 (hEX)
[admin@MikroTik] > :put [/system health get]
temperature=41;voltage=273
[admin@MikroTik] > /system health print
voltage: 27.3V
temperature: 42C
MikroTik RouterOS 7.1rc6 (hEX)
[admin@Mikrotik] > /system health print
Columns: NAME, VALUE, TYPE
NAME VALUE TYPE
0 voltage 0.5 V
**** Missing Temp & false Voltage ****
[admin@MikroTik] > :put [/system health get]
**** NOT Working ****
[admin@MikroTik] > :foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
.id=*d;name=voltage;type=V;value=0.5
Jotne
November 22, 2021, 5:26pm
24
Can someone else with v7+ RouterOS test what of the two command below gives output.
:put [/system health get]
:foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
It will be hard (not impossible) to make a script when same version of RouterOS need two different script, depending on hardware.
deadkat
November 23, 2021, 4:02pm
25
From my RB4011, running RC6, output looks like this:
[admin@RouterOS] > :put [/system health get]
number: 0
.id=*d;name=voltage;type=V;value=24.1
[admin@RouterOS] > :foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
.id=*d;name=voltage;type=V;value=24.1
.id=*e;name=temperature;type=C;value=36
[admin@RouterOS] > :put [/system health get num=0]
.id=*d;name=voltage;type=V;value=24.1
[admin@RouterOS] >
edit:
for eworm:
[admin@RouterOS] > /system/health/print
Columns: NAME, VALUE, TYPE
# NAME VALUE TYPE
0 voltage 24.1 V
1 temperature 36 C
[admin@RouterOS] >
Jotne
November 23, 2021, 4:43pm
26
Strange that you do not get temperature from:
put [/system health get]
eworm
November 23, 2021, 7:50pm
27
He answered the interactive prompt with “0”, so this is correct.
Jotne
November 23, 2021, 8:23pm
28
Did not see that
So
:put [/system health get]
in his case does not give any output without adding an id.
Hope that MT fixes this so that all system works equal on same OS version.
My CHR 7.1rc6 does not work with the find:
:foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
bad command name find (line 1 column 33)
And this command does not work on 6.x at all, so need som on-error in the script.
Output are also different so Splunk need to be modded to accept different output. ARG
Tested 7.1rc6 on an SXT 5HPnD, there new method works.
:foreach id in=[/system/health/find] do={:put [/system/health/get $id]}
.id=*d;name=voltage;type=V;value=24
.id=*e;name=temperature;type=C;value=37
Jotne
November 23, 2021, 9:31pm
29
Then we have a solution that works on both version without testing for RouteOS version.
:do {
# New version
:foreach id in=[/system health find] do={
:local health "$[/system health get $id]"
:set ( "$health"->"script" ) "health"
:log info message="$health"
}
} on-error={
# Old version
:if (!([/system health get]~"(state=disabled|^\$)")) do={
:local health "$[/system health get]"
:set ( "$health"->"script" ) "health"
:log info message="$health"
}
}
Script test the new method first, and if that fails, it will run the old version.
Now the work on Splunk have to be done with handling two different output.
@Jotne ,
do you still need help with testing ?
Jotne
November 24, 2021, 10:13am
31
No, thank you
Did setup a box with RuterOS 7.1rc6.
Terminal is very slow, so something is wrong.
msatter
November 24, 2021, 10:35am
32
The terminal is indeed veeeeeeeeeeery slow. I assume that Mikrotik still have debug/test flag active that slows it that much down.
eworm
December 8, 2021, 2:58pm
33
Now that RouterOS v7 has a stable branch it should spread a lot more.
Anybody around with a rack mount CCR1009 who can provide the output?
eworm
December 10, 2021, 2:12pm
34
Answering myself…
[admin@MikroTik] > /system/health/print
Columns: NAME, VALUE, TYPE
# NAME VALUE TYPE
0 voltage 15.2 V
1 temperature 34 C
2 power-consumption 11.5 W
3 cpu-temperature 54 C
4 current 0.7 A
5 fan1-speed 5693 RPM
6 psu1-state ok
7 psu2-state ok
The type for psu-state is an empty string…
MikroTik, is that expected?
Jotne
December 10, 2021, 3:53pm
35
It would (for me and Splunk prosjekt) be interesting to see different type of health output.
Can all with 7.1 on different type of Routers pot output and system info of
{
:put [/system/routerboard/get model]
:foreach id in=[/system health find] do={
:local health "$[/system health get $id]"
:put "$health"
}
}
My test router:
SXT 5HPnD r2
.id=*d;name=voltage;type=V;value=12.2
.id=*e;name=temperature;type=C;value=16
Large routers would give more Information.
deadkat
December 10, 2021, 4:17pm
36
RouterBOARD 3011UiAS
.id=*d;name=voltage;type=V;value=27.8
.id=*e;name=temperature;type=C;value=22
RB4011iGS+
.id=*d;name=voltage;type=V;value=24.5
.id=*e;name=temperature;type=C;value=29
RB4011iGS+5HacQ2HnD
.id=*d;name=voltage;type=V;value=24.4
.id=*e;name=temperature;type=C;value=27
CRS226-24G-2S+
.id=*d;name=voltage;type=V;value=24.9
.id=*e;name=temperature;type=C;value=23
eworm
December 10, 2021, 10:47pm
37
CCR1009-7G-1C-1S+
.id=*d;name=voltage;type=V;value=15.2
.id=*e;name=temperature;type=C;value=34
.id=*10;name=power-consumption;type=W;value=11.5
.id=*11;name=cpu-temperature;type=C;value=54
.id=*12;name=current;type=A;value=0.7
.id=*1b59;name=fan1-speed;type=RPM;value=5713
.id=*1ce9;name=psu1-state;type=;value=ok
.id=*1cea;name=psu2-state;type=;value=ok
CRS328-24P-4S+
.id=*10;name=power-consumption;type=W;value=47.2
.id=*11;name=cpu-temperature;type=C;value=58
.id=*1b59;name=fan1-speed;type=RPM;value=405
.id=*1b5a;name=fan2-speed;type=RPM;value=795
.id=*1bbd;name=board-temperature1;type=C;value=32
.id=*1c21;name=psu1-voltage;type=V;value=25.6
.id=*1c22;name=psu2-voltage;type=V;value=51.1
.id=*1c85;name=psu1-current;type=A;value=0.7
.id=*1c86;name=psu2-current;type=A;value=0.5
Jotne
December 11, 2021, 9:22am
38
Some PSU give only OK (and not OK I guess)
Other PSU gives Ampere and Volt.
Jotne
December 11, 2021, 2:44pm
39
Anyone know what this shows when a PSU is bad?
.id=*1ce9;name=psu1-state;type=;value=ok
Edit:
It may be “fail” as show in this post:
http://forum.mikrotik.com/t/crs328-4c-20s-4s-psu-log-warning/125093/1
eworm
December 16, 2021, 8:28pm
40
Yes, it’s “fail”:
.id=*d;name=voltage;type=V;value=24.2
.id=*e;name=temperature;type=C;value=34
.id=*10;name=power-consumption;type=W;value=24.9
.id=*11;name=cpu-temperature;type=C;value=57
.id=*12;name=current;type=A;value=1
.id=*1b59;name=fan1-speed;type=RPM;value=6573
.id=*1ce9;name=psu1-state;type=;value=ok
.id=*1cea;name=psu2-state;type=;value=fail