Showing posts with label Nagios. Show all posts
Showing posts with label Nagios. Show all posts

Sunday, August 16, 2009

Nagstamon - Nagios Status Monitor

Nagstamon is a Nagios status monitor which takes place in systray or on desktop (GNOME, KDE, Windows) as floating statusbar to inform you in realtime about the status of your Nagios monitored network. It allows to connect to multiple Nagios servers.

URL: Nagstamon
Price: $0
Version: 0.8.2
Platform: Windows, Linux

http://sourceforge.net/dbimage.php?id=196476

http://sourceforge.net/dbimage.php?id=183402

Friday, July 31, 2009

Nagios - Alerting by SMS using ClickATell

ClickATell is a SMS gateway supporting email to SMS, direct HTTP and other methods.

  • create libexec/send_sms


#!/bin/sh

# This function call the clickatell through HTTP instead of Email to SMS

# Print the help and exit.
dumphelp(){
echo "send_sms "
exit
}

# Check if number of parameter is 1. If not, print the help and exit.
if [ $# -ne 2 ]; then
dumphelp
fi

NAGIOSHOME=/usr/local/nagios
NAGIOSLOG=$NAGIOSHOME/var
SMSLOG=$NAGIOSLOG/sms.log

USER="XXXXXXX"
PASSWORD="XXXXXXX"
API_ID="XXXXXXXX"

PHONE=$1
MSG=$2

# As calling through HTTP instead of email to SMS, need to replace all space with +
MSG1=`echo $2 | sed "s/ /+/g"`

# Get the current log time
LOGTIME=`date "+%Y%m%d %H:%M:%S.%N"`

echo "$LOGTIME [To: $PHONE] [Msg: $MSG1]" >> $SMSLOG

wget -q -O /tmp/sms.html "http://api.clickatell.com/http/sendmsg?user=$USER&password=$PASSWORD&api_id=$API_ID&to=$PHONE&text=$MSG1"

  • Add the following to command.cfg



# 'notify-host-by-sms' command definition
define command{
command_name notify-host-by-sms
command_line $USER1$/send_sms $CONTACTPAGER$ "$NOTIFICATIONTYPE$ $HOSTALIAS$ $HOSTSTATE$ [$HOSTOUTPUT$]"
}

# 'notify-service-by-sms' command definition
define command{
command_name notify-service-by-sms
command_line $USER1$/send_sms $CONTACTPAGER$ "$NOTIFICATIONTYPE$ $SERVICEDESC$ $HOSTALIAS$ $SERVICESTATE$ [$SERVICEOUTPUT$]"
}


  • Add the generic-sms-contact to templates.cfg


define contact{
name generic-sms-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-sms ; send service notifications via sms
host_notification_commands notify-host-by-sms ; send host notifications via sms
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}


  • Add the following to contacts.cfg


# Define the person to receive the SMS
define contact{
contact_name SMS.XXX
use generic-sms-contact
alias System Admin
email AAA@bbb.ccc.com
pager 1234567890
}

# Define the SMS contact group
define contactgroup{
contactgroup_name SMS_ABCDE
alias Server Application Admin
members SMS.XXX
}


  • Use the SMS_ABCDE in the contact_groups when you define the service/host.
  • That's all.

Wednesday, July 22, 2009

Nagios Plugin - NConf

URL: NConf

Prerequisite
  • PHP
  • MySQL - Create a catalog for nconf. (e.g. catalog=nconf, username=nconf, password=nconf)
Installation Steps
  • Get the file from NConf
  • Assume your document root is /var/www


> tar xvfz nconf-1.2.5-0.tgz
> cp nconf /var/www
> Go to http://localhost/nconf and follow the steps


Should have folder authentication problem when generate the config. Following steps solve the problem:
> sudo vigr
# Add the user www-data to group nagios
nagios:x:1002:nagios,www-data

> sudo chmod g+w -R nagios
> sudo chown www-data:nagios /var/www/nconf

> restart apache

  • Done

Sunday, July 19, 2009

Nagios Installation in Ubuntu

Download the latest version 3.1.2.

Add new users nagios and nagiosadmin
> sudo adduser nagios
> sudo adduser nagiosadmin


Configure and install Nagios
> tar xvfz nagios-3.1.2.tar.gz
> cd nagios-3.1.2
> ./configure --with-nagios-user=nagios --with-nagios-group=nagios
> make all
> make fullinstall
> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
> /etc/init.d/apache2 reload


Get the server to start the nagios when reboot
> sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios


Install the plugin.
Download the Plugin 1.4.13
> ./configure
> make
> sudo make install
> sudo chown nagios:nagios /usr/local/nagios -R


  • Start FireFox
  • http://localhost/nagios
  • Enter nagiosadmin and the password

Thursday, July 16, 2009

Introduction to Nagios

Nagios is a free, open source, enterprise grade monitoring system released under GPL. Nagios run under Linux (or Unices) and major features like:
  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk usage, etc.)
  • Simple plugin design that allows users to easily develop their own service checks
  • Parallelized service checks
  • Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
  • Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
  • Ability to define event handlers to be run during service or host events for proactive problem resolution
  • Automatic log file rotation
  • Support for implementing redundant monitoring hosts
  • Optional web interface for viewing current network status, notification and problem history, log file, etc.

Nagios can alert when things go bad and when they get better. Nagios can notify the corresponding parties through email, pager or cellphones. SMS is possible through email to SMS service provider like clickatell. Multiple users alert is possible and even escalation alert is possible if the problem is not handled by long. Nagios has a web interface to see detailed status information. Users can stop the alert by acknowledging the problem in the web interface.

There are huge amount of community-developed addons. Popular plugins like:
  • NSClient++: Monitoring Deamon for Windows
  • Nagios Business Process: Aggregate status for a defined list of components which defines an application.
  • PNP: Analyze performance data and store in RRD database.
  • Nagios NT Event Log Alert: A Windows service that forwards filtered EventLog messages into Nagios, via the NSCA daemon.
  • NConf: NConf is a PHP based web-tool for configuring the Nagios monitoring software. It differs from similar tools by offering enterprise-class features like host templates, dependencies and to configure a large-scale, distributed Nagios server topology.
  • NagVis: NagVis can be used to visualize Nagios Data.
(To be continue)