Transaction Timeout Anomalies for SSH Access
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Thanks. We are almost there. I made some changes to the idea u gave and came out with a script .But based on the wrapper script, is there a way to show multiple status outputs instead of just one with the service checks ? Eg. From the screenshot, only STATE_OK is generated whereas any service check with STATE_CRITICAL or WARNING is ignored.
Can these be produced too ? Where did I go wrong ?
Please help. Thanks.
#!/usr/bin/sh
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
exit 0
else
echo "QMIIB01 ABT: ${qmiib01abt}, QMPGCT01 ABT: ${qmpgct01abt}, QMPGS01 ABT: ${qmpgs01abt}"
fi
Regards,
Louis
Can these be produced too ? Where did I go wrong ?
Please help. Thanks.
#!/usr/bin/sh
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
exit 0
else
echo "QMIIB01 ABT: ${qmiib01abt}, QMPGCT01 ABT: ${qmpgct01abt}, QMPGS01 ABT: ${qmpgs01abt}"
fi
Regards,
Louis
You do not have the required permissions to view the files attached to this post.
Re: Transaction Timeout Anomalies for SSH Access
That is a great start, and honestly better than what I was thinking of for handling the return messages. Your script is hard coded to give an exit code of 0 if the check_mq_channels.sh file does not exist. If it does exist, then the script runs and does its thing. The only exit code that it provides is whether or not the script itself ran.
The exit code is how Nagios determines whether something is OK, WARNING, CRITICAL, or UNKNOWN. 0,1,2,3+, respectively. Try this.
Give that a shot and let me know how it goes. Definitely double check that I spelled all the variables correctly. I have been known to typo once in a while. 
The exit code is how Nagios determines whether something is OK, WARNING, CRITICAL, or UNKNOWN. 0,1,2,3+, respectively. Try this.
Code: Select all
#!/usr/bin/sh
#Setting returnresult to 3, so if something is broken it will return UNKNOWN
returnresult=3
if [[ ! -f /usr/local/nagios/check/check_mq_channel.sh ]]; then
#Setting this to critical, because if the check_mq_channel.sh file doesn't exist, that's a big problem
returnresult=2
else
#Putting all of these as part of the check to see if the check_mq_channel.sh file exists.
#If the file didn't exist, we would have received a bunch of errors since sh would have tried to execute the commands, then check to see if the file was there.
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
#If any of the results' exit code is greater than 0, the check returns CRITICAL
returnresult=2
else
returnresult=0
fi
echo "QMIIB01 ABT: ${qmiib01abt}, QMPGCT01 ABT: ${qmpgct01abt}, QMPGS01 ABT: ${qmpgs01abt}"
fi
#Personal preference, I like having scripts exit in one place. All of the logic prior to exiting determines the exit code.
exit $returnresult
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Thank a lot for your enlightenment.
The script does a great job identifying the status of the service check for 'QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN'
which is in critical state. However, it fails in doing so for the rest 'QMIIB01 ABT: Channels are running' and 'QMPGS01 ABT: Channels are running'
that are practically up and running (OK state).
Is it possible for Nagios to output their service status as well collectively ?
Channel Wrapper QMIIB01 Critical 7m 10s 10/10 2020-02-11 11:01:57 QMIIB01 ABT: Channels are running, QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN, QMPGS01 ABT: Channels are running
Regards,
Louis
The script does a great job identifying the status of the service check for 'QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN'
which is in critical state. However, it fails in doing so for the rest 'QMIIB01 ABT: Channels are running' and 'QMPGS01 ABT: Channels are running'
that are practically up and running (OK state).
Is it possible for Nagios to output their service status as well collectively ?
Channel Wrapper QMIIB01 Critical 7m 10s 10/10 2020-02-11 11:01:57 QMIIB01 ABT: Channels are running, QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN, QMPGS01 ABT: Channels are running
Regards,
Louis
You do not have the required permissions to view the files attached to this post.
Re: Transaction Timeout Anomalies for SSH Access
Isn't that what the script is already outputting? If one of the services goes down, it should throw a critical. And then in the message it specifies which services are running and which services are down. Or am I reading it incorrectly?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Yes, it is showing but not on a line by line format. Eg. OK -- QMIIB01 ABT: Channels are running, Critical -- QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN, OK -- QMPGS01 ABT: Channels are running.
Does Nagios XI support such functionality?? Thanks.
Does Nagios XI support such functionality?? Thanks.
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Basically, this is for ease of reading and monitoring by other Teamslouissiong wrote:Yes, it is showing but not on a line by line format. Eg. OK -- QMIIB01 ABT: Channels are running, Critical -- QMPGCT01 ABT: Following Channels are not running : ABT.SVRCONN, OK -- QMPGS01 ABT: Channels are running.
Does Nagios XI support such functionality?? Thanks.
Re: Transaction Timeout Anomalies for SSH Access
Oh yes, there are two ways to do this. The easiest is to just use a \n wherever you want a line break. If that doesn't work, you can use <br /> tags, but you have to enable HTML processing in Admin -> System Settings.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Thanks for your advice. Tried adding the \n to the script but still it doesn't display the service status on a line by line format.
Please refer to the script below. It only echos out the results. Is there any additional codes required or the conditions should be separated instead ?
#!/usr/bin/sh
retresult=3
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}"
fi
exit $retresult
Please refer to the script below. It only echos out the results. Is there any additional codes required or the conditions should be separated instead ?
#!/usr/bin/sh
retresult=3
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}"
fi
exit $retresult
You do not have the required permissions to view the files attached to this post.
Re: Transaction Timeout Anomalies for SSH Access
Okay, then let's try this with HTML. Go to Admin -> System Settings and check the "Allow HTML Tags in Host/Service Status" checkbox. Then modify the output portion of your script like so,
And that should get you your line breaks.
Code: Select all
echo "QMIIB01 ABT: ${qmiib01abt}<br \>"
echo "QMPGCT01 ABT: ${qmpgct01abt}<br \>"
echo "QMPGS01 ABT: ${qmpgs01abt}"As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
louissiong
- Posts: 32
- Joined: Wed Nov 20, 2019 1:07 am
Re: Transaction Timeout Anomalies for SSH Access
Still not working. Need to add any conditions beforehand to output the service status ?
Thanks.
Thanks.