genestealer / Home-Assistant-Configuration

My Home Assistant Configuration - 🏡 Open-source home automation platform running on Python 3 https://home-assistant.io
MIT License
38 stars 15 forks source link

iDrac Module. #3

Open Mushishi opened 1 year ago

Mushishi commented 1 year ago

Hi.

I will start with saying thanks for the iDrac module you have created.

I have done a few changes to get the input voltage and current from both PSU's in my HA, will add that below but i am sure you also know how to add it. :)

I could read that you had some problems with getting the information out from the iDrac, so did also want to let you know that librenms do have some great MIB's they use as there is a lot more we could pull from the iDrac.

Link to there MIB's collections: https://github.com/librenms/librenms/tree/master/mibs/drac

Beside the Temp, Voltage, Currents and Fans that you already read we can also get a state of the internals, as i have shown in the 2 screenshots from my own r720xd.

I am sure we can get the HDD state also but i have flashed my raid card to IT mode as i am running zfs so the iDrac can't see any of my drives anymore.

I might be forking the iDrac script to read the state as i could use that for some automatizations in case a state switch.

state 1 State 2

The changes to get the PSU Voltage and Current:


     - name: "PSU 1 Voltage"
        state: "{{states('sensor.RawDellServerPSU1Voltage')}}"
        unit_of_measurement: V
        device_class: power
        state_class: measurement

      - name: "PSU 2 Voltage"
        state: "{{states('sensor.RawDellServerPSU2Voltage')}}"
        unit_of_measurement: V
        device_class: power .
        state_class: measurement

      - name: "PSU 1 Current"
        state: "{{states('sensor.RawDellServerPSU1Current')}}"
        unit_of_measurement: A
        device_class: power
        state_class: measurement

      - name: "PSU 2 Current"
        state: "{{states('sensor.RawDellServerPSU2Current')}}"
        unit_of_measurement: A
        device_class: power 
        state_class: measurement
Dinth commented 1 year ago

Hi. @Mushishi could you please share your whole configuration? I can't understand anything from the MIB you linked :( Currently im playing with the config provided by @genestealer but there is no power consumption (1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.3) provided via SNMP:

(dinth@dinth-desktop-linux:~$ snmpwalk -v 2c -c xxx 10.10.1.25 1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.1 = INTEGER: 8
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.2 = INTEGER: 196
Mushishi commented 1 year ago

Hi.

Sure here is the config I have in HA right now. I haven't looked into adding more yet so haven't looked that much into the mibs from librenms yet.

############################################################
#
# Monitoring Dell R720 iDRAC 7
# 
# I am using iDRAC enterprise version "DRAC7/8 with Lifecycle Controller Version 2.65.65.65"
# iDRAC with Lifecycle Controller v. 2.65.65.65
# https://www.dell.com/support/home/en-us/drivers/driversdetails?driverid=0ghf4&oscode=naa&productcode=poweredge-r720
#
# 
# Baseoid's discovered through the use of trial and error
# and free scanning tool Paessler SNMP Tester. 
# https://www.paessler.com/tools/snmptester
#
############################################################

sensor:
############################################################
# SNMP Sensors
#
# SNMP sensors are missing features so I create the Raw
# sensors here and then create templated sensors with the
# desired customisation above.
#
# Baseoid's discovered through the use of trial and error
# and free scanning tool Paessler SNMP Tester. 
# https://www.paessler.com/tools/snmptester
#
############################################################
  # Raw Dell Server Power
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerPower
    baseoid: 1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.3
    unit_of_measurement: W

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerPSU1Current
    baseoid: 1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.1
    unit_of_measurement: A
    value_template: "{{((value | float) / 10) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerPSU2Current
    baseoid: 1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.2
    unit_of_measurement: A
    value_template: "{{((value | float) / 10) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerPSU1Voltage
    baseoid: 1.3.6.1.4.1.674.10892.5.4.600.20.1.6.1.26
    unit_of_measurement: V
    value_template: "{{((value | float) / 1000) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerPSU2Voltage
    baseoid: 1.3.6.1.4.1.674.10892.5.4.600.20.1.6.1.27
    unit_of_measurement: V
    value_template: "{{((value | float) / 1000) | float}}"

  # Raw Dell Server Thermals
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerInletTemperature
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.1
    unit_of_measurement: °C
    value_template: "{{((value | float) / 10) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerExhaustTemperature
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.2
    unit_of_measurement: °C
    value_template: "{{((value | float) / 10) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerCPU1Temperature
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.3
    unit_of_measurement: °C
    value_template: "{{((value | float) / 10) | float}}"

  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerCPU2Temperature
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.4
    unit_of_measurement: °C
    value_template: "{{((value | float) / 10) | float}}"

  # Raw Dell Server Fans
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan1
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.1
    unit_of_measurement: RPM
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan2
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.2
    unit_of_measurement: RPM
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan3
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.3
    unit_of_measurement: RPM
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan4
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.4
    unit_of_measurement: RPM
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan5
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.5
    unit_of_measurement: RPM
  - platform: snmp
    host: 10.10.10.253
    port: 161
    community: public
    name: RawDellServerFan6
    baseoid: 1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.6
    unit_of_measurement: RPM

# Sensor integration of energy monitoring.
# Accumulates the server energy used, from the templated sensor (Which in-turn gathers data from the SNMP sensor.)
# This sensor can be added to the home assistant energy dashboard as a statistic sensor for monitoring power consumption over time.
  - platform: integration
    source: sensor.server_power
    name: "Dell Server Energy"
    unit_prefix: k
    unit_time: h
    round: 2

# Templated sensor with all of the customisation features.
# These are the sensors that I show on my interface I don't typically show the raw sensors.
template: # https://www.home-assistant.io/integrations/template/#state-based-template-sensors
  - sensor:
      - name: "Server Power"
        state: "{{states('sensor.RawDellServerPower')}}"
        unit_of_measurement: W
        device_class: power #Power, watts. Not "Energy" i.e. Wh.
        state_class: measurement

      - name: "PSU 1 Voltage"
        state: "{{states('sensor.RawDellServerPSU1Voltage')}}"
        unit_of_measurement: V
        device_class: power #Power, watts. Not "Energy" i.e. Wh.
        state_class: measurement

      - name: "PSU 2 Voltage"
        state: "{{states('sensor.RawDellServerPSU2Voltage')}}"
        unit_of_measurement: V
        device_class: power #Power, watts. Not "Energy" i.e. Wh.
        state_class: measurement

      - name: "PSU 1 Current"
        state: "{{states('sensor.RawDellServerPSU1Current')}}"
        unit_of_measurement: A
        device_class: power #Power, watts. Not "Energy" i.e. Wh.
        state_class: measurement

      - name: "PSU 2 Current"
        state: "{{states('sensor.RawDellServerPSU2Current')}}"
        unit_of_measurement: A
        device_class: power #Power, watts. Not "Energy" i.e. Wh.
        state_class: measurement

      - name: "Server Inlet Temperature"
        state: "{{states('sensor.RawDellServerInletTemperature')}}"
        unit_of_measurement: °C
        device_class: temperature
        state_class: measurement

      - name: "Server Exhaust Temperature"
        state: "{{states('sensor.RawDellServerExhaustTemperature')}}"
        unit_of_measurement: °C
        device_class: temperature
        state_class: measurement

      - name: "Server CPU1 Temperature"
        state: "{{states('sensor.RawDellServerCPU1Temperature')}}"
        unit_of_measurement: °C
        device_class: temperature
        state_class: measurement

      - name: "Server CPU2 Temperature"
        state: "{{states('sensor.RawDellServerCPU2Temperature')}}"
        unit_of_measurement: °C
        device_class: temperature
        state_class: measurement

      - name: "Server Fans Speed Avg"
        state: >
           {{ (( states('sensor.rawdellserverfan1') | float +
                  states('sensor.rawdellserverfan2') | float +
                  states('sensor.rawdellserverfan3') | float +
                  states('sensor.rawdellserverfan4') | float +
                  states('sensor.rawdellserverfan5') | float +
                  states('sensor.rawdellserverfan6') | float) / 6) | round(0) }}
        unit_of_measurement: RPM
        icon: mdi:fan
Mushishi commented 1 year ago

Hi. @Mushishi could you please share your whole configuration? I can't understand anything from the MIB you linked :( Currently im playing with the config provided by @genestealer but there is no power consumption (1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.3) provided via SNMP:

(dinth@dinth-desktop-linux:~$ snmpwalk -v 2c -c xxx 10.10.1.25 1.3.6.1.4.1.674.10892.5.4.600.30.1.6.1
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.1 = INTEGER: 8
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.2 = INTEGER: 196

I think i can see your problem. You only use one PSU correct.?

This is my reply to the same walk with 2 PSU's

 snmpwalk -v 2c -c xxx10.10.10.253 1.3.6.1.4.1.674.10892.5.4.600.30.1.6
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.1 = INTEGER: 8
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.2 = INTEGER: 0
iso.3.6.1.4.1.674.10892.5.4.600.30.1.6.1.3 = INTEGER: 196

But i might be wrong in that thought but still change the baseoid in Dell Server Power to 2 and not 3 at the end as you are lacking 1 sensor that me and @genestealer have at least. :D

Menz01 commented 1 year ago

@Mushishi hello.... so i added your modified yaml file to my system and i am still not getting voltage and current readings from both my PSU's. one is showing and the other is not. image

i also seem to have double the sensors... i think?? and they aren't showing much either. i have the ones i showed above and if i scroll down in my sensors a little more i see... image

any ideas?

Menz01 commented 1 year ago

@Mushishi are you still monitoring this thread by chance?

Hanselljlh commented 11 months ago

Would that be a no?

My only question is do I need to sniff out my own baseoid or are the ones in the configuration universal?

Menz01 commented 11 months ago

Would that be a no?

My only question is do I need to sniff out my own baseoid or are the ones in the configuration universal?

Never got any response to my questions