Need to Monitor Informix

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Need to Monitor Informix

Post by tgriep »

Can you post the check_ifx.sh script from the remote server so we can view it?
Also, run this on the remote server and post the output.

Code: Select all

ls -l /usr/local/nagios/libexec/
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: Need to Monitor Informix

Post by donnyforbes »

Here is the script

Code: Select all

#!/bin/bash
#
# check_ifx - plugin to validate that informix is onlinea # # # 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 etc]# ls -l /usr/local/nagios/libexec/
total 6928
-rwxr-xr-x. 1 root   nagios 204592 Jun 27 12:16 check_apt
-rwxr-xr-x. 1 root   nagios   6897 Jun 27 12:16 check_asterisk.pl
-rwxr-xr-x. 1 root   nagios   1978 Jun 27 12:16 check_asterisk_sip_peers.sh
-rwxr-xr-x. 1 root   nagios   2242 Jun 27 12:16 check_breeze
-rwxr-xr-x. 1 root   nagios 208712 Jun 27 12:16 check_by_ssh
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_clamd -> check_tcp
-rwxr-xr-x. 1 root   nagios 153328 Jun 27 12:16 check_cluster
-rwxr-xr-x. 1 root   nagios   5582 Jun 27 12:16 check_cpu_stats.sh
-rwsr-xr-x. 1 root   nagios 201816 Jun 27 12:16 check_dhcp
-rwxr-xr-x. 1 root   nagios 200544 Jun 27 12:16 check_dig
-rwxr-xr-x. 1 root   nagios 221504 Jun 27 12:16 check_disk
-rwxr-xr-x. 1 root   nagios   9289 Jun 27 12:16 check_disk_smb
-rwxr-xr-x. 1 root   nagios 218584 Jun 27 12:16 check_dns
-rwxr-xr-x. 1 root   nagios 117488 Jun 27 12:16 check_dummy
-rwxr-xr-x. 1 root   nagios   3349 Jun 27 12:16 check_file_age
-rwxr-xr-x. 1 root   nagios   6315 Jun 27 12:16 check_flexlm
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_ftp -> check_tcp
-rwxr-xr-x. 1 root   nagios 337512 Jun 27 12:16 check_http
-rwsr-xr-x. 1 root   nagios 213888 Jun 27 12:16 check_icmp
-rwxr-xr-x. 1 root   nagios 164240 Jun 27 12:16 check_ide_smart
-rwxr-xr-x. 1 root   nagios  15123 Jun 27 12:16 check_ifoperstatus
-rwxr-xr-x. 1 root   nagios  12600 Jun 27 12:16 check_ifstatus
-rwxr-xr-x. 1 nagios nagios    685 Jul  7 14:12 check_ifx.sh
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_imap -> check_tcp
-rwxr-xr-x. 1 nagios nagios    241 Jun 30 13:44 check_informix.sh
-rwsr-xr-x. 1 root   nagios    972 Jun 27 12:16 check_init_service
-rwxr-xr-x. 1 root   nagios   6887 Jun 27 12:16 check_ircd
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_jabber -> check_tcp
-rwxr-xr-x. 1 root   nagios 177928 Jun 27 12:16 check_load
-rwxr-xr-x. 1 root   nagios   5981 Jun 27 12:16 check_log
-rwxr-xr-x. 1 root   nagios  21480 Jun 27 12:16 check_mailq
-rwxr-xr-x. 1 root   nagios 163472 Jun 27 12:16 check_mrtg
-rwxr-xr-x. 1 root   nagios 163312 Jun 27 12:16 check_mrtgtraf
-rwxr-xr-x. 1 root   nagios 176760 Jun 27 12:16 check_nagios
-rwxr-xr-x. 1 root   nagios  25602 Jun 27 12:16 check_netstat.pl
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_nntp -> check_tcp
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_nntps -> check_tcp
-rwxr-xr-x. 1 root   nagios  81592 Jun 27 12:16 check_nrpe
-rwxr-xr-x. 1 root   nagios 209784 Jun 27 12:16 check_nt
-rwxr-xr-x. 1 root   nagios 213328 Jun 27 12:16 check_ntp
-rwxr-xr-x. 1 root   nagios 202384 Jun 27 12:16 check_ntp_peer
-rwxr-xr-x. 1 root   nagios 197552 Jun 27 12:16 check_ntp_time
-rwxr-xr-x. 1 root   nagios 240328 Jun 27 12:16 check_nwstat
-rwxr-xr-x. 1 root   nagios   3259 Jun 27 12:16 check_open_files.pl
-rwxr-xr-x. 1 root   nagios   8779 Jun 27 12:16 check_oracle
-rwxr-xr-x. 1 root   nagios 183080 Jun 27 12:16 check_overcr
-rwxr-xr-x. 1 root   nagios 213136 Jun 27 12:16 check_ping
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_pop -> check_tcp
-rwxr-xr-x. 1 root   nagios 213272 Jun 27 12:16 check_procs
-rwxr-xr-x. 1 root   nagios 179960 Jun 27 12:16 check_real
-rwxr-xr-x. 1 root   nagios   9581 Jun 27 12:16 check_rpc
-rwxr-xr-x. 1 root   nagios   1453 Jun 27 12:16 check_sensors
-rwxr-xr-x. 1 root   nagios   2174 Jun 27 12:16 check_services
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_simap -> check_tcp
-rwxr-xr-x. 1 root   nagios   7599 Jun 27 12:16 check_sip
-rwxr-xr-x. 1 root   nagios 270832 Jun 27 12:16 check_smtp
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_spop -> check_tcp
-rwxr-xr-x. 1 root   nagios 179440 Jun 27 12:16 check_ssh
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_ssmtp -> check_tcp
-rwxr-xr-x. 1 root   nagios 161248 Jun 27 12:16 check_swap
-rwxr-xr-x. 1 root   nagios 256184 Jun 27 12:16 check_tcp
-rwxr-xr-x. 1 root   nagios 181136 Jun 27 12:16 check_time
lrwxrwxrwx. 1 root   root        9 Jun 27 12:16 check_udp -> check_tcp
-rwxr-xr-x. 1 root   nagios 193704 Jun 27 12:16 check_ups
-rwxr-xr-x. 1 root   nagios 153952 Jun 27 12:16 check_uptime
-rwxr-xr-x. 1 root   nagios 152392 Jun 27 12:16 check_users
-rwxr-xr-x. 1 root   nagios   2936 Jun 27 12:16 check_wave
-rwxr-xr-x. 1 root   nagios    710 Jun 27 12:16 check_yum
-rwxr-xr-x. 1 root   nagios   3435 Jun 27 12:16 custom_check_mem
-rwxr-xr-x. 1 root   nagios    915 Jun 27 12:16 custom_check_procs
-rwxr-xr-x. 1 root   nagios   4176 Jun 27 12:16 nagisk.pl
-rwxr-xr-x. 1 root   nagios 148392 Jun 27 12:16 negate
-rwxr-xr-x. 1 root   nagios  73408 Jun 27 12:16 send_nsca
-rwxr-xr-x. 1 root   nagios 145864 Jun 27 12:16 urlize
-rwxr-xr-x. 1 root   nagios   1895 Jun 27 12:16 utils.pm
-rwxr-xr-x. 1 root   nagios   2791 Jun 27 12:16 utils.sh
[root@huey etc]#
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Need to Monitor Informix

Post by tgriep »

Thanks for the full script.
Funny thing it requires 2 arguments, folder and the server name, but is doesn't use the server name.
You may want to remove the argument check from the script.

I have more commands for you to run on the remote server. Run these and post the output.

Code: Select all

ls -l /usr/informix/bin/onstat
ls -l /bin/bash
uname -a
cat /etc/*release*
chage -l nagios
grep nag /etc/passwd
grep nag /etc/group
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: Need to Monitor Informix

Post by donnyforbes »

Here is the output from the coomands. In the script what argument should I remove?

Code: Select all

[root@huey libexec]# ls -l /usr/informix/bin/onstat
-rwxr-sr-x. 1 informix informix 6390800 May  7 08:00 /usr/informix/bin/onstat

[root@huey libexec]# ls -l /bin/bash
-rwxr-xr-x. 1 root root 960616 Oct 17  2016 /bin/bash

[root@huey libexec]# cat /etc/*release*
cat: /etc/lsb-release.d: Is a directory
NAME="Red Hat Enterprise Linux Server"
VERSION="7.3 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.3"
NAME="Red Hat Enterprise Linux Server"
VERSION="7.2 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.2"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.2:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.2"
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Red Hat Enterprise Linux Server release 7.3 (Maipo)
cpe:/o:redhat:enterprise_linux:7.3:ga:server

[root@huey libexec]# change -n nagios
-bash: change: command not found

[root@huey libexec]# grep nag /etc/passwd
systemd-network:x:998:996:systemd Network Management:/:/sbin/nologin
bminagil:x:1080:3001::/home/rmca73:/sbin/nologin
nagios:x:1411:1411::/home/nagios:/bin/bash

[root@huey libexec]# grep nag /etc/group
nagios:x:1411:nagios
nagcmd:x:3002:nagios
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: Need to Monitor Informix

Post by donnyforbes »

This script was written by one of your support guys. Not sure what argument to remove. If you look at the beginning of this ticket and go through it you will see the everything.
Thanks for assisting me with this....
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Need to Monitor Informix

Post by tgriep »

I changed your script so it does not need any arguments as it didn't use the hostname and I am assuming the path to onstat will not change so replace the script with the following.

Code: Select all

#!/bin/bash
#
# check_ifx - plugin to validate that informix is onlinea # # # parameters # 1) Informix directory # 2) Informix server

result=`/usr/informix/bin/onstat -`

for cmd in $result
do
  if [ $cmd = On-Line ]
  then
	 echo $result
	 exit 0
  fi
done
echo "CRITICAL"
exit 2
Make sure when you edit the script, the permissions stay the same so the nagios user can access and execute the script.


Also, there may need to be some changes that have to be done in the /etc/sudoers file on the remote system.
Open that file and if this option is set

Code: Select all

Defaults    requiretty
Comment it out by changing it to this

Code: Select all

############Defaults    requiretty
You may also need this line added to the sudoers file.

Code: Select all

Defaults   !visiblepw
Try that and see if it works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: Need to Monitor Informix

Post by donnyforbes »

Ok made the changes in the script I ran it from the remote server like this.\

Code: Select all

[root@huey libexec]# ./check_ifx.sh
IBM Informix Dynamic Server Version 12.10.FC8W2WE -- On-Line (Prim) -- Up 2 days 03:47:22 -- 1034088 Kbytes
[root@huey libexec]#
I was not sure about the changes you wanted me to make in the /etc/sudoers ...

what would you like me to do to test this?

I figured it would be easier if I post the /etc/sudoers in here ..

Code: Select all

## Sudoers allows particular users to run various commands as ## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections ## of related commands, which can then be delegated out to particular ## users or groups.
##
## This file must be edited with the 'visudo' command.

## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhaps using ## wildcards for entire domains) or IP addresses instead.
# Host_Alias     FILESERVERS = fs1, fs2
# Host_Alias     MAILSERVERS = smtp, smtp2

## User Aliases
## These aren't often necessary, as you can use regular groups ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname ## rather than USERALIAS # User_Alias ADMINS = jsmith, mikem


## Command Aliases
## These are groups of related commands...

## Networking
# Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

## Installation and management of software
# Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum

## Services
# Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig, /usr/bin/systemctl start, /usr/bin/systemctl stop, /usr/bin/systemctl reload, /usr/bin/systemctl restart, /usr/bin/systemctl status, /usr/bin/systemctl enable, /usr/bin/systemctl disable

## Updating the locate database
# Cmnd_Alias LOCATE = /usr/bin/updatedb

## Storage
# Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

## Delegating permissions
# Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp 

## Processes
# Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

## Drivers
# Cmnd_Alias DRIVERS = /sbin/modprobe

# Defaults specification

#
# Refuse to run if unable to disable echo on the tty.
#
Defaults   !visiblepw

#
# Preserving HOME has security implications since many programs
# use it when searching for configuration files. Note that HOME
# is already set when the the env_reset option is enabled, so
# this option is only effective for configurations where either
# env_reset is disabled or HOME is present in the env_keep list.
#
Defaults    always_set_home

Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults   env_keep += "HOME"

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

## Next comes the main part: which users can run what software on 
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
## 	user	MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere 
root	ALL=(ALL) 	ALL

## Allows members of the 'sys' group to run networking, software, 
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
%wheel	ALL=(ALL)	ALL

## Same thing without a password
# %wheel	ALL=(ALL)	NOPASSWD: ALL

## Allows members of the users group to mount and unmount the 
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service

# ASTERISK-SPECIFIC CHECKS
# NOTE: You can uncomment the following line if you are monitoring Asterisk locally
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_asterisk_sip_peers.sh, /usr/local/nagios/libexec/nagisk.pl, /usr/sbin/asterisk

Let me know what you would like me to do next.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Need to Monitor Informix

Post by dwhitfield »

donnyforbes wrote: what would you like me to do to test this?
Since you made changes to the script, and not nrpe, it should just populate XI when the next check is run. You can also click the "Force and immediate check" option.
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: Need to Monitor Informix

Post by donnyforbes »

Came in this morning and still seeing this. What am I missing? I really need to get this working. I have two other servers I need to get this script working on as well.
Our "Informix is a cluster enviroment" I figure once we getting in working on one then I can just duplicate the exact same on the other two, but need to get it working
on the one first :)
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

Post by donnyforbes »

Still not working can someone assist me with this really need to get this working. Thanks again...
Locked