Gnome indicator for nagios
It adds icon indicator to gnome panel.
This applet automatically check your nagios server and notify about all problems using popup messages.
https://github.com/volodymyrko/nagios_indicator
Showing posts with label nagios. Show all posts
Showing posts with label nagios. Show all posts
Friday, September 20, 2013
Monday, December 26, 2011
Sorry, but Nagios is currently not checking for external commands
Sorry, but Nagios is currently not checking for external commands
You probably saw following message “Sorry, but Nagios is currently not checking for external commands, so your command will not be committed” when you tried to reschedule a service check in nagios web interface. The reason behind this is that nagios by default does not check for external commands. To resolve that problem we need to reconfigure nagios.
To enable checking for external commands we have to edit main nagios configuration file nagios.cfg, which is usually located in /etc/nagios3. You have to change below line
check_external_commands=0
to
check_external_commands=1
and reload nagios using
/etc/init.d/nagios3 reload
When you try again to reschedule service check from web interface the following error can come up: Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!. This is because of the bug in Debian, which is described here http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571801. The solution is quite simple:
# /etc/init.d/nagios3 stop Stopping nagios3 monitoring daemon: nagios3Waiting for nagios3 daemon to die... . # dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw # dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 # /etc/init.d/nagios3 start Starting nagios3 monitoring daemon: nagios3.
Wednesday, November 16, 2011
check exim mail queue with nagios
Standart nagios plugin for checking mail queue (/usr/lib/nagios/plugins/check_mailq) doesn't allow to monitor exim queue .. it always return "OK" status and report that queue is empty
for example:
for example:
# exim -bpc
12
and
# /usr/lib/nagios/plugins/check_mailq -w 500 -c 1000
OK: mailq is empty|unsent=0;500;1000;0
so, we need write simple shell script, that allow us to monitor exim4 mail queue with nagios.
name it check_exim_mailqueue.sh and drop it into /usr/local/bin/ directory.
name it check_exim_mailqueue.sh and drop it into /usr/local/bin/ directory.
#!/bin/sh ############################################### # # Nagios script to check Exim mail queue status # # Copyright 2007, 2008 Ian Yates # # NOTE: Depending on your config, the nagios user will probably be # needed to be added to the exim group for this script to function correctly # ############################################### . /usr/lib/nagios/plugins/utils.sh EXIM=/usr/sbin/exim FLAG_VERBOSE=FALSE LEVEL_WARN="" LEVEL_CRIT="" RESULT="" EXIT_STATUS=$STATE_OK ############################################### # ## FUNCTIONS # ## Print usage usage() { echo " check_eximailqueue $VERSION - Nagios Exim mail queue check script" echo "" echo " Usage: check_eximailqueue -w-c [ -v ] [ -h ]" echo "" echo " -w Queue size at which a warning is triggered" echo " -c Queue size at which a critical is triggered" echo " -v Verbose output (ignored for now)" echo " -h Show this page" echo "" } ## Process command line options doopts() { if ( `test 0 -lt $#` ) then while getopts w:c:vh myarg "$@" do case $myarg in h|\?) usage exit;; w) LEVEL_WARN=$OPTARG;; c) LEVEL_CRIT=$OPTARG;; v) FLAG_VERBOSE=TRUE;; *) # Default usage exit;; esac done else usage exit fi } # Write output and return result theend() { echo $RESULT exit $EXIT_STATUS } # ## END FUNCTIONS # ############################################# # ## MAIN # # Handle command line options doopts $@ # Do the do OUTPUT=`$EXIM -bpc` if test -z "$OUTPUT" ; then RESULT="Mailqueue WARNING - query returned no output!" EXIT_STATUS=$STATE_WARNING else if test "$OUTPUT" -lt "$LEVEL_WARN" ; then RESULT="Mailqueue OK - $OUTPUT messages on queue" EXIT_STATUS=$STATE_OK else if test "$OUTPUT" -ge "$LEVEL_CRIT" ; then RESULT="Mailqueue CRITICAL - $OUTPUT messages on queue" EXIT_STATUS=$STATE_CRITICAL else if test "$OUTPUT" -ge "$LEVEL_WARN" ; then RESULT="Mailqueue WARNING - $OUTPUT messages on queue" EXIT_STATUS=$STATE_WARNING fi fi fi fi # Quit and return information and exit status theend
original script is there http://exchange.nagios.org/directory/Plugins/Email-and-Groupware/Exim/check_eximailqueue/details //
We modify it to work in debian and ubuntu/// and we threw unnecessary sudo usage.
All you need : add nagios user to Debian-exim group in /etc/group:
Debian-exim:x:118:nagios
than do this script executable:
# chmod u+x /usr/local/bin/check_exim_mailqueue.sh# chown nagios:root /usr/local/bin/check_exim_mailqueue.sh
now you can use this script in nagios-nrpe-server: define new command in nrpe configuration file (nrpe.conf ):
command[check_exim_mailq]=/usr/local/bin/check_exim_mailqueue.sh -w 500 -c 1000# /etc/init.d/nagios-nrpe-server restart
or you an use it directrly with nagios: create new command in nagios config file.
define command{
command_name check_exim_mailq
command_line /usr/local/bin/check_exim_mailqueue.sh -w $ARG1$ -c $ARG2$ }# /etc/init.d/nagios reloadTuesday, November 1, 2011
hot-to monitor raid status with lsi 9211-4i
In my previous post i told how to monitor raid stutus with lsi 9260-4i with nagios. Now i tell how to monitor raid status with raid controller lsi 9211-4i. This controller doesn't support by MegaCli utility.
The solution is: to use sas2ircu
you can find it there:
http://www.supermicro.com/support/faqs/data_lib/FAQ_9633_SAS2IRCU_Phase_5.0-5.00.00.00.zip
The zip file includes the utility for DOS, Linux PPC, Linux x86 (which will also work on x64), Solaris Sparc and X86, and Windows 32-bit and 64-bit.
i use it with nagios-nrpe server, so i write very-very simple shell script (/usr/local/bin/check_sas2ircu_raid.sh):
and now, write in nrpe config (for example, /etc/nagios/nrpe_local.cfg )
and finally, add to sudoers file
now you can check raid status with nagios, simply add new service to nagios host config
The solution is: to use sas2ircu
you can find it there:
http://www.supermicro.com/support/faqs/data_lib/FAQ_9633_SAS2IRCU_Phase_5.0-5.00.00.00.zip
The zip file includes the utility for DOS, Linux PPC, Linux x86 (which will also work on x64), Solaris Sparc and X86, and Windows 32-bit and 64-bit.
i use it with nagios-nrpe server, so i write very-very simple shell script (/usr/local/bin/check_sas2ircu_raid.sh):
#!/bin/shexitstatus=2STATUS=`/usr/local/bin/sas2ircu 0 STATUS |grep "Volume state"`state=`echo "$STATUS"| awk '{ print $4 }'`if [ "$state" = "Optimal" ]thenexitstatus=0fiecho "Volume state: $state"exit $exitstatus
and now, write in nrpe config (for example, /etc/nagios/nrpe_local.cfg )
command[check_raid]=/usr/bin/sudo /usr/local/bin/check_sas2ircu_raid.sh
and finally, add to sudoers file
nagios ALL= NOPASSWD: /usr/local/bin/check_sas2ircu_raid.sh
now you can check raid status with nagios, simply add new service to nagios host config
how to monitor lsi hardware raid
We have installation of debian-6 (amd64) on hardware raid1 with lsi controller 9260-4i. And we want to monitor raid staus with nagios..
In debian repositories is present package mpt-status, but it can't help in this situation. After installation mpt-status don't work properly.
The solution is to use MegaCli package from lsi.
But it is very hard to find and download this package// avaliable link to download MegaCli is http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip .
Download it .
Unzip file. You will have rpm file. We use Debian, so we need to run (extrat file from rpm)
rpm2cpio MegaCli-8.02.16-1.i386.rpm | cpio -idmv
you will have both executable files: for 32 and 64 - architecture .
The binaries are statically compiled so actually run fine.
you can also need to install libsysfs2 , which is need for MegaCli. And if libsysfs version is difeerent you can create sym link to existing .
In this situation, it simply turned out my drives were setup as RAID 1 mirrors, which was easy to discern using:
./MegaCli64 -CfgDsply -aALL
Most useful command is:
#Physical Disk List
./MegaCli64 -PDList -aALL
#Physical Drive Info
./MegaCli64 -pdInfo -PhysDrv \[252:4\] -aALL |less
#Logical Disk Info
./MegaCli64 -LDInfo -LAll -aAll | less
# Config Display
./MegaCli64 -CfgDsply -aALL
# Config add Logical Drive
./MegaCli64 -CfgLdAdd -r0 \[252:4,252:5\] -a0
# Logical Drive Init
./MegaCli64 -LDInit -Start -L2 -a0
In debian repositories is present package mpt-status, but it can't help in this situation. After installation mpt-status don't work properly.
The solution is to use MegaCli package from lsi.
But it is very hard to find and download this package// avaliable link to download MegaCli is http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip .
Download it .
Unzip file. You will have rpm file. We use Debian, so we need to run (extrat file from rpm)
rpm2cpio MegaCli-8.02.16-1.i386.rpm | cpio -idmv
you will have both executable files: for 32 and 64 - architecture .
The binaries are statically compiled so actually run fine.
you can also need to install libsysfs2 , which is need for MegaCli. And if libsysfs version is difeerent you can create sym link to existing .
In this situation, it simply turned out my drives were setup as RAID 1 mirrors, which was easy to discern using:
./MegaCli64 -CfgDsply -aALL
Most useful command is:
#Physical Disk List
./MegaCli64 -PDList -aALL
#Physical Drive Info
./MegaCli64 -pdInfo -PhysDrv \[252:4\] -aALL |less
#Logical Disk Info
./MegaCli64 -LDInfo -LAll -aAll | less
# Config Display
./MegaCli64 -CfgDsply -aALL
# Config add Logical Drive
./MegaCli64 -CfgLdAdd -r0 \[252:4,252:5\] -a0
# Logical Drive Init
./MegaCli64 -LDInit -Start -L2 -a0
Monday, January 24, 2011
nagios-nrpe в ubuntu
aptitude update
aptitude install nagios-nrpe-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
fancontrol{a} gawk{a} libnet-snmp-perl{a} libperl5.10{a} libradius1{a} libsensors4{a} libsnmp-base{a} libsnmp15{a} libtalloc2{a} libwbclient0{a} lm-sensors{a} nagios-nrpe-server
nagios-plugins{a} nagios-plugins-basic{a} nagios-plugins-standard{a} radiusclient1{a} samba-common{a} samba-common-bin{a} smbclient{a} snmp{a}
0 packages upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.1MB of archives. After unpacking 67.3MB will be used.
Do you want to continue? [Y/n/?] Y
cd /etc/nagios
# cat nrpe.cfg
log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda6
command[check_var]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda8
command[check_usr]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda7
command[check_tmp]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda9
command[check_data]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda10
command[check_sdb]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sdb1
include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
в змінну allowed_hosts додаємо ІР-адресу вашого nagios-серверу, той який і провіряю
dont_blame_nrpe - відповідає : дозволяти (1) чи не дозволяти (0) пердеават клієнтам (nagios-серверу) параметри в командній стрічці,
наприклад, замість
check_disk -w 20% -c 10 % -p /dev/sda6
було б
check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
а виклик з nagios-у був би
check_nrpe!check-root!20%!10%!/dev/sda6
не забутьде nagios.cfg ще поправити
aptitude install nagios-nrpe-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
fancontrol{a} gawk{a} libnet-snmp-perl{a} libperl5.10{a} libradius1{a} libsensors4{a} libsnmp-base{a} libsnmp15{a} libtalloc2{a} libwbclient0{a} lm-sensors{a} nagios-nrpe-server
nagios-plugins{a} nagios-plugins-basic{a} nagios-plugins-standard{a} radiusclient1{a} samba-common{a} samba-common-bin{a} smbclient{a} snmp{a}
0 packages upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.1MB of archives. After unpacking 67.3MB will be used.
Do you want to continue? [Y/n/?] Y
cd /etc/nagios
# cat nrpe.cfg
log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda6
command[check_var]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda8
command[check_usr]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda7
command[check_tmp]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda9
command[check_data]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda10
command[check_sdb]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sdb1
include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
в змінну allowed_hosts додаємо ІР-адресу вашого nagios-серверу, той який і провіряю
dont_blame_nrpe - відповідає : дозволяти (1) чи не дозволяти (0) пердеават клієнтам (nagios-серверу) параметри в командній стрічці,
наприклад, замість
check_disk -w 20% -c 10 % -p /dev/sda6
було б
check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
а виклик з nagios-у був би
check_nrpe!check-root!20%!10%!/dev/sda6
не забутьде nagios.cfg ще поправити
Tuesday, June 2, 2009
звіти від Nagios на sms...
Після встановлення nagios виникла в мене проблемка, пошту, куда зазвичай nagios шле свої оповіщення, я і не так часто читаю. От і подумав: як би то оперативніше дізнаватися про то, що щось сталося на серверах... ?? із варіантів було або icq, в якому я на роботі постійно, або смс - телефон завджи ввімкнений.. З icq - нічого простого я не знайшов, тому і зразу перейшов до налаштування відправлення повідомлень на мобільний телефон..
Для "Київстару" треба спочатку підключити сервіс, який доволяє відсилання повідомлень email->смс... для цього потрібно відіслати пусте смс на певний номер (7020 чи 7021 точно не памятаю), який варто уточнити в оператора..
Далі преходимо до налашування nagios
До опису вашого контакту (по замовчуванні contacts.cfg)
додаємо
pager         38<ван номер>@sms.kyivstar.net
і описуємо нову команду ( commands.cfg )
command_name notify-service-by-epager
command_line /usr/bin/printf "%b" "$SERVICEDESC$\n $HOSTADDRESS$ $SERVICESTATE$\n $SHORTDATETIME$\n" | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ *" $CONTACTEMAIL$
}
define command{
command_name notify-host-by-epager
command_line /usr/bin/printf "%b" "$HOSTADDRESS$\n $SHORTDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$: $HOSTNAME$ $HOSTSTATE$ **" $CONTACTEMAIL$
}
в contacts.cfg
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
міняємо на
service_notification_commands notify-service-by-email, notify-service-by-epager
host_notification_commands notify-host-by-email, notify-host-by-epager
текст, що приходитиме на смс можна змінити в стрічці command_line, але варто його робити якнайкоротшим, а то весь не поміститься в смс-ку ....
тепер на ваш мобільний будуть приходит смс-ки ...
Для "Київстару" треба спочатку підключити сервіс, який доволяє відсилання повідомлень email->смс... для цього потрібно відіслати пусте смс на певний номер (7020 чи 7021 точно не памятаю), який варто уточнити в оператора..
Далі преходимо до налашування nagios
До опису вашого контакту (по замовчуванні contacts.cfg)
додаємо
pager         38<ван номер>@sms.kyivstar.net
і описуємо нову команду ( commands.cfg )
command_name notify-service-by-epager
command_line /usr/bin/printf "%b" "$SERVICEDESC$\n $HOSTADDRESS$ $SERVICESTATE$\n $SHORTDATETIME$\n" | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ *" $CONTACTEMAIL$
}
define command{
command_name notify-host-by-epager
command_line /usr/bin/printf "%b" "$HOSTADDRESS$\n $SHORTDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$: $HOSTNAME$ $HOSTSTATE$ **" $CONTACTEMAIL$
}
в contacts.cfg
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
міняємо на
service_notification_commands notify-service-by-email, notify-service-by-epager
host_notification_commands notify-host-by-email, notify-host-by-epager
текст, що приходитиме на смс можна змінити в стрічці command_line, але варто його робити якнайкоротшим, а то весь не поміститься в смс-ку ....
тепер на ваш мобільний будуть приходит смс-ки ...
Subscribe to:
Posts (Atom)