* Fix for slow --report --last
* Fix for data_is_numeric() calls
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#
|
||||
# @(#) HISTORY:
|
||||
# @(#) 2019-01-24: initial version [Patrick Van der Veken]
|
||||
# @(#) 2019-01-27: regex fix [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@@ -32,7 +33,7 @@ function check_linux_fs_usage
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
||||
typeset _VERSION="2019-01-27" # YYYY-MM-DD
|
||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@@ -190,7 +191,7 @@ then
|
||||
warn "missing filesystem name and/or threshold in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
continue
|
||||
fi
|
||||
data_is_numeric ${_CFG_INODES_THRESHOLD}
|
||||
data_is_numeric "${_CFG_INODES_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
@@ -201,8 +202,9 @@ then
|
||||
(( ARG_DEBUG > 0 )) && debug "found out-of-bounds inodes threshold for ${_CFG_FS}, using general threshold"
|
||||
_CFG_INODES_THRESHOLD=${_CFG_MAX_INODES_USAGE}
|
||||
fi
|
||||
_INODES_USAGE=$(grep -E -e "${_CFG_FS}$" ${_INODES_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric ${_INODES_USAGE}
|
||||
# add space to grep must be non-greedy!
|
||||
_INODES_USAGE=$(grep -E -e " ${_CFG_FS}$" ${_INODES_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric "${_INODES_USAGE}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "discovered value for inodes usage is incorrect [${_CFG_FS}:${_INODES_USAGE}]"
|
||||
@@ -241,7 +243,7 @@ then
|
||||
warn "missing filesystem name and/or threshold in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
continue
|
||||
fi
|
||||
data_is_numeric ${_CFG_SPACE_THRESHOLD}
|
||||
data_is_numeric "${_CFG_SPACE_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
@@ -252,8 +254,9 @@ then
|
||||
(( ARG_DEBUG > 0 )) && debug "found out-of-bounds space threshold for ${_CFG_FS}, using general threshold"
|
||||
_CFG_SPACE_THRESHOLD=${_CFG_MAX_SPACE_USAGE}
|
||||
fi
|
||||
_SPACE_USAGE=$(grep -E -e "${_CFG_FS}$" ${_SPACE_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric ${_SPACE_USAGE}
|
||||
# add space to grep must be non-greedy!
|
||||
_SPACE_USAGE=$(grep -E -e " ${_CFG_FS}$" ${_SPACE_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric "${_SPACE_USAGE}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "discovered value for space usage is incorrect [${_CFG_FS}:${_SPACE_USAGE}]"
|
||||
@@ -287,8 +290,9 @@ else
|
||||
# a) --- inodes (df -Pil) ---
|
||||
if (( _DO_INODES > 0 ))
|
||||
then
|
||||
_INODES_USAGE=$(grep -E -e "${_FS}$" ${_INODES_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric ${_INODES_USAGE}
|
||||
# add space to grep must be non-greedy!
|
||||
_INODES_USAGE=$(grep -E -e " ${_FS}$" ${_INODES_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric "${_INODES_USAGE}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "discovered value for inodes usage is incorrect [${_FS}:${_INODES_USAGE}]"
|
||||
@@ -315,8 +319,9 @@ else
|
||||
# b) --- space (df -Pl) ---
|
||||
if (( _DO_SPACE > 0 ))
|
||||
then
|
||||
_SPACE_USAGE=$(grep -E -e "${_FS}$" ${_SPACE_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric ${_SPACE_USAGE}
|
||||
# add space to grep must be non-greedy!
|
||||
_SPACE_USAGE=$(grep -E -e " ${_FS}$" ${_SPACE_FILE} 2>/dev/null | awk '{gsub(/%/,"",$5);print $5}' 2>/dev/null)
|
||||
data_is_numeric "${_SPACE_USAGE}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "discovered value for space usage is incorrect [${_FS}:${_SPACE_USAGE}]"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# @(#) 2018-07-12: better log_healthy handling [Patrick Van der Veken]
|
||||
# @(#) 2018-10-28: fixed (linter) errors [Patrick Van der Veken]
|
||||
# @(#) 2018-11-18: do not trap on signal 0 [Patrick Van der Veken]
|
||||
# @(#) 2019-01-24: arguments fix [Patrick Van der Veken]
|
||||
# @(#) 2019-01-27: arguments fix [Patrick Van der Veken]
|
||||
# -----------------------------------------------------------------------------
|
||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||
#******************************************************************************
|
||||
@@ -36,7 +36,7 @@ function check_linux_process_limits
|
||||
{
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||
typeset _VERSION="2019-01-24" # YYYY-MM-DD
|
||||
typeset _VERSION="2019-01-27" # YYYY-MM-DD
|
||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
@@ -125,7 +125,7 @@ do
|
||||
fi
|
||||
if [[ -n "${_PROCESS_SOFT_THRESHOLD}" ]]
|
||||
then
|
||||
data_is_numeric ${_PROCESS_SOFT_THRESHOLD}
|
||||
data_is_numeric "${_PROCESS_SOFT_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
@@ -134,7 +134,7 @@ do
|
||||
fi
|
||||
if [[ -n "${_PROCESS_HARD_THRESHOLD}" ]]
|
||||
then
|
||||
data_is_numeric ${_PROCESS_HARD_THRESHOLD}
|
||||
data_is_numeric "${_PROCESS_HARD_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
@@ -189,7 +189,7 @@ do
|
||||
fi
|
||||
if [[ -n "${_USER_SOFT_THRESHOLD}" ]]
|
||||
then
|
||||
data_is_numeric ${_USER_SOFT_THRESHOLD}
|
||||
data_is_numeric "${_USER_SOFT_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
@@ -198,7 +198,7 @@ do
|
||||
fi
|
||||
if [[ -n "${_USER_HARD_THRESHOLD}" ]]
|
||||
then
|
||||
data_is_numeric ${_USER_HARD_THRESHOLD}
|
||||
data_is_numeric "${_USER_HARD_THRESHOLD}"
|
||||
if (( $? > 0 ))
|
||||
then
|
||||
warn "parameter is not numeric in configuration file ${_CONFIG_FILE} at data line ${_LINE_COUNT}"
|
||||
|
||||
Reference in New Issue
Block a user