Skip to content

Instantly share code, notes, and snippets.

@delfer
Last active November 28, 2019 14:00
Show Gist options
  • Save delfer/df8d7307e585ac863d9336cf5f827ad8 to your computer and use it in GitHub Desktop.
Save delfer/df8d7307e585ac863d9336cf5f827ad8 to your computer and use it in GitHub Desktop.
ha_pg_disk_write_test
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder:
#purge_keep_days: 5
db_url: postgresql://ha:[email protected]:8432/ha
# Example configuration.yaml entry
sensor:
# Block device
# 8 - writes completed
- platform: command_line
name: blk_writes_completed
command: grep mmcblk0p2 /host_proc/diskstats | awk '{ print $8 }'
scan_interval: 1
value_template: '{{ value }}'
unit_of_measurement: writes
- platform: statistics
name: blk_writes_completed_1m
entity_id: sensor.blk_writes_completed
max_age:
seconds: 60
sampling_size: 60
- platform: template
sensors:
blk_writes_completed_1m_change:
value_template: "{{ state_attr('sensor.blk_writes_completed_1m','change') }}"
unit_of_measurement: writes
# 10 - sectors written
- platform: command_line
name: blk_sectors_written
command: grep mmcblk0p2 /host_proc/diskstats | awk '{ print $10 }'
scan_interval: 1
value_template: '{{ value }}'
unit_of_measurement: sectors
- platform: statistics
name: blk_sectors_written_1m
entity_id: sensor.blk_sectors_written
max_age:
seconds: 60
sampling_size: 60
- platform: template
sensors:
blk_sectors_written_1m_change:
value_template: "{{ state_attr('sensor.blk_sectors_written_1m','change') }}"
unit_of_measurement: sectors
# 11 - time spent writing (ms)
- platform: command_line
name: blk_time_spent_writing
command: grep mmcblk0p2 /host_proc/diskstats | awk '{ print $11 }'
scan_interval: 1
value_template: '{{ value }}'
unit_of_measurement: ms
- platform: statistics
name: blk_time_spent_writing_1m
entity_id: sensor.blk_time_spent_writing
max_age:
seconds: 60
sampling_size: 60
- platform: template
sensors:
blk_time_spent_writing_1m_change:
value_template: "{{ state_attr('sensor.blk_time_spent_writing_1m','change') }}"
unit_of_measurement: ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment