Home Assistant => SNMP /for Unifi Devices, TrueNAS, HP Printers etc

Hi all
Busy rolling snmp monitoring out across my network.
one set of online note say I need to configure "sensor", another says device_tracker ?
... sensor seem to be the more correct one... the more I read.

Any chance Anyone has done some nice cards for their Unifi switches/AP's etc, thats willing to share.

I got 5 switches, 3 is managed, so have snmp on them and then 3 x AP's.
This is the start of a bigger snmp roll out, want to monitor my TrueNAS, a large Vertiv Liebert UPS, and some smaller lab "TopTon" cluster nodes and printers

G

device_tracker:
# Unifi CORE / 24 Port
  - platform: snmp
    name: "USW Pro Max 24 PoE Switch Uptime - 24 Port"
    host: 172.16.10.2     # Replace with your switch IP
    community: public    # Replace with your SNMP community string
    baseoid: 1.3.6.1.2.1.1.3.0
    unit_of_measurement: "days"
    value_template: >
      {{ (value | float / 8640000) | round(2) }}

  - platform: snmp
    name: "USW Pro Max 24 PoE Switch Model"
    host: 172.16.10.2    # Replace with your switch IP
    community: public
    baseoid: 1.3.6.1.2.1.1.1.0
    accept_errors: true

    name: "USW Pro Max 24 PoE Switch Temp"
    host: 172.16.10.2
    baseoid: 1.3.6.1.4.1.19865.1.2.1.4.0 # Example OID
    community: public

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 1 Status"
    host: 172.16.10.2    # Replace with your switch IP
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.7.1  # .1 at the end represents Port 1

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 1 Bytes In"
    host: 172.16.10.2    # Replace with your switch IP
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.10.1  # .1 at the end represents Port 1
    unit_of_measurement: "bytes"    

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 1 Bytes Out"
    host: 172.16.10.2    # Replace with your switch IP
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.16.1  # .1 at the end represents Port 1
    unit_of_measurement: "bytes"    

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 2 Status"
    host: 172.16.10.2   
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.7.2  

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 2 Bytes In"
    host: 172.16.10.2   
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.10.2 
    unit_of_measurement: "bytes"

  - platform: snmp
    name: "USW Pro Max 24 PoE Port 2 Bytes Out"
    host: 172.16.10.2   
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.16.2 
    unit_of_measurement: "bytes"

I would say that is going to be a lot of SNMP sensors which the integration isn't the best for as it is synchronous and single-threaded in many ways. Basically when HA polls a switch it sends a request and waits for a response, if the switch is slow to respond or a packet is dropped the polling task 'hangs'.

What I would do, is set-up InfluxDB with Telegraf to collect the data from the switch. Then use Grafana as a front end for creating dashboards / panels and use an iframe to embed these within the Home Assistant dashboard.

With the above set-up, you can now choose to use either SNMP or the InfluxDB integration to create a sensor just for the values needed for automations.

... No idea how I would make influxdb collect snmp data from switches/ups's/NAS's... etc
for now I'm using the switches as data source as I know they are exposing the data atm...
longer term I got more/other devices I need to get working and get to expose snmp data...
one of these is integrate NUT with HA.
never used Grafana -> iFrame -> HA...

1 Like