Skip to content

Commit

Permalink
17480 FIX missing agent output for mk_db2
Browse files Browse the repository at this point in the history
SUP-20798

Closes: #761
Co-authored-by: Logan Connolly <[email protected]>
Change-Id: I9051a84cc1595f0780b0a8cb5704f875cd9f8ea3
  • Loading branch information
t29j and logan-connolly committed Dec 12, 2024
1 parent 441add9 commit daf350e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .werks/17480.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[//]: # (werk v2)
# Fix empty output from mk_db2 agent

key | value
---------- | ---
date | 2024-12-11T13:55:20+00:00
version | 2.3.0p23
class | fix
edition | cre
component | checks
level | 1
compatible | yes

The `mk_db2.aix` agent plugin generated empty output for AIX 7.2.

This fix resolves the issue.
8 changes: 4 additions & 4 deletions agents/plugins/mk_db2.aix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/ksh
#!/usr/bin/ksh93
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
Expand Down Expand Up @@ -65,11 +65,11 @@ function waitmax {
function query_instance {
INSTANCE=$1
# find home directory
HOMEDIR=$(grep "^$INSTANCE" /etc/passwd | awk -F: '{print $6}' | grep "$INSTANCE$")
HOMEDIR=$(grep -w "^$INSTANCE:" /etc/passwd | awk -F: '{print $6}')
NOW=$(perl -e "print time();")

waitmax 200 <<WAITMAX
su $INSTANCE << EOF
su - $INSTANCE -c "/usr/bin/ksh93" << EOF

if [ ! -f $HOMEDIR/sqllib/db2profile ] ;
then
Expand Down Expand Up @@ -99,7 +99,7 @@ function query_instance {
DB_PORT='port 0'
for DB in \\\$DBS; do
db2 connect to \\\$DB > /dev/null;
if [ $? -nq 0 ] ; then
if [ $? -ne 0 ] ; then
exit 1
fi

Expand Down

0 comments on commit daf350e

Please sign in to comment.