-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from rackerlabs/development
Release 2.1.0
- Loading branch information
Showing
9 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2019 Rackspace, Inc. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# | ||
|
||
print_system_locks() { | ||
local LOGFILE="$1" | ||
local plugin_name=${FUNCNAME[0]/print_/} | ||
log INFO "Starting '${plugin_name}' report - ${LOGFILE##*/}" | ||
local lslocks=$( type -p lslocks ) | ||
local options=${PLUGIN_OPTS_SYSTEM_LOCKS_OPTS:-"--notruncate"} | ||
local timeout=${PLUGIN_OPTS_SYSTEM_LOCKS_TIMEOUT:-"5"} | ||
|
||
if [[ -z "${lslocks}" ]]; then | ||
echo "lslocks is unavailable, fallback to /proc/locks..." >> "${LOGFILE}" | ||
timeout "${timeout}" \ | ||
cat /proc/locks $>> "${LOGFILE}" | ||
else | ||
timeout "${timeout}" \ | ||
"${lslocks}" "${options}" &>> "${LOGFILE}" | ||
fi | ||
|
||
log INFO "Ended '${plugin_name}' report" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Get full path to recaplog | ||
recaplog_path=$(type -p recaplog) | ||
|
||
# Insert 'set -e' on line 2 of recaplog to exit after any failure | ||
sed -i "2iset -e" "${recaplog_path}"; | ||
|
||
# Save debugging info and record the status of the recaplog run | ||
debug_info=$(bash -x "${recaplog_path}" 2>&1) | ||
stat=$? | ||
|
||
# Save the debugging info that occurred right before the cleanup operation | ||
cleanup_trigger=$(echo "${debug_info}" | grep -P "^\+\s+cleanup" -B 20) | ||
|
||
# Show the info that triggered the cleanup if there was an error running recaplog | ||
if [[ ${stat} -ne 0 ]]; then | ||
echo "An error occurred while doing the following:" | ||
echo "${cleanup_trigger}" | ||
fi | ||
|
||
# Exit with the status of the recaplog run | ||
exit ${stat} |