mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-31 00:04:51 +02:00
global-functions: introduce and use $DeviceInfo
This commit is contained in:
parent
23b38fa15a
commit
94581741f4
5 changed files with 41 additions and 47 deletions
|
@ -294,3 +294,32 @@
|
|||
|
||||
:delay ([ $GetRandom $1 ] . "s");
|
||||
}
|
||||
|
||||
# get readable device info
|
||||
:global DeviceInfo do={
|
||||
:global Identity;
|
||||
|
||||
:local BoardName [ / system resource get board-name ];
|
||||
:local RouterBoard [ / system routerboard get ];
|
||||
:local Update [ / system package update get ];
|
||||
|
||||
:local Info ( \
|
||||
"Hostname: " . $Identity . "\n" . \
|
||||
"Board name: " . $BoardName);
|
||||
:if ($RouterBoard->"routerboard" = true) do={
|
||||
:set Info ($Info . "\n" . \
|
||||
"Model: " . $RouterBoard->"model" . "\n" . \
|
||||
"Serial number: " . $RouterBoard->"serial-number");
|
||||
}
|
||||
:set Info ($Info . "\n" . \
|
||||
"RouterOS:\n" . \
|
||||
" Channel: " . $Update->"channel" . "\n" . \
|
||||
" Installed: " . $Update->"installed-version");
|
||||
:if ([ :typeof ($Update->"latest-version") ] != "nothing" && \
|
||||
$Update->"installed-version" != $Update->"latest-version") do={
|
||||
:set Info ($Info . "\n" . \
|
||||
" Available: " . $Update->"latest-version");
|
||||
}
|
||||
|
||||
:return $Info;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue