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.

Monday, July 27, 2009

SMPlayer - Frontend for MPlayer

URL: SMPlayer
Version: 0.6.8
Price: $0
Platform: Windows (Installer and Portable), Linux

Official Features:

SMPlayer intends to be a complete front-end for MPlayer, from basic features like playing videos, DVDs, and VCDs to more advanced features like support for MPlayer filters and more.

One of the most interesting features of SMPlayer: it remembers the settings of all files you play. So you start to watch a movie but you have to leave... don't worry, when you open that movie again it will resume at the same point you left it, and with the same settings: audio track, subtitles, volume...

Other additional interesting features:

  • Configurable subtitles. You can choose font and size, and even colors for the subtitles.
  • Audio track switching. You can choose the audio track you want to listen. Works with avi and mkv. And of course with DVDs.
  • Seeking by mouse wheel. You can use your mouse wheel to go forward or backward in the video.
  • Video equalizer, allows you to adjust the brightness, contrast, hue, saturation and gamma of the video image.
  • Multiple speed playback. You can play at 2X, 4X... and even in slow motion.
  • Filters. Several filters are available: deinterlace, postprocessing, denoise... and even a karaoke filter (voice removal).
  • Audio and subtitles delay adjustment. Allows you to sync audio and subtitles.
  • Advanced options, such as selecting a demuxer or video & audio codecs.
  • Playlist. Allows you to enqueue several files to be played one after each other. Autorepeat and shuffle supported too.
  • Preferences dialog. You can easily configure every option of SMPlayer by using a nice preferences dialog.
  • Possibility to search automatically for subtitles in opensubtitles.org.
  • Translations: currently SMPlayer is translated into more than 20 languages, including Spanish, German, French, Italian, Russian, Chinese, Japanese....
  • It's multiplatform. Binaries available for Windows and Linux.
  • SMPlayer is under the GPL license.


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)

Monday, July 13, 2009

Essential PIM Free Edition

URL: EssentialPIM
Price: $0
Version: 2.0
Platform: Windows

EssentialPIM Free is the award-winning, absolutely free personal information manager. Supported by a large community of users, EPIM has been widely acknowledged as the best personal information management system on any desktop or USB flash. It is not bloatware and has no spyware or adware.

EssentialPIM Free 3.03

Sunday, July 12, 2009