Friday, February 24, 2012

Core Nagios Installation


How to install Nagios Monitoring Tool


Step:- 1
Install Http, Gcc, Glibd-common, Gd, Gd-devel's 
# http, php, gcc, glibc-common gd gd-devel's all packeges will
yum -y install httpd php gcc glibc-common gd gd-devel

Step:- 2
# New user and group created then and set it the secondory
 

# Group of new useruseradd -m nagios
passwd -d nagios

# New group is created
groupadd nagcmd
 

# Apache and new user are added in that group
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
 
Step:- 3
# Extract nagios tar
 
tar xvzf nagios-3.2.0.tar.gz
cd nagios-3.2.0
 
Step:- 4
# Run the exicutable file with adding new group./configure --with-command-group=nagcmd
 
Step:- 5
# Bind configuration with system
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
 
Step:- 6
# Set password for accessing nagios by user
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
 
Step:- 7 
# Service of http is started
service httpd restart
 
Step:- 8
# Extract plugin of nagios
tar xvzf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
 
Step:- 9
# Run the exicutable file with adding new group and user./configure --with-nagios-user=nagios --with-nagios-group=nagios
 
Step:- 10
# Bind plugin with system configurationmake
make install

Step :- 11
Start nagios Service service nagios start
chkconfig nagios on

Step:- 12
# Varified that nagios i sworking or any error /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Step:- 13
# Verver address adding in configuration file of http
vi /etc/httpd/conf/httpd.conf
 
Step:- 14
Restart Nagios and Httpd Services
service httpd restart
service nagios restart
 
Step:- 15
# Nagios is going to be started..........firefox http://localhost/nagios

Monday, February 20, 2012

Hard Disk Clone with "dd"


Hard Disk Clone

Suppose you have a 40GB hard disk and a removable hard disk whose capacity is 60GB, and you want to backup all the files from the hard disk to the removable disk. With "dd", it is a very easy task. Again, suppose your hard disk's Unix device name is /dev/sda and the removable disk is /dev/sdb. The following command can copy all the content from /dev/sda to /dev/sdb:
dd if=/dev/sda of=/dev/sdb
Here, if=... sets the source and of=... sets the destination. "dd" doesn't care of the contents of the hard disk. It just reads bytes from /dev/sda and writes them into /dev/sdb. It doesn't know what are files. So, the hard disk file system and how many Partitions it has are not important. For example, if /dev/sda is splitted into three partitions, the /dev/sdb will have the samepartitions. i.e. "destination" is completely same with "source".
Notice: to execute "dd" you should login as "root" or switch to "root" using "su" command. And you must be careful, a small mistake may cause a serious problem!

Making a Hard Disk Image File

Most of time you don't want to make a complete duplication of your hard disk. You may prefer to creating an image file of the hard disk and save it in other storage devices . The following command will create an image file "disk1.img" in your user's directory from /dev/sda:
dd if=/dev/sda of=~/disk1.img
Since you have created an image file, you can compress it with "gzip" or "bzip2":
dd if=/dev/sda | gzip > disk.img.gz
dd if=/dev/sda | bzip2 > disk.img.bz2
You can save much storage space with compression. But it will take very long time.

Partition Clone

Backing up a hard disk partition is much similar to backing up a whole hard disk. The reason is that Unix/Linux uses device name, such as /dev/sda1, /dev/sda5... to indicate the partitions. For example, if you want to create an image file from the first partition of /dev/sda, use "dd" like this:
dd if=/dev/sda1 of=~/disk2.img
Also, you can compress the image file:
gzip disk2.img
By the way, you can copy a partition to another partition completely, just set "of" to thepartition's device name. For example:
dd if=/dev/sda1 of=/dev/sdb5
This command will copy all the contents from /dev/sda1 to /dev/sdb5. You must be sure that the capacity of /dev/sdb5 is larger than /dev/sda1.

Restoring from an Image File

To restore a partition or a hard disk from an image file, just exchange the arguments "if" and "of". For example, restore the whole hard disk from the image file "disk1.img":
dd if=disk1.img of=/dev/sda
Restore the first partition of /dev/sda from the image file "disk2.img":
dd if=disk2.img of=/dev/sda1