Monday, April 25, 2011

How_to_customize_centos_using_kickstart

How to Customize Centos DVD using Kickstart file
================================================

Here i am using CentOS 64 Bit OS to customize that.

1. Create a kickstart file with postscript and packages list
# yum install system-config-kickstart
# system-config-kickstart
# save as ks.cfg

2. Mount that DVD into /mnt
# mount -o loop /dev/cdrom /mnt ( If it is in DVD )
# mount -o loop /opt/ISO/centos_5.5_64bit_final.iso /mnt ( It is an ISO File )

3. Create a Dir for ISO Editing
# mkdir /opt/newbuild

4. Copy all the contents from /mnt to /opt/newbuild
# cp -R /mnt/* /opt/newbuild

5. Edit the isolinux.cfg in newbuild Dir
# vim /opt/newbuild/isolinux/isolinux.cfg

default linux
prompt 0
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ks.cfg ( Add this entry in this line )
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -

6. Modify the permission of ks.cfg file
# chmod 755 ks.cfg

7. Copy the ks.cfg file to newbuild Dir
# cp ks.cfg /opt/newbuild

8. Install mkisofs to make ISO
# yum install mkisofs

9. Make Customized ISO
# mkisofs -o CentOS-5.5_64_Kickstart.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T .

10. Now ISO is ready
Write the CentOS-5.5_64_Kickstart.iso file in DVD

Friday, April 15, 2011

How to Install nagios grapher on nagios

#!/bin/bash
#Author Karthikeyan.S

#Any Failing Command Will Cause The Script To Stop
set -e

#Treat Unset Variables As Errors
set -u

test $(id -u) -eq 0 || { echo "You are not a root user to run this script " ; exit 1; }

rpm -qa | grep rpmforge
status=$?

if [ $status = 0 ]
then
echo "rpmforge repo is already installed"
else
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
fi

yum update

yum -y install autoconf rrdtool perl-GD* ImageMagick-perl perl-URI.noarch perl-Calendar*

if [ -d /opt/downloads ]
then
echo "/opt/downloads folder already exists"
else
mkdir /opt/downloads
fi

cd /opt/downloads
wget http://sourceforge.net/projects/nagiosgrapher/files/nagiosgrapher/NagiosGrapher-1.7.1/NagiosGrapher-1.7.1.tar.gz/download

tar -xvf NagiosGrapher-1.7.1.tar.gz
cd NagiosGrapher-1.7.1

autoconf
./configure --with-layout=default
make install

cat >> /usr/local/nagios/etc/nagios.cfg << EOF cfg_dir=/usr/local/nagios/etc/serviceext process_performance_data=1 service_perfdata_file=/usr/local/nagios/var/service-perfdata service_perfdata_file_template=$HOSTNAME$\t$SERVICEDESC$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\t$TIMET$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=30 service_perfdata_file_processing_command=process-service-perfdata-file EOF cat >> /usr/local/nagios/etc/objects.commands.cfg << EOF
#NagiosGrapher commands
define command{
command_name process-service-perfdata-file
command_line mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/service-perfdata.$TIMET$
}
EOF

/etc/init.d/nagios restart
/usr/local/nagios/contrib/collect2.pl restart

echo "Nagios Grapher installation finished successfully..."