Nagios için PowerMTA status check plugin
Lazım oldu yazdık. Güle güle kullanın geliştirin. Bize bu kadarı yeterli.
#
#
# PowerMTA status check plugin for nagios
# Kursad DARA [mkursaddara@gmail.com]
# http://www.serbestkose.net
# 20 December 2012, the day before Maya's Armageddon.
#
#
#!/bin/bash
lynx="/usr/bin/lynx"
if [ -z "$1" ]; then
echo "Usage : $0 [powermta_host_name or powermta_host_ip]"
else
response=`$lynx --head http://$1/status --dump |head -n1 | awk {'print $2'}`
if [ "$response" = "200" ]; then
status=`$lynx -dump http://$1/status |grep Status | tail -n1|awk {'print $2'}`
if [ "$status" = "running" ]; then
qcount=`$lynx -dump http://$1/status |grep Spool -A1 |tail -n1 |awk {'print $2'}`
echo "OK - PowerMTA is running [ Queue : $qcount ]"
exit 0;
else
echo "CRITICAL - PowerMTA is not running"
exit 2;
fi
else
echo "CRITICAL - PowerMTA is not running"
exit 2;
fi
fi
Posted in Linux, Mail Servers, Nagios, PowerMTA on December 20th, 2012 by Kürşad DARA | | 0 Comments
Nagios Return code of 127 is out of bounds – plugin may be missing hatası
Nagios’ta aşağıdaki hatayı alıyorsanız eğer;
Return code of 127 is out of bounds - plugin may be missing
Çözüm olarak
resource.cfg dosyasına
$USER2$=/etc/nagios3/libexec
eklemeniz gerekmektedir. Ekledikten sonra nagios u kapatıp açarsanız sorun düzelecektir.
Buradaki /etc/nagios3/plugins benim pluginlerimin bulunduğu dizin. Sizin eklediğiniz script nerde ise orayı yazmanız gerekir.
Posted in Linux, Nagios on December 20th, 2012 by Kürşad DARA | | 0 Comments
Clickatell API’sini kullanarak nagios ile sms uyarısı gönderme
Bunun için öncelikle Clickatel firmasından gerekli üyeliği almalısınız.
Size verilen kullanıcı ve api bilgilerini aşağıdaki gibi /etc/nagios3/commands.cfg dosyasına yazın.
define command{
command_name host-notify-by-sms
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http:/
/api.clickatell.com/http/sendmsg?user=USERNAME&password=PASSWORD&&api_id=API_ID&to=$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ @ $LONGDATETIME$ **'"
}
define command{
command_name service-notify-by-sms
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http:/
/api.clickatell.com/http/sendmsg?user=USERNAME&password=PASSWORD&&api_id=API_ID&to=$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ **'"
}
Daha sonra /etc/nagios3/conf.d/contacts_nagios2.cfg dosyası içine aşağıdaki gibi notification komutlarını girin. ( Kırmızı renkteki satırlar )
# Kursad DARA
####################
define contact{
contact_name swn_kursadd_sms
alias Kursad DARA
service_notification_period nonworkhours
host_notification_period nonworkhours
service_notification_options w,c,r
host_notification_options d,u,r
service_notification_commands service-notify-by-sms
host_notification_commands host-notify-by-sms
pager 532xxxxxxx
}
Sonrasında
/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg
komutu ile nagios konfigürasyonunuzu kontrol edip hata yapmadığınızdan emin olun. Hata varsa düzeltmeniz gerekecek.
Hata yok ise
service nagios3 restart
ile nagios servisini tekrar başlatın.
Artık herhangi bir uyarı durumunda nagios size sms ile bilgi verecektir.
Posted in Linux, Nagios on September 16th, 2011 by Kürşad DARA | | 0 Comments
