Need to Monitor Informix
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Need to Monitor Informix
Does anyone know of a way to monitor "informix" This is a must for us and I have not been able to find anything. Basically what I am looking for is a way to get alerted when informix goes down.
Please advise on this it would be very helpful. Thank you.
Please advise on this it would be very helpful. Thank you.
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Re: Need to Monitor Informix
Ok here is what I did. Found the following script
chmod +x /usr/local/nagios/libexec/check_ifx.sh
chown nagios.nagios /usr/local/nagios/libexec/check_ifx.sh
Then added this to the bottom of your /usr/local/nagios/etc/nrpe.cfg:
command[check_informix]=/usr/local/nagios/libexec/check_ifx.sh
Then restart the nrpe service:
service xinetd restart
Next I went to the XI and created a new service like this see screen shot below. I am seeing this not sure why.. Any ideas would be great..
Thanks
Code: Select all
#! / Bin / bash
#
# Check_ifx - plugin to validate that informix is online
#
# settings
# 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 [2]
Then
Print_use
Exit $ STATE_UNKNOWN
Fi
If [gt-2]jj
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 3chown nagios.nagios /usr/local/nagios/libexec/check_ifx.sh
Then added this to the bottom of your /usr/local/nagios/etc/nrpe.cfg:
command[check_informix]=/usr/local/nagios/libexec/check_ifx.sh
Then restart the nrpe service:
service xinetd restart
Next I went to the XI and created a new service like this see screen shot below. I am seeing this not sure why.. Any ideas would be great..
Thanks
You do not have the required permissions to view the files attached to this post.
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Re: Need to Monitor Informix
when trying to run the following script check_ifx.sh here is what I get
here are the permission
[
Now sure what I am missing here. Please advise.
Code: Select all
[root@huey libexec]# ./check_ifx.sh
-bash: ./check_ifx.sh: /: bad interpreter: Permission denied
[root@huey libexec]#
[
Code: Select all
root@huey libexec]# ls -al check_ifx.sh
-rwxr-xr-x. 1 nagios nagios 698 Jul 6 11:36 check_ifx.sh
Re: Need to Monitor Informix
Code: Select all
#! / Bin / bash
#
# Check_ifx - plugin to validate that informix is online
...
Code: Select all
#!/bin/bash
#
# Check_ifx - plugin to validate that informix is online
...
Former Nagios employee
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Re: Need to Monitor Informix
I have done the following
It could be because informix is running right now, however I see this still in the XI.
Is there a way to test this to make sure everything is working correct form the XI? Also, do I need to do service nrpe restart && service xinetd restart ??? One thing I notice is this.
When I do both then do a grep for the following
When running the command from the XI I am getting the following message.
[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.42 -t 30 -c
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
Options:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
Am I missing something here? Also one last thing when I run the following command..
Here is the /usr/local/nagios/etc/nrpe.cfg
#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
#command[check_informix]=/usr/local/nagios/libexec/check_informix.sh
command[check_http]=/usr/local/nagios/libexec/check_http
command[check_ifx]=/usr/lccal/nagios/libexec/check_ifx.sh
Now when I run the script i am seeing this...[root@huey libexec]# cat check_ifx.sh
#!/bin/bash
#
# Check_ifx - plugin to validate that informix is online
#
Code: Select all
[root@huey libexec]# ./check_ifx.sh
./check_ifx.sh: line 15: STATE_OK: command not found
./check_ifx.sh: line 16: STATE_WARNING: command not found
./check_ifx.sh: line 17: STATE_CRITICAL: command not found
./check_ifx.sh: line 18: STATE_UNKNOWN: command not found
./check_ifx.sh: line 20: If: command not found
./check_ifx.sh: line 21: Then: command not found
./check_ifx.sh: line 10: Echo: command not found
./check_ifx.sh: line 11: Echo: command not found
./check_ifx.sh: line 12: Echo: command not found
./check_ifx.sh: line 23: Exit: command not found
./check_ifx.sh: line 24: Fi: command not found
./check_ifx.sh: line 26: If: command not found
./check_ifx.sh: line 27: Then: command not found
./check_ifx.sh: line 10: Echo: command not found
./check_ifx.sh: line 11: Echo: command not found
./check_ifx.sh: line 12: Echo: command not found
./check_ifx.sh: line 29: Exit: command not found
./check_ifx.sh: line 30: Fi: command not found
./check_ifx.sh: line 32: Export: command not found
./check_ifx.sh: line 33: Export: command not found
./check_ifx.sh: line 35: $: command not found
./check_ifx.sh: line 35: Result: command not found
./check_ifx.sh: line 37: For: command not found
./check_ifx.sh: line 38: syntax error near unexpected token `do'
./check_ifx.sh: line 38: `do'
[root@huey libexec]#
Is there a way to test this to make sure everything is working correct form the XI? Also, do I need to do service nrpe restart && service xinetd restart ??? One thing I notice is this.
When I do both then do a grep for the following
Code: Select all
[root@huey libexec]# ps -ef |grep nrpe
root 55709 20529 0 15:48 pts/0 00:00:00 grep --color=auto nrpe
[root@huey libexec]# ps -ef |grep 5666
root 56164 20529 0 15:49 pts/0 00:00:00 grep --color=auto 5666
[root@huey libexec]# ps -ef |grep xinetd
root 53374 1 0 15:46 ? 00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
root 56205 20529 0 15:49 pts/0 00:00:00 grep --color=auto xinetd
[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.42 -t 30 -c
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
Options:
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
Note:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
Am I missing something here? Also one last thing when I run the following command..
Code: Select all
[root@nag etc]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.42 -c check_ifx.sh
NRPE: Command 'check_ifx.sh' not defined
[root@nag etc]#
#command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
#command[check_informix]=/usr/local/nagios/libexec/check_informix.sh
command[check_http]=/usr/local/nagios/libexec/check_http
command[check_ifx]=/usr/lccal/nagios/libexec/check_ifx.sh
You do not have the required permissions to view the files attached to this post.
-
SteveBeauchemin
- Posts: 524
- Joined: Mon Oct 14, 2013 7:19 pm
Re: Need to Monitor Informix
You copied a foreign language shell script and used a language converter?
This is how it should probably look:
Did you find it here?
https://exchange.nagios.org/directory/P ... fx/details
I copied it from there and manually made the changes.
Good luck there... You scare me.
Steve B
This is how it should probably look:
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
https://exchange.nagios.org/directory/P ... fx/details
I copied it from there and manually made the changes.
Good luck there... You scare me.
Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Re: Need to Monitor Informix
Hi Steve,
Yes I did copy it and use a lang converter. What changes did you make manually? I will post the script below for you to see if that is okay.
Does this look right? I have copied the one you posted and when I run ./check_ifx.sh here is what I am getting.
Not sure if it is because "Informix" is running right now or not. Any ideas?
Yes I did copy it and use a lang converter. What changes did you make manually? I will post the script below for you to see if that is okay.
Code: Select all
#!/bin/bash
#
# Check_ifx - plugin to validate that informix is online # # settings # 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 [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
Code: Select all
[root@huey libexec]# ./check_ifx.sh
./check_ifx.sh: line 11: STATE_OK: command not found
./check_ifx.sh: line 12: STATE_WARNING: command not found
./check_ifx.sh: line 13: STATE_CRITICAL: command not found
./check_ifx.sh: line 14: STATE_UNKNOWN: command not found
./check_ifx.sh: line 16: If: command not found
./check_ifx.sh: line 17: Then: command not found
./check_ifx.sh: line 6: Echo: command not found
./check_ifx.sh: line 7: Echo: command not found
./check_ifx.sh: line 8: Echo: command not found
./check_ifx.sh: line 19: Exit: command not found
./check_ifx.sh: line 20: Fi: command not found
./check_ifx.sh: line 22: If: command not found
./check_ifx.sh: line 23: Then: command not found
./check_ifx.sh: line 6: Echo: command not found
./check_ifx.sh: line 7: Echo: command not found
./check_ifx.sh: line 8: Echo: command not found
./check_ifx.sh: line 25: Exit: command not found
./check_ifx.sh: line 26: Fi: command not found
./check_ifx.sh: line 28: Export: command not found
./check_ifx.sh: line 29: Export: command not found
./check_ifx.sh: line 31: $: command not found
./check_ifx.sh: line 31: Result: command not found
./check_ifx.sh: line 33: For: command not found
./check_ifx.sh: line 34: syntax error near unexpected token `do'
./check_ifx.sh: line 34: `do'
[root@huey libexec]#
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need to Monitor Informix
I would try Steve's code directly, it looks like your converter changed a bunch of itemsSteveBeauchemin wrote: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
Re: Need to Monitor Informix
@SteveBeauchemin posted his full script with the mods he made. The issue in yours as I mentioned is that your commands are capitalized (I might not have been clear on this, if so I apologize). Things like Echo, Print_use () and If need to be echo, print_use () and if, for example. Not sure what converter you used but it seems to have capitalized everything. It also added spaces and extra slashes where there should be none, for example "USE: check_ifx informixdir informixserver \\ n" and "\ t informixdir = Informix directory" should be "USE: check_ifx informixdir informixserver \n" and "\t informixdir = Informix directory".
If you use the code he posted, it should work.
If you use the code he posted, it should work.
Former Nagios employee
-
donnyforbes
- Posts: 357
- Joined: Tue Jun 13, 2017 2:17 pm
Re: Need to Monitor Informix
I copied exactly what Steve did. For some reason why coping and pasting into putty it did not do it right. I have done it line upon line. here is the code below.
When I run the the script ./check_ifx.sh ( I get this errror ) not sure where I missed it.
Any idea would be great.
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
Code: Select all
[root@huey libexec]# ./check_ifx.sh
./check_ifx.sh: line 19: If: command not found
./check_ifx.sh: line 20: syntax error near unexpected token `then'
./check_ifx.sh: line 20: `then'