Add OpenHardwareMonitor package for two servers
This commit is contained in:
201
packages/openhardwaremonitor.yaml
Normal file
201
packages/openhardwaremonitor.yaml
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
# OpenHardwareMonitor Integration Package
|
||||||
|
# Monitors hardware sensors from two servers running OpenHardwareMonitor
|
||||||
|
# Server 1: 10.0.0.243:8085
|
||||||
|
# Server 2: 10.0.0.244:8085
|
||||||
|
|
||||||
|
rest:
|
||||||
|
# Server 1 - 10.0.0.243
|
||||||
|
- resource: http://10.0.0.243:8085/data.json
|
||||||
|
scan_interval: 30
|
||||||
|
sensor:
|
||||||
|
- name: "Server 243 CPU Temperature"
|
||||||
|
unique_id: server_243_cpu_temp
|
||||||
|
unit_of_measurement: "°C"
|
||||||
|
device_class: temperature
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'CPU' or 'CPU' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Temperatures' %}
|
||||||
|
{% for temp in sensor.Children %}
|
||||||
|
{% if 'Package' in temp.Text or 'Core #0' in temp.Text %}
|
||||||
|
{% set ns.value = temp.Value | replace(' °C', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:thermometer
|
||||||
|
|
||||||
|
- name: "Server 243 CPU Load"
|
||||||
|
unique_id: server_243_cpu_load
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'CPU' or 'CPU' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Load' %}
|
||||||
|
{% for load in sensor.Children %}
|
||||||
|
{% if 'Total' in load.Text %}
|
||||||
|
{% set ns.value = load.Value | replace(' %', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:chip
|
||||||
|
|
||||||
|
- name: "Server 243 RAM Usage"
|
||||||
|
unique_id: server_243_ram_usage
|
||||||
|
unit_of_measurement: "GB"
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'RAM' or 'Memory' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Load' or sensor.Text == 'Data' %}
|
||||||
|
{% for load in sensor.Children %}
|
||||||
|
{% if 'Used' in load.Text %}
|
||||||
|
{% set ns.value = load.Value | replace(' GB', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:memory
|
||||||
|
|
||||||
|
- name: "Server 243 GPU Temperature"
|
||||||
|
unique_id: server_243_gpu_temp
|
||||||
|
unit_of_measurement: "°C"
|
||||||
|
device_class: temperature
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if 'GPU' in child.Text or child.Text.startswith('NVIDIA') or child.Text.startswith('AMD') %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Temperatures' %}
|
||||||
|
{% for temp in sensor.Children %}
|
||||||
|
{% if 'Core' in temp.Text or 'GPU' in temp.Text %}
|
||||||
|
{% set ns.value = temp.Value | replace(' °C', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:thermometer
|
||||||
|
|
||||||
|
# Server 2 - 10.0.0.244
|
||||||
|
- resource: http://10.0.0.244:8085/data.json
|
||||||
|
scan_interval: 30
|
||||||
|
sensor:
|
||||||
|
- name: "Server 244 CPU Temperature"
|
||||||
|
unique_id: server_244_cpu_temp
|
||||||
|
unit_of_measurement: "°C"
|
||||||
|
device_class: temperature
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'CPU' or 'CPU' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Temperatures' %}
|
||||||
|
{% for temp in sensor.Children %}
|
||||||
|
{% if 'Package' in temp.Text or 'Core #0' in temp.Text %}
|
||||||
|
{% set ns.value = temp.Value | replace(' °C', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:thermometer
|
||||||
|
|
||||||
|
- name: "Server 244 CPU Load"
|
||||||
|
unique_id: server_244_cpu_load
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'CPU' or 'CPU' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Load' %}
|
||||||
|
{% for load in sensor.Children %}
|
||||||
|
{% if 'Total' in load.Text %}
|
||||||
|
{% set ns.value = load.Value | replace(' %', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:chip
|
||||||
|
|
||||||
|
- name: "Server 244 RAM Usage"
|
||||||
|
unique_id: server_244_ram_usage
|
||||||
|
unit_of_measurement: "GB"
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if child.Text == 'RAM' or 'Memory' in child.Text %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Load' or sensor.Text == 'Data' %}
|
||||||
|
{% for load in sensor.Children %}
|
||||||
|
{% if 'Used' in load.Text %}
|
||||||
|
{% set ns.value = load.Value | replace(' GB', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:memory
|
||||||
|
|
||||||
|
- name: "Server 244 GPU Temperature"
|
||||||
|
unique_id: server_244_gpu_temp
|
||||||
|
unit_of_measurement: "°C"
|
||||||
|
device_class: temperature
|
||||||
|
state_class: measurement
|
||||||
|
value_template: >
|
||||||
|
{% set ns = namespace(found=false, value=none) %}
|
||||||
|
{% for child in value_json.Children %}
|
||||||
|
{% if 'GPU' in child.Text or child.Text.startswith('NVIDIA') or child.Text.startswith('AMD') %}
|
||||||
|
{% for sensor in child.Children %}
|
||||||
|
{% if sensor.Text == 'Temperatures' %}
|
||||||
|
{% for temp in sensor.Children %}
|
||||||
|
{% if 'Core' in temp.Text or 'GPU' in temp.Text %}
|
||||||
|
{% set ns.value = temp.Value | replace(' °C', '') | replace(',', '.') %}
|
||||||
|
{% set ns.found = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ns.value if ns.found else 'unknown' }}
|
||||||
|
icon: mdi:thermometer
|
||||||
Reference in New Issue
Block a user