czerwonk / junos_exporter

Exporter for devices running JunOS to use with https://prometheus.io/
MIT License
198 stars 81 forks source link

feature request: Power usage for EX #206

Open BeArchiTek opened 1 year ago

BeArchiTek commented 1 year ago

Hello,

Smaller junos device like EX3400 or EX4300 don't reported their power under show chassis environment pem but it's possible to get their consumption under show chassis power-budget-statistics

See below for the command

EX3400-48T

> show chassis power-budget-statistics
fpc 0:
-------------------------------------------------------------------------
            PSU 0    (JPSU-150W-AC-AFO   )           :     120 W   Online
            PSU 1    (JPSU-150W-AC-AFO   )           :     120 W   Online
            Power redundancy configuration           :     N+0
            Total power supplied by all online PSUs  :     240 W
            Base power reserved                      :     120 W
            Non-PoE power being consumed             :      42 W
> show chassis power-budget-statistics | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/18.4R3/junos">
    <power-budget-information xmlns="http://xml.juniper.net/junos/18.4R3/junos-chassis" junos:style="terse">
        <power-budget>
            <line-card-slot>0</line-card-slot>
            <power-supply>
                <psu-slot>0</psu-slot>
                <psu-type>JPSU-150W-AC-AFO</psu-type>
                <power-supplied-psu>120</power-supplied-psu>
                <power-supply-state>Online</power-supply-state>
            </power-supply>
            <power-supply>
                <psu-slot>1</psu-slot>
                <psu-type>JPSU-150W-AC-AFO</psu-type>
                <power-supplied-psu>120</power-supplied-psu>
                <power-supply-state>Online</power-supply-state>
            </power-supply>
            <psu-redundancy-config>N+0</psu-redundancy-config>
            <total-power-supplied>240</total-power-supplied>
            <base-power>120</base-power>
            <actual-power-used>42</actual-power-used>
        </power-budget-information>
        <cli>
            <banner>{master:0}</banner>
        </cli>
    </rpc-reply>

EX4300-48T (stack)

 > show chassis power-budget-statistics
fpc 0:
-------------------------------------------------------------------------
            PSU 0    (JPSU-350-AC-AFO-A  )           :     350 W   Online
            PSU 1    (JPSU-350-AC-AFO-A  )           :     350 W   Online
            Power redundancy configuration           :     N+0
            Total power supplied by all online PSUs  :     665 W
            Base power reserved                      :     175 W
            Non-PoE power being consumed             :      74 W
fpc 1:
-------------------------------------------------------------------------
            PSU 0    (JPSU-350-AC-AFO-A  )           :     350 W   Online
            PSU 1    (JPSU-350-AC-AFO-A  )           :     350 W   Online
            Power redundancy configuration           :     N+0
            Total power supplied by all online PSUs  :     665 W
            Base power reserved                      :     175 W
            Non-PoE power being consumed             :      69 W
> show chassis power-budget-statistics | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.4R0/junos">
    <power-budget-information xmlns="http://xml.juniper.net/junos/20.4R0/junos-chassis" junos:style="terse">
        <line-card-slot>0</line-card-slot>
        <psu-slot>0</psu-slot>
        <psu-type>JPSU-350-AC-AFO-A</psu-type>
        <power-supplied-psu>350</power-supplied-psu>
        <power-supply-state>Online</power-supply-state>
        <psu-slot>1</psu-slot>
        <psu-type>JPSU-350-AC-AFO-A</psu-type>
        <power-supplied-psu>350</power-supplied-psu>
        <power-supply-state>Online</power-supply-state>
        <psu-redundancy-config>N+0</psu-redundancy-config>
        <total-power-supplied>665</total-power-supplied>
        <base-power>175</base-power>
        <actual-power-used>74</actual-power-used>
        <line-card-slot>1</line-card-slot>
        <psu-slot>0</psu-slot>
        <psu-type>JPSU-350-AC-AFO-A</psu-type>
        <power-supplied-psu>350</power-supplied-psu>
        <power-supply-state>Online</power-supply-state>
        <psu-slot>1</psu-slot>
        <psu-type>JPSU-350-AC-AFO-A</psu-type>
        <power-supplied-psu>350</power-supplied-psu>
        <power-supply-state>Online</power-supply-state>
        <psu-redundancy-config>N+0</psu-redundancy-config>
        <total-power-supplied>665</total-power-supplied>
        <base-power>175</base-power>
        <actual-power-used>70</actual-power-used>
    </power-budget-information>
    <cli>
        <banner>{master:1}</banner>
    </cli>
</rpc-reply>

Best regards,