mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
✨ Adds support for memory usage in percent
This commit is contained in:
parent
d5848fc7e0
commit
75590a9ac1
3 changed files with 39 additions and 2 deletions
|
@ -1022,6 +1022,21 @@ function bashio::addon.memory_limit() {
|
||||||
'.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.
|
# Returns outgoing network usage from the specified add-on.
|
||||||
#
|
#
|
||||||
|
|
|
@ -279,7 +279,9 @@ function bashio::homeassistant.cpu_percent() {
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::homeassistant.memory_usage() {
|
function bashio::homeassistant.memory_usage() {
|
||||||
bashio::log.trace "${FUNCNAME[0]}"
|
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() {
|
function bashio::homeassistant.memory_limit() {
|
||||||
bashio::log.trace "${FUNCNAME[0]}"
|
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'
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -271,6 +271,14 @@ function bashio::supervisor.memory_limit() {
|
||||||
bashio::supervisor.stats 'supervisor.stats.memory_limit' '.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.
|
# Returns outgoing network usage from the Supervisor.
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue