Skip to content

Commit

Permalink
Add check_hw_slab_unreclaimable check
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Apr 16, 2019
1 parent fa5d035 commit fa4a134
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,17 @@ _**Example** (require at least 1 GB free)_: `check_hw_swap_free 1048576`
<br />
##### check_hw_slab_unreclaimable
`check_hw_slab_unreclaimable max_kb`
`check_hw_slab_unreclaimable` compares the amount of slab unreclaimable memory to the maximum provided (in kB). If the slab unreclaimable is greater than _max_kb_ kilobytes, the check fails.
_**Example** (require less than 5 GB unreclaimable)_: `check_hw_slab_unreclaimable 5242880`
<br />
##### check_moab_sched
`check_moab_sched [-t timeout] [-a alert_match] [-m [!]mstr] [-v version_match]`
Expand Down
20 changes: 20 additions & 0 deletions scripts/lbnl_hw.nhc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ HW_RAM_TOTAL=0
HW_RAM_FREE=0
HW_SWAP_TOTAL=0
HW_SWAP_FREE=0
HW_SLAB_UNRECLAIMABLE=0
HW_IB_STATE=( )
HW_IB_PHYS_STATE=()
HW_IB_RATE=( )
Expand Down Expand Up @@ -81,6 +82,8 @@ function nhc_hw_gather_data() {
HW_SWAP_TOTAL=${FIELD[1]}
elif [[ "${FIELD[0]}" = "SwapFree:" ]]; then
HW_SWAP_FREE=${FIELD[1]}
elif [[ "${FIELD[0]}" = "SUnreclaim:" ]]; then
HW_SLAB_UNRECLAIMABLE=${FIELD[1]}
fi
done < /proc/meminfo
else
Expand Down Expand Up @@ -328,6 +331,23 @@ function check_hw_mem_free() {
return 0
}

# Check amount of Slab unreclaimable against maximum ($1).
function check_hw_slab_unreclaimable() {
local MAXUNRECLAIMABLE=$1

if [[ $HW_RAM_TOTAL -eq 0 ]]; then
nhc_hw_gather_data
fi

nhc_common_parse_size "$MAXUNRECLAIMABLE" MAXUNRECLAIMABLE

if [[ $HW_SLAB_UNRECLAIMABLE -gt $MAXUNRECLAIMABLE ]]; then
die 1 "$FUNCNAME: Slab unreclaimable is too large $HW_SLAB_UNRECLAIMABLE kB > $MAXUNRECLAIMABLE kB."
return 1
fi
return 0
}

# Check if IB state, phys_state, and rate ($1) all match.
function check_hw_ib() {
local STATE="ACTIVE"
Expand Down

0 comments on commit fa4a134

Please sign in to comment.