mysmarthome/packages/esxi.yaml

57 lines
1.6 KiB
YAML

homeassistant:
sensor:
- platform: snmp
name: "ESXi Server Description"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.1.1.0
accept_errors: true
- platform: snmp
name: "ESXi Total RAM"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.25.2.3.1.5.6
accept_errors: true
- platform: snmp
name: "ESXi Used RAM"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.25.2.3.1.6.6
accept_errors: true
- platform: snmp
name: "ESXi System Uptime Epoch"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.25.1.1.0
accept_errors: true
- platform: snmp
name: "ESXi Number of Network Interfaces"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.2.1.0
accept_errors: true
- platform: snmp
name: "ESXi System Memory Size"
host: !secret esxi_server
baseoid: 1.3.6.1.2.1.25.2.2.0
accept_errors: true
- platform: template
sensors:
esxi_memory_used:
friendly_name: "ESXi Memory Usage"
unit_of_measurement: "%"
value_template: "{{(states('sensor.esxi_used_ram') | float / states('sensor.esxi_total_ram') | float * 100) | round }}"
- platform: template
sensors:
esxi_system_uptime:
friendly_name: "ESXi System Uptime"
value_template: >
{% set time = states('sensor.esxi_system_uptime_epoch') | int %}
{% set minutes = ((time % 360000) / 6000) | int %}
{% set hours = ((time % 8640000) / 360000) | int %}
{% set days = (time / 8640000) | int %}
{{ days }} days, {{ hours }} hours {{ minutes }} minutes.