diff options
Diffstat (limited to 'global-functions')
-rw-r--r-- | global-functions | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/global-functions b/global-functions index 1b73b0a..87cda40 100644 --- a/global-functions +++ b/global-functions @@ -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; +} |