Showing posts with label nagios. Show all posts
Showing posts with label nagios. Show all posts

Monday, December 12, 2016

Percona Monitoring Plugins for Nagios on SmartOS

Using Percona monitoring plugins inside a SmartOS branded zone, I get an error related to the local command.

percona-monitoring-plugins-1.1.7/nagios/bin/pmp-check-mysql-innodb[58]: local: not found [No such file or directory]

To solve this problem, perform the following command against every script (i.e. inside the nagios/bin/ directory).

sed -i 's/^\( \{2,4\}\)local /\1typeset /' *

Monday, March 14, 2016

OMD: python problem after CentOS yum update

After yum update I got a problem, related to python, with check_mk in the OMD implementation.

Environment:

  • CentOS 7
  • check_mk 1.2.4p5
  • omd-1.20


In the check_mk web page you can see a lot of messages like this in each "Check_MK inventory" check.

(Return code of 5 is out of bounds)

and if you issue the check_mk command you get

Cannot read file /omd/sites/prod/share/check_mk/modules/check_mk_base.py: 'frozenset' object is not callable

My solution was:

cp /omd/versions/1.20/lib/python/hashlib.py /omd/versions/1.20/lib/python/hashlib.py.OLD

cp /usr/lib64/python2.7/hashlib.py /omd/versions/1.20/lib/python/hashlib.py

Tuesday, June 30, 2015

Nagios plugin: check oracle query

Here is a Nagios plugin useful to connect to an Oracle database, perform a query and check the result by a regular expression.

Please note: it works for me, but it is far from perfect.

https://github.com/alcir/nagios/tree/master/check_oracle_query

Examples

./check_oracle_query.sh -H 192.168.1.10 -u user -w pass -p 1521 -s SID -n ID -q "select * from table" -e "^[1-9].* rows selected"

./check_oracle_query.sh -H 10.0.0.47 -u user -w pass -p 1521 -s SID01 -n ID1 -q "select * from dual" -e "^X"

Thursday, March 5, 2015

Installing check_mk agent on a SmartOS global zone

The check_mk agent uses inetd (or xinetd).
On Solaris, and on SmartOS, inetd is a legacy facility.
In addition, on the SmartOS GZ, the stuff configured in the /etc directory doesn't survive to reboots, as you may know.

So, since I already use a method to set the hostname at boot time, as described in this blog https://nickebo.net/creating-a-custom-motd-in-the-smartos-global-zone/, I added a pair of lines in the postboot script.


echo "check_mk        6556/tcp" >> /etc/services
echo "check_mk stream tcp nowait root /usr/sbin/tcpd /opt/custom/bin/check_mk_agent" >> /etc/inet/inetd.conf
inetconv
inetconv -e



Then download the check_mk solaris agent from github and put it in the /opt/custom/bin/ directory.


Obviously, if you don't want to reboot the GZ, but enable the service right now, issue the same commands as above.

Remember to change the MK_LIBDIR and the MK_CONFDIR variables in the /opt/custom/bin/check_mk_agent script in order to use additional plugins or configurations.


Wednesday, August 7, 2013

using send_nsca from SmartOS global zone

If you don't want to install pkgin in the global zone, but you want to use Nagios send_nsca command, this is how I did it.

Inside a zone install the nagios-nsca package.

pkgin in nagios-nsca-2.9.1nb2


From the global zone, cd to the zone zfs and copy these files in a place of your own.

cd /zones/<uuid>

cp opt/local/gcc47/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1 /opt/custom/nsca/

cp opt/local/gcc47/x86_64-sun-solaris2.11/lib/amd64/libgcc_s.so.1
/opt/custom/nsca/

cp opt/local/lib/libmcrypt.so.4
/opt/custom/nsca/


Create a configuration file

vi /opt/custom/nsca/send_nsca.cfg


Now set the LD_LIBRARY_PATH variable and run the command

export LD_LIBRARY_PATH=/opt/custom/nsca; echo "host;passive_check;0;All seems to be OK" | /opt/custom/nsca/send_nsca -H nagios.ip -p 5667 -d ";" -c /opt/custom/nsca/send_nsca.cfg

nsca and send_nsca version incompatibility

I have a Nagios NSCA server running on Debian squeeze. The installed nsca package is the 2.7.2

I want to send passive nagios checks from a SmartOS zone. But the pkgsrc version of nsca client package is 2.9.1

There are incompatibility issues between the 2.7 server 2.7 and a 2.9 client (example http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670373).

Dropping packet with invalid CRC32 - possibly due to client using wrong password or crypto algorithm?

To resolve the problem without upgrading Debian to a newer release, you can use backports.
Following the instructions I've added a new source to apt

vi /etc/apt/sources.list.d/backports.list

deb http://mi.mirror.garr.it/mirrors/debian-backports squeeze-backports main

apt-get update

And I've installed the newer version of NSCA server.

apt-get -t squeeze-backports install nsca

Now the latest version of send_nsca available on SmartOS works.

Quick testing shows that the 2.7.2 clients seems to work with the 2.9.1 server.

nagios plugin to compare (master/slave) SOA records

This is a Nagios script to compare the master ns and the slave ns SOA records.
So you can know if the slave zone is expired, or is not in sync with the master.

http://exchange.nagios.org/directory/Plugins/Network-Protocols/DNS/checkexpire/details

https://github.com/alcir/checkexpire.sh


Thursday, December 13, 2012

nagios linux software raid plugin

Until now, I was using Hari Sekhon 0.7.2 check_md_raid plugin to monitor Centos software disk RAIDs.

There was an issue: in Centos there is a weekly cron job /etc/cron.weekly/99-raid-check that resync all the md raid devices.
So every weekends there were Nagios warnings for each Centos linux server about unclean md status, until resync finished.

Not so nice.

So I switched to a plugin found under the contrib directory of official Nagios plugins: /usr/lib64/nagios/plugins/check_md_raid

command[check_raid]=/usr/lib64/nagios/plugins/contrib/check_linux_raid.pl

Friday, July 20, 2012

Nagios plugin: check_SL500

check_SL500 is a shell script to check various things on a Sun StorageTek(TM) SL500 Modular Library System (maybe it works with other models). Currently the script can check:
  • fan status
  • drives temperature
  • robot status
  • cap status
  • controller status
  • overall (toplevel) status
  • system load