Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Added Query Output for max_duration check #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions nagios/bin/pmp-check-mysql-innodb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ main() {
SET @@time_zone='SYSTEM';
SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(t.trx_started),
p.id,
CONCAT(p.user, '@', p.host)
CONCAT(p.user, '@', p.host),
p.info
FROM INFORMATION_SCHEMA.INNODB_TRX AS t
JOIN INFORMATION_SCHEMA.PROCESSLIST AS p ON p.id = t.trx_mysql_thread_id
ORDER BY t.trx_started LIMIT 1" 2>"${TEMP}")
Expand Down Expand Up @@ -136,6 +137,7 @@ main() {
if [ -n "${OUTPUT}" ]; then
LEVEL="$(echo ${OUTPUT} | awk '{print $1}')"
INFO="$(echo ${OUTPUT} | awk '{print "(thread "$2" by "$3")"}')"
QUERY="$(echo ${OUTPUT} | awk '{print "(Query Ran: "$4")"}')"

case "${OPT_CHEK}" in
idle_blocker_duration)
Expand All @@ -150,9 +152,9 @@ main() {
;;
esac
if [ "${LEVEL:-0}" -gt "${OPT_CRIT}" ]; then
NOTE="CRIT $NOTE $INFO"
NOTE="CRIT $NOTE $INFO $QUERY"
elif [ "${LEVEL:-0}" -gt "${OPT_WARN}" ]; then
NOTE="WARN $NOTE $INFO"
NOTE="WARN $NOTE $INFO $QUERY"
else
NOTE="OK $NOTE"
fi
Expand Down