In the loop that checks for SELECT and CONNECT errors, the LONG_OUTPUT variable is overwritten on each pass. This means that if more than one database has errors, only the last database's errors are captured.
Thanks for the feedback, the code was modified according to your comments. The variable is concatenated in each loop, thus error messages are not lost.
In the loop that checks for SELECT and CONNECT errors, the LONG_OUTPUT variable is overwritten on each pass. This means that if more than one database has errors, only the last database's errors are captured.
https://github.com/angoca/monitor-db2-with-nagios/blob/master/check_instance_memory#L392-L421