Page 6 of 8
Re: Informix Monitoring
Posted: Mon Nov 19, 2018 5:52 pm
by tgriep
Your almost there. The plugin runs and is displaying data but is has to output a return code for when the status is OK, Warning, Critical and Unknown.
Take a look at the Plugin Guidelines at the following link.
https://nagios-plugins.org/doc/guidelines.html
I would guess the plugin is not outputting a status code at all which is an unknown.
Re: Informix Monitoring
Posted: Mon Nov 19, 2018 6:14 pm
by donnyforbes
I have a question? Something strange is really happening. It seems as the permission get changed on the check_informix.sh back to root.
I tried to run this command again from NAGIOS and I get this.
Code: Select all
[root@nag libexec]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.43 -c check_informix -a '/usr/informix dueynet'
NRPE: Unable to read output
[root@nag libexec]#
Then I went to the server to check the permission and I get this.
[
Code: Select all
root@duey libexec]# ls -l /usr/local/nagios/libexec/check_informix.sh
-rwxr-x---. 1 root root 684 Nov 14 22:41 /usr/local/nagios/libexec/check_informix.sh
[root@duey libexec]# su - nagios
Last login: Mon Nov 19 14:34:44 PST 2018 on pts/1
[nagios@duey ~]$ ls -l /usr/local/nagios/libexec/check_informix.sh
-rwxr-x---. 1 root root 684 Nov 14 22:41 /usr/local/nagios/libexec/check_informix.sh
[nagios@duey ~]$
can't we just set this to run for root and not nagios? I don't know why the permission would keep reverting back to root.
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 8:54 am
by donnyforbes
Hi tgriep,
I feel like I am really close. Just not sure why these two are showing up as "Unknown" can you assist me with this? As you can see in the picture below I disable the notification because it kept notifying me non stop. Please help me get this figured out so I can implement it.
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 1:43 pm
by tgriep
Did you look at the link I provided that talks about return codes and what they are used for?
Did you modify your plugin to return the codes when the check is OK, or in a warning state or a critical state?
If you post the plugin here and describe what you are checking with the plugin, we may be able to help.
About the permissions changing on the plugin, there must be some sort of security policy application that is resetting the permissions so find that and see if you can have it bypass the changes to the file.
Or, if you want, you can edit the command in the nrpe.cfg file to have it run as root.
Change the command to the following to run it as sudo.
Code: Select all
command[check_informix]=sudo /usr/local/nagios/libexec/check_informix.sh $ARG1$
Then restart NRPE for the changes to take effect.
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 4:20 pm
by donnyforbes
Hi,
So I figured out the permission thing. It was set in puppet so I modified the puppet build to use the correct permission and republished it.
I have notice that the permission are staying the same now.
I just need one last thing and that is to get the return to be OK and not Unknown. All of my other checks are OK how do we do this. I did look at that link, but was confused some. Please advise.
Also, what do you mean by this?
Did you modify your plugin to return the codes when the check is OK, or in a warning state or a critical state?
I did not do this, Where do I do this at? Please advise.
Thanks
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 4:34 pm
by donnyforbes
here is a screenshot of the what I have for the plugin on NAGIOSXI
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 4:54 pm
by tgriep
If you post the plugin here and describe what you are checking with the plugin, we may be able to help.
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 5:01 pm
by donnyforbes
you and I had worked on this before. I feel like this is taking way to long - and we keep going around and around. I am almost there and just need this to say OK and not unknown. And does a check every 5 minutes and if it is down it will notify us via email. We are using NagiosXI again and I got everything working from the shell prompt now just trying to get it all in NagiosXI. Again you and I have worked on this same thing before and believe we are really close.
Now when you say post my plugin. I thought that is what I did in the above Picture. Is there something else you are looking for?
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 5:06 pm
by tgriep
We need to see this file.
Code: Select all
/usr/local/nagios/libexec/check_informix.sh
We cannot help you unless you describe what you are checking with the plugin and what sort of messages it will generate when it is in a Warning and Critical state.
Re: Informix Monitoring
Posted: Tue Nov 20, 2018 5:10 pm
by donnyforbes
that file is a script. The script seems to be working fine. Ok I will attached the script again to this case, and then I will show you the output of what it looks like again form the XI.
Script:
Code: Select all
#!/bin/bash
#
# check_ifx - plugin to validate that Informix is online # # parameters # 1) Informix directory # 2) Informix server
print_use(){
echo -e "USE: check_ifx informixdir informixserver\\n"
echo -e "\t informixdir = Informix directory"
echo -e "\t informixserver = server name"
}
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
if [ $# -lt 2 ]
then
print_use
exit $STATE_UNKNOWN
fi
if [ $# -gt 2 ]
then
print_use
exit $STATE_UNKNOWN
fi
export INFORMIXDIR=$1
export INFORMIXSERVER=$2
result=`$INFORMIXDIR/bin/onstat -`
for cmd in $result
do
if [ $cmd = On-Line ]
then
echo $result
exit 0
fi
done
echo $result
exit 3
Now here is the screen shot of what is an the XI