global-functions: $DeviceInfo: add SNMP location and contact

This commit is contained in:
Christian Hesse 2023-12-04 09:28:59 +01:00
parent aba4770395
commit 15e347303b

View file

@ -219,16 +219,21 @@
:global IfThenElse; :global IfThenElse;
:global FormatLine; :global FormatLine;
:local License [ /system/license/get ];
:local Resource [ /system/resource/get ]; :local Resource [ /system/resource/get ];
:local RouterBoard; :local RouterBoard;
:do { :do {
:set RouterBoard [[ :parse "/system/routerboard/get" ]]; :set RouterBoard [[ :parse "/system/routerboard/get" ]];
} on-error={ } } on-error={ }
:local License [ /system/license/get ]; :local Snmp [ /snmp/get ];
:local Update [ /system/package/update/get ]; :local Update [ /system/package/update/get ];
:return ( \ :return ( \
[ $FormatLine "Hostname" $Identity ] . "\n" . \ [ $FormatLine "Hostname" $Identity ] . "\n" . \
[ $IfThenElse ([ :len ($Snmp->"location") ] > 0) \
([ $FormatLine "Location" ($Snmp->"location") ] . "\n") ] . \
[ $IfThenElse ([ :len ($Snmp->"contact") ] > 0) \
([ $FormatLine "Contact" ($Snmp->"contact") ] . "\n") ] . \
[ $FormatLine "Board name" ($Resource->"board-name") ] . "\n" . \ [ $FormatLine "Board name" ($Resource->"board-name") ] . "\n" . \
[ $FormatLine "Architecture" ($Resource->"architecture-name") ] . "\n" . \ [ $FormatLine "Architecture" ($Resource->"architecture-name") ] . "\n" . \
[ $IfThenElse ($RouterBoard->"routerboard" = true) \ [ $IfThenElse ($RouterBoard->"routerboard" = true) \