System Monitoring - How does yours look?

Thank for sharing. I was able to incorporate in my setup and works and looks great!

Hi @Haze,

That dashboard was from over 2 years ago :wink:
I don’t have it like that anymore.
My current dashboard can be found on my GitHub page GitHub - dbloom86/HomeAssistant: My Home Assistant Config
The theme from that dashboard is still the same though. I use a light one during the day and a dark one during the night. You can find those on my GitHub page under the Themes folder.

If you need any help setting up something specific I’ll try to help as best as I can.

1 Like

Thank you for sharing. I will look into it and go from there. I’ll share any functions I add in case they are helpful for you.

Thank you very much for sharing!
In the third column, would it be possible to list only those HACS applications that require an update?
I’ve been looking at the code but I’m not able to make it only appear the entities that have pending updates.
Excuse me for my lousy English.
Thank you.

Nice overview.
Could you share the yaml for the ram, cpu or temp card?

Sure, if you want to display system information from the current machine where HA is running, you need System Monitor integration.
I also found the way to display system information from any other Linux or even Windows machine, if you are interested let me know.

First you need to add this to your sensor configuration.

- platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /
    - type: disk_use
      arg: /
    - type: disk_free
      arg: /
    - type: memory_use_percent
    - type: memory_use
    - type: memory_free
    - type: swap_use_percent
    - type: swap_use
    - type: swap_free
    - type: processor_use
    - type: processor_temperature
    - type: last_boot

After sensor this is how the cards yaml looks like. You will also need:https://github.com/ofekashery/vertical-stack-in-card
https://github.com/kalkih/mini-graph-card
https://github.com/custom-cards/bar-card
https://github.com/iantrich/config-template-card

type: vertical-stack
cards:
  - type: markdown
    content: ' '
    title: 1NUC
  - type: horizontal-stack
    cards:
      - type: custom:vertical-stack-in-card
        cards:
          - type: vertical-stack
            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.processor_use
                name: CPU
                decimals: 0
                hours_to_show: 24
                points_per_hour: 5
                aggregate_func: max
                animate: true
                hour24: true
                height: 150
                line_width: 3
                show:
                  average: true
                  extrema: true
                  labels: true
                color_thresholds:
                  - value: 0
                    color: '#179FE7'
                  - value: 20
                    color: '#28A95D'
                  - value: 40
                    color: goldenrod
                  - value: 60
                    color: '#E58B26'
                  - value: 80
                    color: '#EF302A'
              - type: custom:bar-card
                entity: sensor.processor_use
                name: CPU
                decimal: 0
                height: 40
                show_icon: true
                positions:
                  indicator: outside
                  name: inside
                severity:
                  - color: '#179FE7'
                    from: 0
                    to: 20
                  - color: '#28A95D'
                    from: 20
                    to: 40
                  - color: goldenrod
                    from: 40
                    to: 60
                  - color: '#E58B26'
                    from: 60
                    to: 80
                  - color: '#EF302A'
                    from: 80
                    to: 100
      - type: custom:vertical-stack-in-card
        cards:
          - type: vertical-stack
            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.processor_temperature
                name: Temp
                decimals: 0
                hours_to_show: 24
                points_per_hour: 5
                aggregate_func: max
                animate: true
                hour24: true
                height: 150
                line_width: 3
                show:
                  average: true
                  extrema: true
                  labels: true
                color_thresholds:
                  - value: 0
                    color: '#179FE7'
                  - value: 20
                    color: '#28A95D'
                  - value: 40
                    color: goldenrod
                  - value: 60
                    color: '#E58B26'
                  - value: 80
                    color: '#EF302A'
              - type: custom:bar-card
                entity: sensor.processor_temperature
                name: Temp
                decimal: 0
                height: 40
                icon: mdi:thermometer
                show_icon: true
                positions:
                  indicator: outside
                  name: inside
                severity:
                  - color: '#179FE7'
                    from: 0
                    to: 20
                  - color: '#28A95D'
                    from: 20
                    to: 40
                  - color: goldenrod
                    from: 40
                    to: 60
                  - color: '#E58B26'
                    from: 60
                    to: 80
                  - color: '#EF302A'
                    from: 80
                    to: 100
  - type: custom:vertical-stack-in-card
    cards:
      - type: custom:mini-graph-card
        entities:
          - sensor.memory_use_percent
        name: RAM
        hours_to_show: 24
        points_per_hour: 5
        aggregate_func: max
        animate: true
        hour24: true
        line_width: 3
        show:
          average: true
          extrema: true
          labels: true
        color_thresholds:
          - value: 0
            color: '#179FE7'
          - value: 70
            color: '#E58B26'
          - value: 90
            color: '#EF302A'
      - type: custom:config-template-card
        variables:
          MEMORY_TOTAL: >-
            Number((parseFloat(states['sensor.memory_use'].state / 1024) +
            parseFloat(states['sensor.memory_free'].state / 1024)).toFixed(2))
        entities:
          - sensor.memory_use
          - sensor.memory_free
        card:
          type: custom:bar-card
          entity: sensor.memory_use_percent
          name: >-
            ${'RAM ' + parseFloat(states['sensor.memory_use'].state /
            1024).toFixed(2) + '/' + MEMORY_TOTAL + ' GiB (free ' +
            parseFloat(states['sensor.memory_free'].state / 1024).toFixed(2) + '
            GiB)'}
          height: 40
          show_icon: true
          positions:
            indicator: outside
            name: inside
          severity:
            - color: '#179FE7'
              from: 0
              to: 70
            - color: '#E58B26'
              from: 70
              to: 90
            - color: '#EF302A'
              from: 90
              to: 100
          style: |
            ha-card {
              border: 0px;
            }
      - type: custom:config-template-card
        variables:
          SWAP_TOTAL: >-
            Number((parseFloat(states['sensor.swap_use'].state / 1024) +
            parseFloat(states['sensor.swap_free'].state / 1024)).toFixed(2))
        entities:
          - sensor.swap_use
          - sensor.swap_free
        card:
          type: custom:bar-card
          entity: sensor.swap_use_percent
          name: >-
            ${'Swap ' + parseFloat(states['sensor.swap_use'].state /
            1024).toFixed(2) + '/' + SWAP_TOTAL + ' GiB (free ' +
            parseFloat(states['sensor.swap_free'].state / 1024).toFixed(2) + '
            GiB)'}
          height: 40
          icon: mdi:swap-horizontal
          positions:
            indicator: outside
            name: inside
          severity:
            - color: '#179FE7'
              from: 0
              to: 70
            - color: '#E58B26'
              from: 70
              to: 90
            - color: '#EF302A'
              from: 90
              to: 100
          style: |
            ha-card {
              border: 0px;
            }
  - type: custom:config-template-card
    variables:
      DISK_TOTAL: >-
        Number((parseFloat(states['sensor.disk_use'].state) +
        parseFloat(states['sensor.disk_free'].state)).toFixed(2))
    entities:
      - sensor.disk_use
      - sensor.disk_free
    card:
      type: custom:vertical-stack-in-card
      cards:
        - type: custom:bar-card
          entity: sensor.disk_use_percent
          name: >-
            ${'Disk ' + states['sensor.disk_use'].state + '/' + DISK_TOTAL + '
            GiB (free ' +
            parseFloat(states['sensor.disk_free'].state).toFixed(1) + ' GiB)'}
          height: 40
          show_icon: true
          positions:
            indicator: outside
            name: inside
          severity:
            - color: '#179FE7'
              from: 0
              to: 75
            - color: '#E58B26'
              from: 75
              to: 90
            - color: '#EF302A'
              from: 90
              to: 100
3 Likes

Hi, this modification should work for you

type: vertical-stack
cards:
  - type: entities
    card_mod:
      style: |
        ha-card {
          border-style: none;
          background: none;
          --mush-title-padding: 0px 0px 0px;
        }  
    entities:
      - type: custom:mushroom-title-card
        title: HACS
        subtitle: >-
          Installata v{{ state_attr('update.hacs_update', 'installed_version')
          }} - Ultima v{{ state_attr('update.hacs_update', 'latest_version') }}
      - type: section
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            icon: mdi:web
            icon_color: blue
            content: Ultime modifiche
            tap_action:
              action: url
              url_path: https://github.com/hacs/integration/releases
          - type: template
            entity: update.hacs_update
            content: '{{ state_attr(''update.hacs_update'', ''installed_version'') }}'
            icon_color: green
            icon: mdi:package-variant-closed
            tap_action:
              action: none
          - type: template
            entity: update.hacs_update
            content: '{{ state_attr(''update.hacs_update'', ''latest_version'') }}'
            icon_color: orange
            icon: mdi:package-variant-closed
            tap_action:
              action: none
      - type: section
  - type: custom:auto-entities
    card:
      type: entities
      card_mod:
        style: |
          ha-card {
            border-style: none;
            background: none;
          }
          div.card-content {
            padding: 0px;
          }
    filter:
      template: >
        {%- set dev = namespace() %} {%- set dev.name = '' %} {%- set dev.update
        = '' %}

        {%- for devid in (integration_entities('hacs') | map('device_id') |
        list) %}
          {%- set dev.name = device_attr(devid, "name") %}
          {%- for ent in device_entities(devid) %}
            {%- if (ent.find("update") | int>=0) %}
              {%- set dev.update = ent %}
            {%- endif %}
          {%- endfor %}
          {%- if is_state(dev.update, 'on') %}
            {{-
              { 'type': 'custom:mushroom-update-card',
                'entity': dev.update,
                'name': dev.name,
                'show_buttons_control': true,
                'collapsible_controls': false,
                'layout': 'horizontal'
              }
            }},
          {%- endif %}
        {%- endfor %}

Which HA installation do you run ?, i have Homeassistant_os, in VMware on windows, so i guess the CPU is for/calculated in the VM, as i also don’t see any CPU-Temp … so how did you/would you display this system-info from a Windows host ?

Never mind, i decided i was out on a “side-trip” ( or maybe it just was a mood trip ), now im back with additional reduced “footprint” , Instead I removed 2 views, 2 integrations, 5 cards, and minimized my router-/ and Tapo integration, to a minimum of entities :laughing: … so why look at colorful graph in HA, when there is no need to monitor it, it’s just a few clicks “away” anyhow

With help of https://github.com/AlexxIT/PythonScriptsPro and by enabling OpenSSH on Windows. I am able to reach out any Windows machine and get whatever info I need (ssh port need to be added to the firewall so that you can reach it with IP or hostname). I needed to write commands of course that are returning values like CPU usage for example. Same applies for Linux computers in my house. I can write a guide and steps if needed?

This is how it looks for my Windows IntelNUC machine.

1 Like

Mine is like this:


Unlike others, I only have like this one system and don’t want to keep track of all my stuff like the Core or Supervisor. If you have tips, let me know!

1 Like

Hi @RomanFdez

Would it be possible to share your code for your view? Loving what you have done with it, and would be interested to see how you have done certain bits of it.

Thanks!

Thanks for sharing, can I ask what the packages entity displays? is this system updates?

it is posible you share the code? thanks!

Yes it is system updates on the host machine, I am using python script on the host system as well that is storing information about package updates into txt file. After that I am using PythonScriptsPro to display information in HA. Let me know if you are interested in full code and steps.

This is how it looks when there are packages to be updated. In case of more then one package, they are divided with comma.

image

Sure, but please tell me about the specific part o anything. It’s too much code the entire view.

Would be really interested in seeing how you coded the left hand column, and also one of the bar charts e.g. for HDD

Thanks!

Screenshot 2023-02-22 at 11.43.25

1 Like

You can see how I did it here.

@RomanFdez - Sorry forgot to tag you!

Thanks for the reply, I’m very interested. I spent hours this week trying every command under the sun I could find to try and achieve this… Help! :smile:

Here is the guidance.

1.First create file on HA host machine where HA is installed:
/usr/local/bin/updatePackagesStatus.pl

With this code:

use File::Which;
use strict;

if(which('aptitude')) {
  open ( FILE, 'aptitude -F%p --disable-columns search ~U |') or die "$!\n";
} elsif (which('checkupdates')) {
  open ( FILE, 'checkupdates |' ) or die "$!\n";
} else {
  die "Error: neither checkupdates nor aptitude seem to be available\n";
}

my $pkgnbr = 0;
my $pkglist = "";
while (<FILE>){
  chomp;
  $pkglist = "$pkglist $_";+
  $pkgnbr++;
}
close (FILE);
open ( FILE, '> /home/amilino/updatestatus.log' ) or die "$!\n";
  print FILE "$pkglist   $pkgnbr upgradable(s)\n";
close (FILE);

This script is checking for updates and storing in /home/amilino/updatestatus.log information that you will later on use in HA. Of course you can change location and name of your log file.

2.Then create file (as well on host machine).
/etc/apt/apt.conf.d/99monitor

With this code:

# Update packages status
APT::Update::Post-Invoke {
    "echo 'Update Packages Status' && /usr/local/bin/updatePackagesStatus.pl";
};

Basically it will execute our script every time sudo apt-get update is executed. You can as well test it by running sudo apt-get update and see if you have any text created in /home/amilino/updatestatus.log file.

3.I also added in /etc/crontab this:

*/10 ** * * root apt-get update &

So that every 10 minutes apt-get update is executed automatically.

4.Now that your are done with HA host machine, you need to install PythonScriptsPro in HA.

5.You will also need generic script that can execute command and return output from any machine on the network via SSH.
I stored script here (be careful, this is inside HA docker, best to use File editor addon for adding this):
/config/scripts/remote_ssh_command.py

With this code:

from paramiko import SSHClient, AutoAddPolicy

host = self.config.get("host")
port = self.config.get("port")
username = self.config.get("user")
password = self.config.get("pass")
command = self.config.get("cmd")

client = SSHClient()
client.set_missing_host_key_policy(AutoAddPolicy())
client.connect(host, port, username, password)
stdin, stdout, stderr = client.exec_command(command)
resp = stdout.read()
stderr.read()
client.close()

self.state = f"\n{ resp.decode()[:250] }"
self._attr_extra_state_attributes = { "response": resp.decode() }

6.Add sensor.

- platform: python_script
  name: NUC Updates
  unique_id: "nuc_updates"
  icon: mdi:package-up
  scan_interval: 120
  file: scripts/remote_ssh_command.py
  host: !secret nuc_host
  port: !secret nuc_port
  user: "amilino"
  pass: !secret nuc_amilino_password
  cmd: >
    cat /home/amilino/updatestatus.log

7.If you want to place sensitive data into secrets file, you can have this in your /config/secrets.yaml:

nuc_host: 192.168.188.203
nuc_port: 20541
nuc_amilino_password: your_password

If not, then just replace !secret nuc_amilino_password with real password in previous step (same for other properties !secret nuc_host and !secret nuc_port).

8.And finally add card.

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: sensor.nuc_updates
        type: custom:template-entity-row
        name: Package(s)
        state: '{{ state_attr("sensor.nuc_updates", "response").split("   ")[1] }}'
        secondary: null
  - type: markdown
    content: |
      {{ state_attr("sensor.nuc_updates", "response").split("   ")[0] }}
    title: null
    style: |
      ha-card {
        border: 0px;
        {% if '0 upgradable(s)' in states('sensor.nuc_updates') -%}
          display: none
        {% endif %}
      }

I think that is all, hope I haven’t missed anything. Good thing is that you can use this setup to get any information from any server having SSH (OpenSSH on Windows is also working, so you can get system information about any windows machine), but you need to know how to construct command that is returning you wanted data, in this example cat command is used just to return content of log file. If you need some basic examples for linux and windows I can write it here as well, you can see from my example what I am returning and displaying in my cards.

This is for example if you want to get Distribution of your host machine:

- platform: python_script
  name: NUC Distribution
  unique_id: "nuc_distribution"
  icon: mdi:monitor
  scan_interval: 63072000 #2 Years in seconds
  file: scripts/remote_ssh_command.py
  host: !secret nuc_host
  port: !secret nuc_port
  user: "amilino"
  pass: !secret nuc_amilino_password
  cmd: >
    grep -Po "(?<=^PRETTY_NAME=).+" /etc/os-release | sed 's/"//g'

For this sensor I added very big interval, because this information is static and you don’t need to update your sensor every few seconds.

Let me know if you have any questions. :slight_smile: