From d980f602a795c1c343478c1c5f0d7a0113cfe4c2 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Wed, 18 Feb 2026 22:28:22 -0500 Subject: [PATCH] Refactor Docker infrastructure dashboard by removing deprecated Portainer agent entities and associated button configurations. Update YAML files to streamline sections and enhance clarity, including the removal of redundant top chips includes across various sections. --- .../docker_container_restart_include.yaml | 10 - .../docker_container_rows_include.yaml | 9 - .../partials/docker_containers_sections.yaml | 2 - .../partials/home_sections.yaml | 43 ++++- .../partials/mariadb_sections.yaml | 2 - .../partials/pihole_sections.yaml | 2 - .../partials/proxmox_sections.yaml | 2 - .../partials/website_health_sections.yaml | 6 +- config/packages/docker_infrastructure.yaml | 180 ++++-------------- 9 files changed, 78 insertions(+), 178 deletions(-) diff --git a/config/dashboards/infrastructure/partials/docker_container_restart_include.yaml b/config/dashboards/infrastructure/partials/docker_container_restart_include.yaml index 38a38afe..b14eb96d 100644 --- a/config/dashboards/infrastructure/partials/docker_container_restart_include.yaml +++ b/config/dashboards/infrastructure/partials/docker_container_restart_include.yaml @@ -9,16 +9,6 @@ # Notes: Generated from core.entity_registry (platform: portainer). ###################################################################### -- entity_id: button.91aca40203c0_portainer_agent_restart_container - options: - type: tile - name: 91aca40203c0_portainer_agent - hide_state: true - tap_action: - action: call-service - service: button.press - service_data: - entity_id: button.91aca40203c0_portainer_agent_restart_container - entity_id: button.cloudflared_kch_restart_container options: type: tile diff --git a/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml b/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml index f72072ad..87d3acdb 100644 --- a/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml +++ b/config/dashboards/infrastructure/partials/docker_container_rows_include.yaml @@ -9,15 +9,6 @@ # Notes: Generated from core.entity_registry + button restart entities. ###################################################################### -- entity_id: binary_sensor.91aca40203c0_portainer_agent_status - options: - type: custom:button-card - template: bearstone_infra_container_row - name: 91aca40203c0_portainer_agent - icon: mdi:docker - variables: - restart_button: button.91aca40203c0_portainer_agent_restart_container - name: 91aca40203c0_portainer_agent - entity_id: binary_sensor.cloudflared_kch_status options: type: custom:button-card diff --git a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml index ab1f9825..b49b770e 100644 --- a/config/dashboards/infrastructure/partials/docker_containers_sections.yaml +++ b/config/dashboards/infrastructure/partials/docker_containers_sections.yaml @@ -10,8 +10,6 @@ # Notes: Uses Portainer entities (`binary_sensor.*_status`, `button.*_restart_container`). ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_section.yaml - - type: grid column_span: 4 columns: 3 diff --git a/config/dashboards/infrastructure/partials/home_sections.yaml b/config/dashboards/infrastructure/partials/home_sections.yaml index 1303a004..af60a52d 100644 --- a/config/dashboards/infrastructure/partials/home_sections.yaml +++ b/config/dashboards/infrastructure/partials/home_sections.yaml @@ -7,13 +7,11 @@ # Desktop-first infra overview: full-width hero, exceptions-first alerts. # ------------------------------------------------------------------- # Notes: Default/light theme only; no dark-mode specific styling. -# Notes: Always keep a full-width container directly below chips. +# Notes: Keep the first section full-width to avoid whitespace on desktop. ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_home_section.yaml - # ------------------------------------------------------------------- -# Home hero (mandatory full-width container under chips) +# Home hero (mandatory first full-width container) # ------------------------------------------------------------------- - type: grid column_span: 4 @@ -153,6 +151,17 @@ action: navigate navigation_path: /dashboard-infrastructure/website-health + - type: custom:button-card + template: bearstone_infra_alert_row + entity: binary_sensor.bear_stone + name: Bear Stone is down + icon: mdi:web-cancel + variables: + alert_kind: binary_off + tap_action: + action: navigate + navigation_path: /dashboard-infrastructure/website-health + - type: custom:button-card template: bearstone_infra_list_row name: Domain expiration critical @@ -311,6 +320,32 @@ tap_action: action: none + - type: custom:button-card + template: bearstone_infra_alert_row + entity: binary_sensor.node_proxmox1_updates_packages + name: Proxmox01 updates pending + icon: mdi:package-up + variables: + alert_kind: binary_on + tap_action: + action: navigate + navigation_path: /dashboard-infrastructure/proxmox + state_display: > + [[[ return 'UPDATES'; ]]] + + - type: custom:button-card + template: bearstone_infra_alert_row + entity: binary_sensor.node_proxmox02_updates_packages + name: Proxmox02 updates pending + icon: mdi:package-up + variables: + alert_kind: binary_on + tap_action: + action: navigate + navigation_path: /dashboard-infrastructure/proxmox + state_display: > + [[[ return 'UPDATES'; ]]] + - type: custom:button-card template: bearstone_infra_alert_row entity: sensor.disk_use_percent diff --git a/config/dashboards/infrastructure/partials/mariadb_sections.yaml b/config/dashboards/infrastructure/partials/mariadb_sections.yaml index f7cf94a2..0bbfa549 100644 --- a/config/dashboards/infrastructure/partials/mariadb_sections.yaml +++ b/config/dashboards/infrastructure/partials/mariadb_sections.yaml @@ -9,8 +9,6 @@ # Notes: Stitch-inspired MariaDB layout (KPI strip + 3 panel columns). ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_section.yaml - - type: grid column_span: 4 columns: 4 diff --git a/config/dashboards/infrastructure/partials/pihole_sections.yaml b/config/dashboards/infrastructure/partials/pihole_sections.yaml index f3846f9f..318b1e92 100644 --- a/config/dashboards/infrastructure/partials/pihole_sections.yaml +++ b/config/dashboards/infrastructure/partials/pihole_sections.yaml @@ -9,8 +9,6 @@ # Notes: Uses `custom:pi-hole` with existing device_id. ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_section.yaml - - type: grid column_span: 4 columns: 1 diff --git a/config/dashboards/infrastructure/partials/proxmox_sections.yaml b/config/dashboards/infrastructure/partials/proxmox_sections.yaml index 97c44ecf..ff77c025 100644 --- a/config/dashboards/infrastructure/partials/proxmox_sections.yaml +++ b/config/dashboards/infrastructure/partials/proxmox_sections.yaml @@ -9,8 +9,6 @@ # Notes: Standardized on `custom:button-card` + `custom:mini-graph-card` with `card_mod` polish. ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_section.yaml - - type: grid column_span: 4 columns: 4 diff --git a/config/dashboards/infrastructure/partials/website_health_sections.yaml b/config/dashboards/infrastructure/partials/website_health_sections.yaml index b55d1511..88a49367 100644 --- a/config/dashboards/infrastructure/partials/website_health_sections.yaml +++ b/config/dashboards/infrastructure/partials/website_health_sections.yaml @@ -6,13 +6,11 @@ # Infrastructure Partial - Website health sections # Website uptime + domain expiry + certificate telemetry detail view. # ------------------------------------------------------------------- -# Notes: Keep a full-width container directly below chips to avoid whitespace. +# Notes: Keep the first section full-width to avoid whitespace. ###################################################################### -- !include /config/dashboards/infrastructure/partials/infra_top_chips_section.yaml - # ------------------------------------------------------------------- -# Website hero (mandatory full-width container under chips) +# Website hero (mandatory first full-width container) # ------------------------------------------------------------------- - type: grid column_span: 4 diff --git a/config/packages/docker_infrastructure.yaml b/config/packages/docker_infrastructure.yaml index 3f7c1077..aa93b99c 100644 --- a/config/packages/docker_infrastructure.yaml +++ b/config/packages/docker_infrastructure.yaml @@ -144,191 +144,85 @@ template: {% endif %} automation: - - alias: "APT Update Report - docker_10" - id: apt_update_report_docker_10 - description: "Receive docker_10 APT results and update helpers/logbook." + - alias: "APT Update Report - Docker Hosts" + id: apt_update_report_docker_hosts + description: "Receive docker host APT results and update helpers/logbook." mode: queued trigger: - platform: webhook webhook_id: !secret apt_webhook_docker_10 + id: docker_10 allowed_methods: - POST local_only: true - variables: - payload: "{{ trigger.json | default({}) }}" - success: "{{ payload.get('success', true) | bool }}" - updated: "{{ payload.get('updated', false) | bool }}" - packages: "{{ payload.get('packages', 0) | int(0) }}" - message: "{{ payload.get('message', '') | string }}" - result: >- - {% if not success %} - ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif updated %} - UPDATED {{ packages }} PKGS - {% else %} - NO UPDATES - {% endif %} - log_message: >- - docker_10 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. - action: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_10_last_check - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: input_text.set_value - target: - entity_id: input_text.apt_docker_10_last_result - data: - value: "{{ result }}" - - choose: - - conditions: "{{ success and updated }}" - sequence: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_10_last_update - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: script.send_to_logbook - data: - topic: "APT" - message: "{{ log_message }}" - - - alias: "APT Update Report - docker_14" - id: apt_update_report_docker_14 - description: "Receive docker_14 APT results and update helpers/logbook." - mode: queued - trigger: - platform: webhook webhook_id: !secret apt_webhook_docker_14 + id: docker_14 allowed_methods: - POST local_only: true - variables: - payload: "{{ trigger.json | default({}) }}" - success: "{{ payload.get('success', true) | bool }}" - updated: "{{ payload.get('updated', false) | bool }}" - packages: "{{ payload.get('packages', 0) | int(0) }}" - message: "{{ payload.get('message', '') | string }}" - result: >- - {% if not success %} - ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif updated %} - UPDATED {{ packages }} PKGS - {% else %} - NO UPDATES - {% endif %} - log_message: >- - docker_14 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. - action: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_14_last_check - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: input_text.set_value - target: - entity_id: input_text.apt_docker_14_last_result - data: - value: "{{ result }}" - - choose: - - conditions: "{{ success and updated }}" - sequence: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_14_last_update - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: script.send_to_logbook - data: - topic: "APT" - message: "{{ log_message }}" - - - alias: "APT Update Report - docker_17" - id: apt_update_report_docker_17 - description: "Receive docker_17 APT results and update helpers/logbook." - mode: queued - trigger: - platform: webhook webhook_id: !secret apt_webhook_docker_17 + id: docker_17 allowed_methods: - POST local_only: true - variables: - payload: "{{ trigger.json | default({}) }}" - success: "{{ payload.get('success', true) | bool }}" - updated: "{{ payload.get('updated', false) | bool }}" - packages: "{{ payload.get('packages', 0) | int(0) }}" - message: "{{ payload.get('message', '') | string }}" - result: >- - {% if not success %} - ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} - {% elif updated %} - UPDATED {{ packages }} PKGS - {% else %} - NO UPDATES - {% endif %} - log_message: >- - docker_17 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. - action: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_17_last_check - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: input_text.set_value - target: - entity_id: input_text.apt_docker_17_last_result - data: - value: "{{ result }}" - - choose: - - conditions: "{{ success and updated }}" - sequence: - - service: input_datetime.set_datetime - target: - entity_id: input_datetime.apt_docker_17_last_update - data: - datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - - service: script.send_to_logbook - data: - topic: "APT" - message: "{{ log_message }}" - - - alias: "APT Update Report - docker_69" - id: apt_update_report_docker_69 - description: "Receive docker_69 APT results and update helpers/logbook." - mode: queued - trigger: - platform: webhook webhook_id: !secret apt_webhook_docker_69 + id: docker_69 allowed_methods: - POST local_only: true variables: + host_id: "{{ trigger.id }}" payload: "{{ trigger.json | default({}) }}" success: "{{ payload.get('success', true) | bool }}" updated: "{{ payload.get('updated', false) | bool }}" + reboot_required: "{{ payload.get('reboot_required', false) | bool }}" packages: "{{ payload.get('packages', 0) | int(0) }}" message: "{{ payload.get('message', '') | string }}" + helpers: + docker_10: + last_check: input_datetime.apt_docker_10_last_check + last_update: input_datetime.apt_docker_10_last_update + last_result: input_text.apt_docker_10_last_result + docker_14: + last_check: input_datetime.apt_docker_14_last_check + last_update: input_datetime.apt_docker_14_last_update + last_result: input_text.apt_docker_14_last_result + docker_17: + last_check: input_datetime.apt_docker_17_last_check + last_update: input_datetime.apt_docker_17_last_update + last_result: input_text.apt_docker_17_last_result + docker_69: + last_check: input_datetime.apt_docker_69_last_check + last_update: input_datetime.apt_docker_69_last_update + last_result: input_text.apt_docker_69_last_result + host_helpers: "{{ helpers[host_id] if host_id in helpers else none }}" result: >- {% if not success %} ERROR{% if (message | trim) != '' %}: {{ message | trim }}{% endif %} {% elif updated %} - UPDATED {{ packages }} PKGS + UPDATED {{ packages }} PKGS{% if reboot_required %} (REBOOT REQ){% endif %} + {% elif reboot_required %} + NO UPDATES (REBOOT REQ) {% else %} NO UPDATES {% endif %} log_message: >- - docker_69 updated {{ packages }} package{% if packages != 1 %}s{% endif %}. + {{ host_id }} updated {{ packages }} package{% if packages != 1 %}s{% endif %}{% if reboot_required %}; reboot required{% endif %}. + condition: + - condition: template + value_template: "{{ host_helpers is not none }}" action: - service: input_datetime.set_datetime target: - entity_id: input_datetime.apt_docker_69_last_check + entity_id: "{{ host_helpers.last_check }}" data: datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - service: input_text.set_value target: - entity_id: input_text.apt_docker_69_last_result + entity_id: "{{ host_helpers.last_result }}" data: value: "{{ result }}" - choose: @@ -336,7 +230,7 @@ automation: sequence: - service: input_datetime.set_datetime target: - entity_id: input_datetime.apt_docker_69_last_update + entity_id: "{{ host_helpers.last_update }}" data: datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" - service: script.send_to_logbook