Adds support for memory usage in percent

This commit is contained in:
Franck Nijhof 2019-08-18 14:50:06 +02:00
parent d5848fc7e0
commit 75590a9ac1
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
3 changed files with 39 additions and 2 deletions

View file

@ -1022,6 +1022,21 @@ function bashio::addon.memory_limit() {
'.memory_limit'
}
# ------------------------------------------------------------------------------
# Returns memory usage in percentage for the specified add-on.
#
# Arguments:
# $1 Add-on slug (optional, default: self)
# ------------------------------------------------------------------------------
function bashio::addon.memory_percent() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons.stats \
"${slug}" \
"addons.${slug}.stats.memory_percent" \
'.memory_percent'
}
# ------------------------------------------------------------------------------
# Returns outgoing network usage from the specified add-on.
#

View file

@ -279,7 +279,9 @@ function bashio::homeassistant.cpu_percent() {
# ------------------------------------------------------------------------------
function bashio::homeassistant.memory_usage() {
bashio::log.trace "${FUNCNAME[0]}"
bashio::homeassistant.stats 'homeassistant.stats.memory_usage' '.memory_usage'
bashio::homeassistant.stats \
'homeassistant.stats.memory_usage' \
'.memory_usage'
}
# ------------------------------------------------------------------------------
@ -287,7 +289,19 @@ function bashio::homeassistant.memory_usage() {
# ------------------------------------------------------------------------------
function bashio::homeassistant.memory_limit() {
bashio::log.trace "${FUNCNAME[0]}"
bashio::homeassistant.stats 'homeassistant.stats.memory_limit' '.memory_limit'
bashio::homeassistant.stats \
'homeassistant.stats.memory_limit' \
'.memory_limit'
}
# ------------------------------------------------------------------------------
# Returns memory usage in percent from Home Assistant.
# ------------------------------------------------------------------------------
function bashio::homeassistant.memory_percent() {
bashio::log.trace "${FUNCNAME[0]}"
bashio::homeassistant.stats \
'homeassistant.stats.memory_percent' \
'.memory_percent'
}
# ------------------------------------------------------------------------------

View file

@ -271,6 +271,14 @@ function bashio::supervisor.memory_limit() {
bashio::supervisor.stats 'supervisor.stats.memory_limit' '.memory_limit'
}
# ------------------------------------------------------------------------------
# Returns memory usage in percent from the Supervisor.
# ------------------------------------------------------------------------------
function bashio::supervisor.memory_percent() {
bashio::log.trace "${FUNCNAME[0]}"
bashio::supervisor.stats 'supervisor.stats.memory_percent' '.memory_percent'
}
# ------------------------------------------------------------------------------
# Returns outgoing network usage from the Supervisor.
# ------------------------------------------------------------------------------