Page 3 of 4
Re: Transaction Timeout Anomalies for SSH Access
Posted: Mon Feb 17, 2020 5:39 pm
by mbellerue
That is really strange. Is it printing the <br /> tags? I would think if it's not even printing them, it should be parsing them at least.
You could try putting the tags at the beginning of each return line. Other than that, I don't know why it's not giving you proper new lines. If your next test fails, can you post another screenshot? Or is the output still the same as the last one?
Re: Transaction Timeout Anomalies for SSH Access
Posted: Thu Feb 20, 2020 4:42 am
by louissiong
Yes, it is but not showing the service status line by line.
Anything that I could have missed out ? Thanks.
Re: Transaction Timeout Anomalies for SSH Access
Posted: Thu Feb 20, 2020 12:11 pm
by mbellerue
Oh I'm sorry, I think I may be misunderstanding something here. In that screen shot, the middle line, do you want it to look like this,
Code: Select all
QMPGCT01 ABT: The Following Channels Are Running:
ABT.SVRCONN
Like that?
I think this is going to require that we go into the check_mq_channel.sh script to add the new lines. Can you post that script?
Re: Transaction Timeout Anomalies for SSH Access
Posted: Mon Feb 24, 2020 4:27 am
by louissiong
it is supposed to show the service status followed by the channel name line after line.
Let me know. Thanks.
#!/usr/bin/sh
retresult=3
#qmiib01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMIIB01 ABT*)
#qmpgct01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMPGCT01 ABT*)
#qmpgs01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMPGS01 ABT*)
cd /usr/local/nagios/check/
if [[ ! -f check_mq_channel.sh ]]; then
retresult=2
else
qmiib01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMIIB01 ABT*)
checkmq1=$?
qmpgct01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMPGCT01 ABT*)
checkmq2=$?
qmpgs01abt=$(/usr/local/nagios/check/check_mq_channel.sh QMPGS01 ABT*)
checkmq3=$?
if [ $(($checkmq1 + $checkmq2 + $checkmq3)) -gt 0 ]; then
retresult=2
else
retresult=0
fi
#echo "QMIIB01 ABT: ${qmiib01abt}\n"
#echo "QMPGCT01 ABT: ${qmpgct01abt}\n"
#echo "QMPGS01 ABT: ${qmpgs01abt}"
echo "<br \>QMIIB01 ABT: ${qmiib01abt}>"
echo "<br \>QMPGCT01 ABT: ${qmpgct01abt}<br \>"
echo "QMPGS01 ABT: ${qmpgs01abt}"
fi
# echo " | QMPGCT01 ABT: ${qmpgct01abt}\n"
# echo " | QMPGS01 ABT: ${qmpgs01abt}"
exit $retresult
Re: Transaction Timeout Anomalies for SSH Access
Posted: Mon Feb 24, 2020 12:40 pm
by benjaminsmith
Hi Louis,
Michael was not able to make it today, but he should be back tomorrow and will be able to provide more feedback on your script.
Thanks for your patience.
Re: Transaction Timeout Anomalies for SSH Access
Posted: Wed Feb 26, 2020 11:51 pm
by louissiong
Hi Michael, any update on the case ? Thanks.
Re: Transaction Timeout Anomalies for SSH Access
Posted: Thu Feb 27, 2020 10:46 am
by mbellerue
Okay, yes, I think we will have to take a look at the check_mq_channel.sh script. Can you attach that script here? I'll take a look and see what the output is, and what we can do to make it output the way you want it.
Re: Transaction Timeout Anomalies for SSH Access
Posted: Mon Mar 02, 2020 1:11 am
by louissiong
Sure, thanks. Here u go.
Is there any Nagios XI built in functions to use ?
#!/usr/bin/sh
RUNMQSC="/usr/bin/runmqsc"
# NAGIOS EXIT STATES
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
USAGE="Usage `basename $0` <QMANAGER> <CHANNEL>."
NOTE="check channel status if running."
# Print usage
if [[ $# -ne 2 ]]; then
echo -e "Use: $USAGE\n\n"
echo -e "Note: $NOTE\n\n"
exit $STATE_UNKNOWN
else
QMANAGER=$1
CHANNEL=$2
fi
NOT_RUNNING_CHANNELS=`echo "dis chstatus(${CHANNEL}) where(STATUS NE RUNNING)" | runmqsc ${QMANAGER} | grep -e 'CHANNEL\((.*)\)' | sed s/CHANNEL\(/=/g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}'`
for CHAN in $NOT_RUNNING_CHANNELS
do
MESSAGE="${MESSAGE} : ${CHAN}"
done
if [ -n "$MESSAGE" ]; then
echo "Following Channels are not running ${MESSAGE}"
exit $STATE_CRITICAL
else
echo "Channels are running"
exit $STATE_OK
fi
Re: Transaction Timeout Anomalies for SSH Access
Posted: Mon Mar 02, 2020 4:34 pm
by mbellerue
I'm hoping that we don't need to add the new line to the NOT_RUNNING_CHANNELS variable. That doesn't look like fun. Let's try this one first.
Code: Select all
for CHAN in $NOT_RUNNING_CHANNELS
do
MESSAGE="${MESSAGE} : ${CHAN}\n"
done
Re: Transaction Timeout Anomalies for SSH Access
Posted: Fri Mar 06, 2020 4:26 am
by louissiong
Ok. Tested still not working.
Does the service status variable need to be added first ?