{
    :local ifWanted   "auto-on|forced-on|off"; # it can be one or more, with | as a separator, between auto-on, forced-on and off
    :local ifAlsoIdle  true; # Can be true or false. If true displays also the poe capable interface on idle status
    :local ifMode      true; # Can be true or false. If true displays also how the interface mode is set
    :local pTotalCurr 0
    :local pTotalPowr 0
    :local div do={
        :local in  [:tostr $1]
        :local sym [:tostr $2]
        :local int [:pick $in 0 ([:len $in] - 1)]
        :local dec [:pick $in ([:len $in] - 1) [:len $in]]
        :local ret "$int.$dec$sym"
        :if ($ret = ".0$sym") do={:set ret "0.0$sym"}
        :return    $ret
    }
    :local form do={
        :local in   [:tostr $1]
        :local sym  [:tostr $2]
        :local temp "    $in"
        :return     "$[:pick $temp ([:len $temp] - 4) [:len $temp]]$sym"
    }
    :put ("POE Status:")
    /interface ethernet poe
    :foreach line in=[monitor [find where poe-out~$ifWanted] once as-value] do={
        :local ifName   ($line->"name")
        :local ifPOut   ($line->"poe-out")
        :local ifPVol   ($line->"poe-voltage")
        :local ifStatus ($line->"poe-out-status")
        :local pOutTens [$div ($line->"poe-out-voltage") "V"]
        :local pOutCurr [$form ($line->"poe-out-current") "mA"]
        :local pOutPowr [$div ($line->"poe-out-power") "W"]
        :set pTotalCurr ($pTotalCurr + ($line->"poe-out-current"))
        :set pTotalPowr ($pTotalPowr + ($line->"poe-out-power"))
        :local ifStrMod ""
        :if ($ifStatus = "powered-on") do={
            :if ($ifMode) do={:set ifStrMod " Mode: $ifPVol\t $ifPOut\t $ifStatus\t|"}
            :put ("Interface: $ifName\t|$ifStrMod $pOutTens | $pOutCurr | $pOutPowr")
        } else={
            :if ($ifAlsoIdle) do={
                :set ifStrMod $ifStatus
                :if ($ifMode) do={:set ifStrMod "| Mode: $ifPVol\t $ifPOut\t $ifStatus"}
                :put ("Interface: $ifName\t$ifStrMod")
            }
        }
    }
    :local sysPSU ""
    /system health
    :do {
        :local p1v [get [find name="psu1-voltage"] value]
        :set sysPSU "PSU low $p1v V"
        :do {
            :local p2v [get [find name="psu2-voltage"] value]
            :set sysPSU "$sysPSU | PSU high $p2v V"
        } on-error={}
    } on-error={
        :set sysPSU ([get [find name="voltage"] value] . "V")
    }
    :put ("Total: $[$form $pTotalCurr "mA"] | $[$div $pTotalPowr "W"]")
    :put ("Routerboard: $sysPSU")
}
