System Monitoring - How does yours look?

How are you measuring CPU Load/ CPU Usage?

You can use the system monitor integration. Use in your configuration.yaml this entries:

# SystemMonitor
  - platform: systemmonitor
    resources:
      - type: processor_use
      - type: load_1m
      - type: load_5m
      - type: load_15m

1 Like

Thanks, just found the docs here:

I’ll give it a try.

I was using ‘iostat’ to monitor CPU load but found it wasn’t very accurate for me.

Would you mind sharing your UNRAID config.
I am running HASSIO in a VM on UNRAID but would like to monitor the server conditions.
Thank you
carltonb

How is your sensor coded for potential breaking changes?

@Vasco
image

1 Like

Made an update for more system informations. Maybe they are interesting for some guys.

Here the code in configuration.yaml:

# COMMANDLine
  - platform: command_line
    name: NUC CPU Temperature Core Zone 0
    command: "cat /sys/devices/virtual/thermal/thermal_zone0/temp"
    value_template: '{{ value | multiply(0.001) | round(2) }}'
    unit_of_measurement: '°C'
  - platform: command_line
    name: NUC CPU Temperature Core Zone 2
    command: "cat /sys/devices/virtual/thermal/thermal_zone2/temp"
    value_template: '{{ value | multiply(0.001) | round(2) }}'
    unit_of_measurement: '°C'
  - platform: command_line
    name: NUC CPU Frequency 0
    command: "cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq"
    value_template: '{{ value | multiply(0.000001) | round(2) }}'
    unit_of_measurement: 'GHz'
  - platform: command_line
    name: NUC CPU Frequency 1
    command: "cat /sys/devices/system/cpu/cpufreq/policy1/scaling_cur_freq"
    value_template: '{{ value | multiply(0.000001) | round(2) }}'
    unit_of_measurement: 'GHz'
  - platform: command_line
    name: Linux version
    command: "cat /proc/version"
    value_template: '{{value|truncate(30,True)}}'
  - platform: command_line
    name: NUC CPU Governor
    command: "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
  - platform: command_line
    name: NUC CPU min. frequency
    command: "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
    value_template: '{{ value | multiply(0.001) | round(2) }}'
    unit_of_measurement: 'MHz - Min Freq'
  - platform: command_line
    name: NUC CPU max. frequency
    command: "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"
    value_template: '{{ value | multiply(0.001) | round(2) }}'
    unit_of_measurement: 'MHz - Max Freq'
  - platform: command_line
    name: BIOS Vendor
    command: "cat /sys/class/dmi/id/bios_vendor"
    value_template: '{{value|truncate(45,True)}}'
  - platform: command_line
    name: SYS Vendor
    command: "cat /sys/class/dmi/id/product_name"
    value_template: '{{value|truncate(45,True)}}'
  - platform: command_line
    name: CPU online
    command: "cat /sys/devices/system/cpu/online"
    value_template: '{{value|truncate(45,True)}}'
  - platform: command_line
    name: CPU offline
    command: "cat /sys/devices/system/cpu/offline"
    value_template: '{{value|truncate(45,True)}}'
  - platform: command_line
    name: NUC Bios version
    command: "cat /sys/class/dmi/id/bios_version"
  - platform: command_line
    name: NUC board name
    command: "cat /sys/class/dmi/id/board_name"

# SystemMonitor
  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /home
      - type: disk_use
        arg: /home
      - type: disk_free
        arg: /home
      - type: memory_free
      - type: memory_use
      - type: memory_use_percent
      - type: swap_use_percent
      - type: swap_use
      - type: swap_free
      - type: load_1m
      - type: load_5m
      - type: load_15m
      - type: network_in
        arg: enp3s0
      - type: network_out
        arg: enp3s0
      - type: throughput_network_in
        arg: enp3s0
      - type: throughput_network_out
        arg: enp3s0
      - type: packets_in
        arg: enp3s0
      - type: packets_out
        arg: enp3s0
      - type: processor_use
      - type: last_boot
      - type: ipv6_address
        arg: enp3s0      
      - type: ipv4_address
        arg: enp3s0

Enjoy! :v:

4 Likes

@LogisticaLux nice work!
would you mind share how did pull the data about the snapshots?
can you share the configuration code?
image

Thank you!!

@yoni3210 Thanks! :grinning:

Just install the addon Hass.io Google Drive Backup than you have those sensors available.
After the install put a check on the desired sensors.

Would you mind sharing the script. I have been a heavy user of nextcloud for 4+ years and this would be a big help in monitoring my connection.

Thanks
carltonb

Currently a work in progress! :smile:

7 Likes

Would you mind sharing the code fot the Unifi Device. I have tried something similar but could not get it to display properly.
Thank you.
carltonb

Look nice. Quick question, how do you retrieve the wifi and radio informations from WAP.

Thanks @mistrovly!

I retrieve the info through SNMP using a few different OIDs:
Model 1.3.6.1.4.1.41112.1.6.3.3.0
Firmware 1.3.6.1.4.1.41112.1.6.3.6.0
Total Memory 1.3.6.1.4.1.10002.1.1.1.1.1.0
Free Memory 1.3.6.1.4.1.10002.1.1.1.1.2.0
CPU Load 1min 1.3.6.1.4.1.10002.1.1.1.4.2.1.3.1
CPU Load 5min 1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2
CPU Load 10min 1.3.6.1.4.1.10002.1.1.1.4.2.1.3.3
Uptime 1.3.6.1.4.1.41112.1.6.3.5.0

For the ESSID details it depends on which one you want. The MIBBrowser I use I put in 1.3.6.1.4.1.41112.1.6.1.2.1.6 then did a GetNext operation to view the values of 1.3.6.1.4.1.41112.1.6.1.2.1.6.1 through 1.3.6.1.4.1.41112.1.6.1.2.1.6.5

Channel Info 1.3.6.1.4.1.41112.1.6.1.2.1.4
Tx Power 1.3.6.1.4.1.41112.1.6.1.2.1.21

Which ever ESSID you are interested take the last number from the OID and append it to the OID for Channel Info and Tx Power and you’ll get those specific details.

For example my ESSID was at 1.3.6.1.4.1.41112.1.6.1.2.1.6.3 so I just append .3 to Channel Info (1.3.6.1.4.1.41112.1.6.1.2.1.4.3) and Tx Power (1.3.6.1.4.1.41112.1.6.1.2.1.21.3)

Hope this is clear

2 Likes

Hi @carltonb!

Here is part of my lovelace yaml:

          - type: custom:vertical-stack-in-card
            cards:
              - type: horizontal-stack
                cards:
                  - type: vertical-stack
                    cards:
                    - type: markdown
                      content: |
                        <font color="#03a9f4">UniFi [[ sensor.ap_model.state ]] ------- Firmware: [[ sensor.ap_firmware.state ]]</font>
                    - type: horizontal-stack
                      cards:
                      - type: custom:card-modder
                        card: 
                          type: picture
                          image: /local/ubiquiti_networks_uap_ac_lite_unifi_ap_ac_1184038.jpg
                        style:                 
                          border-radius: 5px
                              
                      - type: vertical-stack
                        cards:
                          - type: custom:bar-card
                            title_position: inside
                            title: AP Up Time
                            align: center
                            padding: 4px
                            indicator: off
                            card_style: 
                              border-radius: 5px
                            entities:
                              - entity: sensor.ap_uptime_conv

                          - type: custom:bar-card
                            align: split
                            title_position: inside
                            show_icon: true
                            indicator: right
                            padding: 4px
                            card_style: 
                              border-radius: 5px
                            entities:
                              - entity: sensor.ap_used_memory_percent
                                title: Memory
                                icon: mdi:memory
                                icon_position: inside

              - entity: sensor.ap_cpu_load_10min
                type: custom:multiple-entity-row
                name: 'CPU Load (1, 5, & 10 min)'
                icon: mdi:memory
                primary:
                  entity: sensor.ap_cpu_load_1min
                  name: false
                secondary:
                  entity: sensor.ap_cpu_load_5min
                  name: false

              - entity: sensor.ap_essid_1
                type: custom:multiple-entity-row
                name: Radio 1
                icon: mdi:wifi
                hide_state: false
                primary:
                  entity: sensor.ap_channel_1
                  name: Channel
                secondary:
                  entity: sensor.ap_tx_power_1
                  name: Tx Power
                  
              - entity: sensor.ap_essid_2
                type: custom:multiple-entity-row
                name: Radio 2
                icon: mdi:wifi
                hide_state: false
                primary:
                  entity: sensor.ap_channel_2
                  name: Channel
                secondary:
                  entity: sensor.ap_tx_power_2
                  name: Tx Power
                  
              - entity: sensor.ap_essid_3
                type: custom:multiple-entity-row
                name: Radio 3
                icon: mdi:wifi
                hide_state: false
                primary:
                  entity: sensor.ap_channel_3
                  name: Channel
                secondary:
                  entity: sensor.ap_tx_power_3
                  name: Tx Power

Most of the entities are populated with info directly from the SNMP query. I did have to convert the uptime value I retrieve from SNMP though.

Here is how I converted the time value:

  - platform: template
    sensors:
      ap_uptime_conv:
        value_template: >-
          {% set time = (states('sensor.ap_uptime') | int) | int %}
          {% set minutes = ((time % 3600) / 60) | int%}
          {% set hours = ((time % 86400) / 3600) | int %}
          {% set days = (time / 86400) | int %}
            {%- if time < 60 -%}
              Less then 1 min
              {%- else -%}
              {%- if days > 0 -%}
                {{ days }}d
              {%- endif -%}
              {%- if hours > 0 -%}
                {%- if days > 0 -%}
                  {{ ' ' }}
                {%- endif -%}
                {{ hours }}hr
              {%- endif -%}
              {%- if minutes > 0 -%}
                {%- if days > 0 or hours > 0 -%}
                  {{ ' ' }}
                {%- endif -%}
                {{ minutes }}min
              {%- endif -%}
            {%- endif -%}
3 Likes

Thank you. I just started to get into SNMP in the last few days. I will have to experiment more with it.
Greatly appreciated and Happy Holidays.
carltonb

Another question for you; do you configure your snmp at the unifi controller or on at the AP itself

How are you monitoring the ERX?

I configured SNMP from the unifi controller. But it just pushes (provisions) the configuration to the AP itself. When I configure Home Assistant, the IP address is of the AP.

sensor:
  - platform: snmp
    name: 'AP Model'
    host: 1.1.1.1
    community: 'private'
    baseoid: 1.3.6.1.4.1.41112.1.6.3.3.0

thank you for your reply