Having only the thread id makes gathering data from the past hard.
Something like the following would work:
=== modified file 'nagios/bin/pmp-check-mysql-innodb'
--- nagios/bin/pmp-check-mysql-innodb 2012-06-11 10:54:55 +0000
+++ nagios/bin/pmp-check-mysql-innodb 2013-05-29 16:20:26 +0000
@@ -98,7 +98,7 @@
OPT_CRIT=${OPT_CRIT:-600}
LEVEL=$(mysql_exec "
SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(trx_started),
- trx_mysql_thread_id
+ concat(IFNULL((select concat(user, '@', host) from INFORMATION_SCHEMA.PROCESSLIST where id = trx_mysql_thread_id),'UNKNOWN'),'(',trx_mysql_thread_id,')')
FROM INFORMATION_SCHEMA.INNODB_TRX
ORDER BY trx_started LIMIT 1" 2>"${TEMP}")
if [ "$?" != 0 ]; then
@@ -135,7 +135,7 @@
NOTE="${LEVEL:-UNKNOWN} transactions in LOCK WAIT status"
;;
max_duration)
- NOTE="longest transaction active for ${LEVEL:-UNKNOWN} seconds (thread ${THD:-unknown})"
+ NOTE="longest transaction active for ${LEVEL:-UNKNOWN} seconds (user@host:port(thread) ${THD:-unknown})"
;;
esac
if [ "${LEVEL:-0}" -gt "${OPT_CRIT}" ]; then