diff options
author | Christian Hesse <mail@eworm.de> | 2019-09-12 13:45:44 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-09-12 21:29:41 +0200 |
commit | 94581741f42d809a1364accda57cdf1d57519ffa (patch) | |
tree | f9b003f5622f5c2871e65cbba7c2f4424403e942 /global-functions | |
parent | 23b38fa15ab7c0b39dfeabbf2f45c69f94115ec6 (diff) |
global-functions: introduce and use $DeviceInfo
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; +} |