Archive for Linux

Howto setup Instant messenger (IM) notifications in nagios

Recently i undertook a project to setup Instant Messenger alerts from nagios .

Nagios is highly configurable.Once we understand the elegant nature in which nagios works and get configured ,extending nagios to send IM alerts is quite childs play .Thanks to many user contributed scripts that allow you to connectto many Instant Messaging Gateways. I used a modified version of

http://nagios.sourceforge.net/download/contrib/notifications/notify_via_jabber

contributed by David Cox to the Nagios Community . For the need of a XMPP server , i installed my own private OpenFire ( http://www.igniterealtime.org/projects/openfire/index.jsp ) server . You may also try to setup accounts in public XMPP servers like http://jabber.org for this purpose. Basically the perl script connects to the jabber server you specified in the script and sends out the notification to you

Here is the configuration :

1. You have to define a command that can be used to acomplish something when there is a host/service related event. For the first timers if you are recieving email notifications from nagios;you can check your commands.cfg file to see something like notify-host-by-email command defenition!

similarly for IM alerts we define a command

==========
# This command is used to notify recipients of service problems:
# 'notify-by-jabber' command definition
define command{
command_name notify-by-jabber
command_line /usr/local/nagios/libexec/notify_via_jabber.pl $CONTACTADDRESS1$ "$HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$\r\nAdditional Info: $SERVICEOUTPUT$"
}
# This command is used to notify recipients of host problems:
# 'host-notify-by-jabber' command definition
define command{
command_name host-notify-by-jabber
command_line /usr/local/nagios/libexec/notify_via_jabber.pl $CONTACTADDRESS1$ "$NOTIFICATIONTYPE$: $HOSTNAME$ is $HOSTSTATE$\n$HOSTOUTPUT$"
}

=====================

As you can see we have called a command_line program => /usr/local/nagios/libexec/notify_via_jabber.pl

which is our perl script

Please download the following perl script from http://gnusys.net instead of the sourceforge one ;as i got it working only after having a small change in the perl script

==========

wget http://gnusys.net/downloads/notify_via_jabber.pl

==========

Find the following lines in the script and change it accordingly

==============


use constant SERVER => 'gnusys.net';
use constant PORT => 5222;
use constant USER => 'notify@gnusys.net';
use constant PASSWORD => 'd3fault';

===============

What more……….?

You need to use the notification commands somewhere.

==========================


define contact{
contact_name anoop
use generic-contact
alias Anoop
email no-email@gnusys.net
address1 no-im@gnusys.net
host_notification_commands notify-host-by-email,host-notify-by-jabber
service_notification_commands notify-by-jabber
host_notification_period 24x7
service_notification_period 24x7
service_notification_options c,r
}

===============================

Now if you are logged into no-im@gnusys.net ; you should start receiving alerts from notify@gnusys.net

If you need help setting this up contact anoop[at]gnusys.net

Source : http://gnusys.net/kb/index.php/2008/09/howto-setup-instant-messenger-im-notifications-in-nagios/

Instant-on Linux vendors respond to Chrome OS

BIOS manufacturer Phoenix Technologies announced plans on Monday to launch a new version of its Linux-based HyperSpace environment that will use some components of Intel’s Moblin platform. The move reflects Moblin’s growing traction among vendors, but it is also Phoenix’s response to the recent revelation that Google is building its own Linux operating system.

HyperSpace, which was first introduced by Phoenix in 2007, is an “instant-on” Linux environment designed to run in a slim hypervisor that is part of the BIOS. It uses its own power management framework that boosts battery life.

HyperSpace can be used by itself on a netbook or shipped alongside a conventional Windows installation. It provides a simple user interface and an assortment of applications for common tasks, including a Web browser and ThinkFree’s Java-based office suite.

To read more check : http://arstechnica.com/open-source/news/2009/07/instant-on-linux-vendors-respond-to-chrome-os.ars

The Tale of Tail (Unix Command)

The most interesting and useful command i ever used is tail in unix. As the name indicate its duty is to show the last lines of a particular file. When take the case of log files such as error logs, always we have to know the last lines or last updations instead of reading from top to bottom or search a full text file.

for its option try this tail –help

tail -n 10 error.log

shows last 10 lines of error.log

The very interesting option is -f , means open the file and follow the last lines.

This is very useful for debugging purpose. For example if you want to check error.log lively, use this option

tail -f error.log

it displays last lines and also automatically updates when any changes happens in error.log file. So you can check other operation by tailing and following a particular file .

Try today itself. You will be very much interested, thats my guarantee :)

(There is also a similar function ‘head’, you can guess what its use, google it for more)

Reference : http://www.sajithmr.com/tail/