Archive for August, 2008

Interface conf file for debian and redhat

August 28, 2008


auto eth0
iface eth0 inet static
address x.x.x.x
netmask x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x


# Intel Corporation PRO/100 VE Network Connection



August 27, 2008

1) Create Account Information

Become the root user. Create a new nagios user account and give it a password.

 /usr/sbin/useradd -m nagios
 passwd nagios

you will need to also add a nagios group (it’s not created by default). You should be able to skip this step on desktop editions of Ubuntu.

 /usr/sbin/groupadd nagios
 /usr/sbin/usermod -G nagios nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

 /usr/sbin/groupadd nagcmd
 /usr/sbin/usermod -G nagcmd nagios
 /usr/sbin/usermod -G nagcmd www-data

2) Download Nagios and the Plugins

Download the source code tarballs of both Nagios and the Nagios plugins (visit for links to the latest versions). At the time of writing, the latest versions of Nagios and the Nagios plugins were 3.0.3 and 1.4.11, respectively.


3) Compile and Install Nagios

Extract the Nagios source code tarball.

 cd ~/downloads
 tar xzf nagios-3.0.2.tar.gz
 cd nagios-3.0.2

Run the Nagios configure script, passing the name of the group you created earlier like so:

 ./configure --with-command-group=nagcmd or 

 ./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl
 --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup

Compile the Nagios source code.

 make all

Install binaries, init script, sample config files and set permissions on the external command directory.

 make install
 make install-init
 make install-config
 make install-commandmode

Don’t start Nagios yet – there’s still more that needs to be done…

4) Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You’ll need to make just one change before you proceed…

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

 vi /usr/local/nagios/etc/objects/contacts.cfg

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.

 make install-webconf

Configure Aliases and Directory Options For The Web Interface

First you’ll need to create appropriate entries for the Nagios web interface (HTML and CGIs) in your web server config file. Add the following snippet to your web server configuration file (i.e. httpd.conf), changing it to match any directory differences on your system.

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

 <Directory "/usr/local/nagios/sbin">
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user

 Alias /nagios /usr/local/nagios/share

 <Directory "/usr/local/nagios/share">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user

Note: The default Nagios installation expects to find the HTML files and CGIs at http://yourmachine/nagios/ and http://yourmachine/nagios/cgi-bin/, respectively. These locations can be changed using the –with-htmurl and –with-cgiurl options in the configure script.

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

 htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

 /etc/init.d/apache2 reload

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

 cd ~/downloads
 tar xzf nagios-plugins-1.4.11.tar.gz
 cd nagios-plugins-1.4.11

Compile and install the plugins.

 ./configure --with-nagios-user=nagios --with-nagios-group=nagios
 make install(as root)

7) Start Nagios

Configure Nagios to automatically start when the system boots.

 ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios configuration files.

 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

 /etc/init.d/nagios start

8) Login to the Web Interface

You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.


Click on the “Service Detail” navbar link to see details of what’s being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.

9) Other Modifications

If you want to receive email notifications for Nagios alerts, you need to install the mailx or mail relayer program.

Here is a mail relayer.

Synchronizing clock with ntp server in solaris

August 27, 2008

First check

whether any ntp service is running or not.

ps -ef|grep ntp/xntp or pgrep xntp

if so then kill that service-

pkill xntp or pkill -9 <pid>

Then completely disable that service-

svcadm disable xntp

Now just copy /etc/inet/ntp.client as /etc/inet/ntp.conf

And only put the following three line on ntp.conf

server 192.168.x.x

logfile /var/log/ntp.log

logconfig =all

Now enable the ntp service

svcadm enable ntp

svcadm start ntp

Cacti Installation

August 27, 2008

Cacti Installation

Extract Cacti

  1. Get Cacti ( and place in /var/tmp/
  2. gtar xvfz /var/tmp/cacti-0.8.7.tar.gz
  3. mv /var/tmp/cacti-0.8.7 /usr/local/apache/htdocs/cacti

Create Cacti DB in MySQL

Note: have your mysql root password ready

  1. mysqladmin --user=root -p create cacti
  2. mysql --user=root -p cacti < /usr/local/share/cacti/cacti.sql
  3. mysql --user=root -p mysql
     GRANT ALL ON cacti.* TO cactiuser@localhost;
     GRANT USAGE ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
     GRANT ALL ON cacti.* TO cactiuser@"%";
     GRANT USAGE ON cacti.* TO cactiuser@"%" IDENTIFIED BY 'cactipassword';
     flush privileges;

Update Cacti with DB username/password

  1. vi /usr/local/apache/htdocs/cacti/include/config.php
      $database_default = "cacti";
      $database_hostname = "localhost";
      $database_username = "cactiuser";
      $database_password = "cactipassword";

Add Cacti Poller to Crontab

  1. vi /etc/crontab
      */5 * * * * /usr/local/php/bin/php /opt/apache/htdocs/cacti/poller.php >/dev/null 2>&1(Linux)
      0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /usr/local/php/bin/php /opt/apache/htdocs/cacti/poller.php >/dev/null 2>&1(Solaris)

Configure Apache for Cacti

  1. vi /usr/local/etc/apache22/httpd.conf
      <Directory /usr/local/apache/htdocs/cacti/>
             AllowOverride None
             Order allow,deny
             Allow from all
      Alias /cacti/ /usr/local/apache/htdocs/cacti/

Log in for the 1st time!

  1. http://x.x.x.x/cacti/
        1. Accept the defaults
        2. Login as admin/admin
        3. Change admin password

Installing rrdtool

August 27, 2008

$ ./configure –prefix=/usr/local/rrdtool –disable-python –disable-tcl

before you run make command please ensure the following change in rrdtool-1.2.28/bindings/perl-shared/Makefile

  change CC=cc to CC=gcc
  change LD = cc to LD = gcc
  change OPTIMIZE = xo3 -xspace -xildoff to OPTIMIZE =

$ make

And finally as root

make install