Monday, May 24, 2010

How to configure LVM (Logical Volume Management)

A 5 Step guide to LVM (logical volume management)

1. Prepare partitions for lvm

pvcreate /dev/hardisk /dev/hardisk

example : pvcreate /dev/sda1 /dev/sdb1

pvdisplay - to display physical volumes

2. next create volume group with each physical volume

vgcreate
/dev/hardisk /dev/hardisk
example : vgcreate fileserver /dev/sda1 /dev/sdb1

vgdisplay - to display volume group

3. next create logical volumes

lvcreate --name --size xxG

example : lvcreate --name share --size 25G fileserver

4. create filesystem

mkfs.ext3 /dev//

example : mkfs.ext3 /dev/fileserver/share

5. mount the logical volume

mount /dev/fileserver/share /var/share
Read More !

Nagios client installation guide

if xinetd is not installed, install it.

1. add nagios user and set a password.

2. create nagcmd group and add nagios and apache to it.
(used to issue commands directly from web interface)

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache


3. download and install nagios plugin

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar xfv nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.11

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install


4. change the permissions

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec


5. download and install nrpe plugin (nrpe uses 5666)

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
tar xfv nrpe-2.12.tar.gz
cd nrpe-2.12

./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd


6. nrpe configuration

vim /etc/xinetd.d/nrpe

only_from = 127.0.0.1 (change to nagios server ip address)

7. add nrpe port to services file

vim /etc/services

nrpe 5666/tcp # NRPE


8. service xinetd restart

9. testing nrpe

netstat -at |grep nrpe

output : tcp 0 0 *:nrpe *.* LISTEN

Read More !

Nagios server installation guide

Nagios is network monitoring tool used to monitor servers ,routers , switches and other devices.

Server Installation

Prerequisites : Apache, PHP, GCC compiler, GD development libraries

yum install httpd php gcc glibc glibc-common gd gd-devel

1. add nagios user and set a password.

2. create nagcmd group and add nagios and apache to it.
(used to issue commands directly from web interface)

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache


3. download nagios core and nagios plugin from nagios website.

4. extract the nagios core into a directory and configure with the group option.

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
tar xfv
nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

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

5. start apache

6. Next install nagios plugin with nagios user and nagios group

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar xfv
nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install


7. service nagios start

8. to view the webinterface

http://ipaddress/nagios/

To monitor remote server, you need to install nrpe plugin

1. download and install nrpe plugin (nrpe uses 5666)

./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd

2. nrpe configuration

vim /etc/xinetd.d/nrpe

only_from = 127.0.0.1
(change to nagios server ip address)

3. add nrpe port to services file

vim /etc/services

nrpe 5666/tcp # NRPE

4. service xinetd restart

5. testing nrpe

netstat -at | grep nrpe

output : tcp 0 0 *:nrpe *.* LISTEN


Read More !

Tuesday, May 18, 2010

Boot Linux Grub Boot Loader into single user mode

1. At grub boot screen, select the kernel
2. Press the e key to edit the entry
3. Select the option that starts with kernel
4. Press the e key to edit kernel entry and add the letter S or word Single at the end of the line
5. Press enter key
6. Press the b key to boot the Linux kernel into single user mode
Read More !

Thursday, May 6, 2010

Retreive email passwords from plesk

login to mysql as root;

mysql> use psa;

mysql> select CONCAT(mail_name,"@",name) as email_address, substring(accounts.password, '1') from mail left join domains on domains.id=mail.dom_id left join accounts on accounts.id=mail.account_id;

This displays all the email address with their passwords.
Read More !