Archive

1

Installing nagios:-

I used this script for installing nagios

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

#!/bin/sh

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

# Treat Unset Variables As Errors
set -u

echo “***** Starting Nagios Quick-Install: ” `date`
echo “***** Installing pre-requisites”
yum -y install httpd
yum -y install gcc
yum -y install glibc glibc-common
yum -y install gd gd-devel

echo “***** Setting up the environment”
useradd -m nagios
echo “bharathi” |passwd –stdin nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

echo “***** Getting the Nagios Source and Plug-Ins”
cd /usr/local/src
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar xzf nagios-3.2.0.tar.gz
tar xzf nagios-plugins-1.4.14.tar.gz

echo “***** Installing Nagios”
cd /usr/local/src/nagios-3.2.0
./configure –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

echo “***** Setting up htpasswd auth”
htpasswd -nb nagiosadmin bharathi > /usr/local/nagios/etc/htpasswd.users
service httpd restart

echo “***** Setting up Nagios Plug-Ins”
cd /usr/local/src/nagios-plugins-1.4.13
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install

echo “***** Fixing SELinux”
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

echo “***** Starting Nagios”
chkconfig –add nagios
chkconfig nagios on
service nagios start

echo “***** Done: ” `date`

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

After executing the above script you can get the nagios installed in /usr/local/nagios/. Check the localhost.cfg file and you can get the remote host configuration. What I did is I created a domain template file having the file

I had a hell out of time for the configuration of nagios and clickatell SMS gateway configuration…Finally I made it…:)

You can get the latest template based configuration from the URL

http://nagios.manubulon.com/traduction/docs14en/xodtemplate.html

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

Advertisements

Symptoms

The following error is shown on Sitebuilder logs file:

/var/log/httpd/sitebuilder_error.log
—>8—
[Tue Oct 27 11:48:00 2009] [warn] [client xxx.xxx.xxx.xxx] Timeout waiting for output from CGI script /opt/php52/cgi-bin/php5, referer: http://sitebuilder.hostname.com/Admin/Site/Form
[Tue Oct 27 11:48:00 2009] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: php5, referer: http://sitebuilder.hostname.com/Admin/Site/Form
—8<—

What can I do to solve the problem?

Cause

The problem is caused by long time of uploading files via FTP. Publishing is stopped due to timeout.

Resolution

To resolve the problem it is recommended that you 1) increase maximum time of script execution, parameter max_execution_time in Sitebuilder PHP configuration and 2) Timeout value in Apache configuration.

1) Login to Parallels Plesk Sitebuilder server as root and find location of CGI PHP configuration file in Parallels Plesk Sitebuilder:

~# sb_config –help | grep phpcgi_path
–phpcgi_path        PHP CGI executable [/opt/php52/cgi-bin/php5]
~# find /opt/php52 -name php.ini
/opt/php52/etc/php.ini
~#

Open file /opt/php52/etc/php.ini and find max_execution_time. Increase the value, it is 30 seconds by default and save the file.

—>8—
max_execution_time = 240     ; Maximum execution time of each script, in seconds
—>8—

2) On Parallels Plesk Sitebuilder server open main configuration file of Apache service (/etc/httpd/conf/httpd.conf).Find option Timeout and increase the value. For example:

—>8—
# Timeout: The number of seconds before receives and sends time out.
Timeout 240
—8<—

Save the file and restart service Apache. For example:

~# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
~#

Download the pacakge, their official site is http://www.pdflib.com

root@server# wget http://www.pdflib.com/binaries/PDFlib/703/PDFlib-Lite-7.0.3.tar.gz
root@server#  tar xvzf PDFlib-Lite-7.0.3.tar.gz
root@server#  cd PDFlib-Lite-7.0.3
root@server#  ./configure --prefix=$HOME/usr --without-java
root@server#  make
root@server#  make install

install php-pear using

yum install php-pear


root@server#  pecl download pdflib
root@server#  tar xvzf pdflib-*.tgz
root@server#  cd pdflib-*
root@server#  phpize
root@server#  ./configure --with-pdflib=$HOME/usr
root@server#  make
root@server#  make test
make install

Add pdf.so in /etc/php.ini and restart httpd. You got it !!!

Source server :

take a back up of sites in /usr/local/sitebuilder/htdocs (in debian /opt/sitebuilder)

and move it to new server

scp -r /usr/local/sitebuilder/htdocs/sites/* root@targetserverip:/usr/local/sitebuilder/htdocs/sites/

correct the permissions as web server

chown apache.apache -R /usr/local/sitebuilder/htdocs/sites/  <new server >

After that we need to take sitebuilder backup

mysqldump -u admin -p`cat /etc/psa/.psa.shadow ` sitebuilder3 > sitebuilderback.sql

move it to new server using scp

After that restore the transferred sitebuilder dump in new server

mysql -u admin -p`cat /etc/psa/.psa.shadow ` sitebuilder3 < sitebuilderback.sql

After that login to the new server MySQL and select database sitebuilder3 and check the users using the command

select user_name from user where user_name not like ‘admin%’;

If you are seeing the users , you are DONE!!!