Archive

Author Archive

Nasscom IMS 2010: We are Attending

September 9th, 2010


Nasscom Infrastructure Management Summit 2010, will be held in Bangalore on September 15 and 16 and we will be attending.
With the Indian market shifting its focus to cloud computing and RIM services, NASSCOM IMS 2010 will be a platform for discussion about the emerging technologies and where the industry is heading.

Event details on the NASSCOM IMS 2010

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin Events, general , ,

new infrastructure getting ready

April 29th, 2010

Well, our new office is getting ready in 2 weeks which will enable us to double our capacity and provide innovative technical solutions to a wider audience.

Here is work in progress:

view from a conference room.

sparksupport - managed service provider

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: +3 (from 3 votes)

admin Uncategorized

How to install nagios

December 7th, 2009

Below we give a brief description of how to install and configure Nagios.

To install Nagios make sure the following are installed and working properly in your machine


* httpd
* php
* gcc
* glibc
* glibc-common
* gd
* gd-devel
* png
* png-devel
* jpeg
* jpeg-devel
* zlib
* zlib-devel

Install Steps

1) Create a new user and group as root

Create a new user nagios.

useradd -m nagios

passwd 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 -a -G nagcmd nagios

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

2) Download Nagios and the Nagios Plugins

Download the source code tarballs of both Nagios and the Nagios plugins.


wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.2.0/nagios-3.2.0.tar.gz/download
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.14/nagios-plugins-1.4.14.tar.gz/download

3) Compile and Install Nagios

Extract the Nagios source code.


tar xzf nagios-3.2.0.tar.gz
cd nagios-3.2.0

make sure that these libraries are already installed in the system .Otherwise install them using YUM


   * gd
    * gd-devel
    * png
    * png-devel
    * jpeg
    * jpeg-devel
    * zlib
    * zlib-devel 

Run the Nagios configure script, passing the name of the group:

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

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 

4) Customize Configuration

After installation the default configuration file can be found in the directory /usr/local/nagios/etc/. Also edit your contact information

 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 

Create a nagiosadmin account for logging into the Nagios web interface.

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

Restart Apache to make the new settings take effect.

 /etc/init.d/httpd restart 

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code.

 tar xzf nagios-plugins-1.4.14.tar.gz

cd nagios-plugins-1.4.14 

Compile and install the plugins.

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

make install

7) Start Nagios

Add Nagios to the list of system services and have it automatically start when the system boots.

 chkconfig --add nagios

chkconfig nagios on 

Verify the default Nagios configuration files.

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

If there are no errors, start Nagios.

 service nagios start

8) Modify SELinux Settings

This step is important if the Selinux is not in the Permissive mode it shows error like this

See if SELinux is in Enforcing mode.

getenforce

Put SELinux into Permissive mode.

setenforce 0

To make this change permanent, you’ll have to modify the settings in /etc/selinux/config and reboot.

9) 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(nagios) you specified earlier.

http://localhost/nagios/ 

10) Add hosts to be monitored

There are object configuration files in which you can define hosts, host groups, contacts, contact groups, services, etc. You can split your object definitions across several config files if you wish, or keep them all in a single config file.

For convinience we created two files hosts.cfg and services.cfg under the directory /usr/local/nagios/etc/objects/ and add the file path to /usr/local/nagios/etc/nagios.cfg as

cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg 

Then create a simple script to add hosts, named add_host_service.sh by adding the following lines.

## script begins here
#!/bin/bash
echo "Enter Host Name"
read name
echo "Enter IP Address of $name"
read ip_add

echo "
define host{
        use                     linux-server
        host_name               $name
        alias                   $name
        address                 $ip_add
        }
" >> /usr/local/nagios/etc/objects/hosts.cfg

echo "
define service {
host_name                       $name
service_description             HTTP
check_command                   check_http
use                             generic-service
notification_interval           1
}
define service {
host_name                       $name
service_description             POP
check_command                   check_pop
use                             generic-service
notification_interval           1
}
define service {
host_name                       $name
service_description             SMTP
check_command                   check_smtp!-t 20
use                             generic-service
notification_interval           1
}
" >> /usr/local/nagios/etc/objects/services.cfg 

##script ends here

The above script will monitor three services HTTP, SMTP and POP. To monitor a new service add a new define service entry as shown above.

execute the above script by the command

sh add_host_service.sh

While the execution it will ask for the host name and the IP Address of the host to be added. After execution it will add a new host to nagios. To verify the nagios configuration for errors use the command

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

For the changes to take effect we must restart the nagios as follows.

killall nagios
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Now you can find the newly added hosts under the link Hosts in Nagios interface.

Happy Monitoring

Posted by
mmm1
Mobin
Jr Software Engineer
SparkSupport

&

paesPaes
Jr Software Engineer
SparkSupport
VN:F [1.9.6_1107]
Rating: 10.0/10 (4 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

Qmailrocks qmail install

July 31st, 2009

Qmail is one of the favorite MTA’s of server admins and needless to mention most of us use qmailrocks documentation qmailrocks.org for installing it.

Even after following the complete steps you still will have problem with the mail service, like when you try to test the connectivity to mailserver using telnet you will get the error like

 Connection closed by foreign host

immediately.

Next thing you need to do is to tail the log file of smtpd

 tail /var/log/qmail/qmail-smtpd/current 

You will see the output something like

 /var/qmail/bin/qmail-smtpd: error while loading shared libraries: libselinux.so.1: failed to map segment from shared object: Cannot allocate memory 

The problem is with the softlimit set in

 /var/qmail/supervise/qmail-smtpd/run  

go the the line

 exec /usr/local/bin/softlimit -m 30000000   

and change it to

 exec /usr/local/bin/softlimit -m 50000000  

restart qmail


qmailctl stop
qmailctl start 

Your mailserver still have problems in sending mails, you should also check whether the RDNS set for the main ip of the server

Good to go :)

VN:F [1.9.6_1107]
Rating: 7.3/10 (4 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin linux, Mailservice

phpmotion install script

April 29th, 2009

Sparksupport offers you the script to install phpmotion in your root folder or subfolder. Copy paste this script to a file name of your like and execute with the command sh filename. You should answer the questions asked during the execution of the script.

Requirements:

Cpanel Server
Root access


#!/bin/bash
#Copyright @2009 SparkSupport
################
home="/home"
phpconf="/usr/local/apache/conf/php.conf"
#################

scriptfile=`basename $0`
dbsuffix=`mkpasswd -l 3 -s 0 -d 0 -c 0 -C 0`
randompass=`mkpasswd -l 6 -s 0 -d 2`
if ! [ $? ]
then
        echo "Newer version required: mkpasswd"
        rm -f $scriptfile
        exit 1
fi

echo -n "Enter domain name :"
read domain
echo -n "Enter username :"
read user
#echo -n "Enter email address: "
#read email

echo -n "If installation is in default document root press "Enter" or else specify
sub folder :"
read subfolder

if [ -n $subfolder ]
then
        BDIR="$home/$user/public_html/$subfolder"
        [ -d $home/$user/public_html ] && mkdir $BDIR
else
        BDIR="$home/$user/public_html"
fi

if [ -d $BDIR ]
then
        cd $BDIR
        wget http://downloads.phpmotion.com/V2.1/PHP5.zip
        if [ -e PHP5.zip ]
        then
                unzip PHP5.zip
                cp -ar PHP5/PHPmotion/* .
                chown -R $user.$user $BDIR
                chown $user.nobody "$home/$user/public_html"
                rm -f PHP5.zip
                if [ -n $subfolder ]
                then
                        sed -i '/temp_dir/ s#/temp/#/'$subfolder'/temp/#' cgi-bin/{audio,}/uu_default_config.pm
                        sed -i '/upload_dir/ s#/uploads/avi/#/'$subfolder'/uploads/avi/#' cgi-bin/{audio,}/uu_default_config.pm
                        sed -i '/redirect_url/ s#/uploader_finished.php#/'$subfolder'/uploader_finished.php#' cgi-bin/{audio,}/uu_default_config.pm
                        sed -i '/path_to_upload/ s#/uploads/avi/#/'$subfolder'/uploads/avi/#' cgi-bin/{audio,}/uu_default_config.pm
                        sed -i '/path_to_upload_script/ s#/cgi-bin/#/'$subfolder'/cgi-bin/#' uploader_conlib.php audio_uploader_conlib.php
                        sed -i '/path_to_ini_status_script/ s#/cgi-bin/#/'$subfolder'/cgi-bin/#' uploader_conlib.php audio_uploader_conlib.php
                fi
                if ! grep -q suphp_module $phpconf
                then
                        echo -n "Fixing permissions .. "
                        chmod 777 setup pictures classes temp logs addons uploads uploads/{avi,thumbs,audio,audio/temp,pictures}
                        chmod 755 cgi-bin/* cgi-bin/audio/*
                        echo ".. done"
                fi
                echo -n "Adding mysql db and user .. "
                /scripts/mysqladduserdb ${user}_pm${dbsuffix} $randompass
                echo ".. done"
        else
                echo "Could not fetch PHP5.zip .. try later"
                rm -f $scriptfile
                exit 1
        fi
else
        echo "Folder does not exist : $BDIR"
        rm -f $scriptfile
        exit 1
fi

echo  "Go to http://$domain/setup or  http://$domain/$subfolder/setup"
echo "################### USE THE FOLLOWING DETAILS ################"
echo  "UserName : ${user}_pm${dbsuffix}"
echo  "DbName   : ${user}_pm${dbsuffix}"
echo  "Password : $randompass"
echo "##############################################################"
rm -f $scriptfile

VN:F [1.9.6_1107]
Rating: 5.0/10 (6 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

named capset failed

April 27th, 2009

Today I have come across an error when starting named service in cpanel. I could fix it by inserting the modules to the kernel using modprobe command.

 modprobe capability
modprobe commoncap
VN:F [1.9.6_1107]
Rating: 7.2/10 (6 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

random password generator

April 23rd, 2009

I was searching in google how to generate random password and got two good easy to use methods.

First one is the most simplest one

 uuidgen -r | cut -c-8 or uuidgen -t | cut -c-8  

The -r option is for random based uuid generation with help of /dev/random and -t uses system clock plus ethernet address.

Second method is to call a function

function randompass {
        pass= /dev/null 2>&1 || head -c 7)
        echo $pass
} 

now you can call this function in the shell script by just typing the name of the function “randompass”

VN:F [1.9.6_1107]
Rating: 6.2/10 (5 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux ,

zlibVersion, version libmysqlclient_15 not defined in file libmysqlclient.so.15

April 16th, 2009

Hi,

I have come across this strange error after installing php-fpm for nginx.

 zlibVersion, version libmysqlclient_15 not defined in file libmysqlclient.so.15

From the error it was clear that there is a version mismatch that is defined for ZlibVersion in libmysqlclient.so.15. So next step was to find out which all libmysqlclient.so files are there in the server. Since I was not sure about the path of libmysqlclient locate was my command but before that I should update my database.

root@server1 [~]# updatedb &
root@server1 [~]# locate libmysqlclient.so

and the result was like this.

/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.15
/usr/lib/libmysqlclient.so.15.0.0
/usr/lib/libmysqlclient.so.6
/usr/lib/mysql/libmysqlclient.so
/usr/lib/mysql/libmysqlclient.so.15
/usr/lib/mysql/libmysqlclient.so.15.0.0

Now I had removed the link file /usr/lib/libmysqlclient.so.15 and relinked to /usr/lib/libmysqlclient.so.15.0.0

by the command

root@server1 [~]#  ln -s /usr/lib/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so.15

Now issue php -V command you will see the error vanished.

VN:F [1.9.6_1107]
Rating: 2.0/10 (2 votes cast)
VN:F [1.9.6_1107]
Rating: -2 (from 2 votes)

admin general, linux ,

Tcpdump checking connections

March 10th, 2009

Hosting servers at some point of time should have faced a ddos attack. You will have lot of trouble in identifying the right command to use and check the connections to your server.Here is a small tip with tcpdump

tcpdump -v nn -w attack dst port 80

Catch upto 200 packets you can change the port number as well as the filename “attack” as per your need. Having done that you can now figure out the number of connections from the ips by following command

tcpdump -nr attack |awk ‘{print $3}’ |grep -oE ‘[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-9]{1,}’ |sort |uniq -c |sort -rn

Block the ips with maximum count using iptables.

iptables -I INPUT -s ipaddress -j DROP

VN:F [1.9.6_1107]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin general, linux

Litespeed webserver

March 10th, 2009

Litespeed webserver

Internet is growing and the servers hosting the sites are thickly packed. If you are not hosting your site on a dedicated server chances are there that it is loading very slow at times.

Almost 90% of servers are based in linux which is embracing opensource software Apache as its webserver. Over a decade we haven’t seen any marked improvement in its performance with the growing demand.

Litespeed comes to your rescue at this juncture, they provide both free and enterprise version. They have provided a comparison chart with other websevers

http://www.litespeedtech.com/web-server-performance-comparison-litespeed-2.1-vs.html

We also had implemented it on our server and the site sparksupport.com is using litespeed. We could see a drastic difference in the performance. Another catch is that if your server is using a control panel like cpanel or plesk, litespeed can still work as it is portable with the existing webservice.

There is a very good documentation provided by litespeed which is a major advantage over its rivals like ngine-X.

Give it a try and experience the difference.

Update: Wed Apr 15 12:26:17 IST 2009

We moved our servers to Nginx – Cpanel combination. Now all our our servers are running Nginx.

VN:F [1.9.6_1107]
Rating: 6.3/10 (3 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)

admin linux, Webservice