Health readings with v7

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


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.

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] >

Strange that you do not get temperature from:

put [/system health get]

He answered the interactive prompt with “0”, so this is correct.

Did not see that :slight_smile:
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

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 ?

No, thank you
Did setup a box with RuterOS 7.1rc6.
Terminal is very slow, so something is wrong.

The terminal is indeed veeeeeeeeeeery slow. I assume that Mikrotik still have debug/test flag active that slows it that much down.

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?

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… :zany_face:

MikroTik, is that expected?

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.

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

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

Some PSU give only OK (and not OK I guess)
Other PSU gives Ampere and Volt.

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

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