Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ramkumardevanathan/fa02a1989398a97028c859cfcd944e06 to your computer and use it in GitHub Desktop.
Save ramkumardevanathan/fa02a1989398a97028c859cfcd944e06 to your computer and use it in GitHub Desktop.
FS loop alerter
##############################################################################
#
# This alarm monitors two file systems and sends an alert when the space
# utilization on a given filesystem exceeds the given value.
#
# Initialize the variables root_util and var_util which will hold the
# current FS_SPACE_UTIL value. The first time they are accessed, they will
# be initialized to zero. Loop through the filesystem each interval and save
# the FS_SPACE_UTIL for each one. Send an alert if the space utilization
# exceeds the given threshold. A repeat alert will be sent every 30 minutes
# for as long as the threshold is exceeded.
#
# Note how alert and print syntac allows you to format numeric values with
# the optional parameters [|width|decimals]. The values will be right
# justified by default. To left justify the field, add a "-" character
# before the width parameter.
#
##
# root_util = root_util
# var_util = var_util
#
# FILESYSTEM LOOP
# {
# if FS_DIRNAME == "/" then
# root_util = FS_SPACE_UTIL
#
# if FS_DIRNAME == "/var" then
# var_util = FS_SPACE_UTIL
# }
#
# alarm root_util > 90 for 10 minutes
# start
# yellow alert "root filesys space util too high at ", root_util|3|2, "%"
# repeat every 30 minutes
# red alert "root fs space is still too high at ", root_util|-3|2, "%"
# end
# reset alert "root space util below the threshold"
#
# alarm var_util > 75 for 10 minutes
# start
# yellow alert "/var space util is too high at ", var_util|3|2, "%"
# repeat every 30 minutes
# red alert "/var space util is still too high at ", var_util|3|2, "%"
# end
# reset alert "/var space util now below the threshold"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment