Thursday, September 30, 2010

How to integrate tomcat with apache on cpanel linux server?

Guys,

I didn't configure it but I am making it more available in the internet so that you can easily get the link and steps. Hope it'll help you to do the same. Here are the steps :

=======
1- Configure PATH
- vi or pico -w /etc/profile
- Add those lines after the first comments
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

JAVA_HOME=/usr/local/java/java
CATALINA_HOME=/usr/local/tomcat
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/sbin:/usr/sbin
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/common/lib/servlet.jar:/usr/local/pgsql/share/java/postgresql.jar:../lib/struts.jar:.

- Locate the line where you see export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC and add : JAVA_HOME CATALINA_HOME CLASSPATH


2- Download SDK at http://java.sun.com/j2se/1.4.2/download.html (j2sdk-1_4_2_03-linux-i586.bin)

3- Install java SDK
- mkdir /usr/local/java
- cd /usr/local/java
- chmod u+x j2sdk-version.bin
- ./j2sdk-version.bin
- ln -s j2sdk-version java
JAVA is installed under /usr/local/java/java/

4- Download Jakarta Tomcat at http://apache.mirror.mcgill.ca/jakarta/tomcat-4/v4.1.30/bin/jakarta-tomcat-4.1.30.tar.gz

5- Install Tomcat
- tar -zxvf jakarta-tomcat-4.1.30.tar.gz
- mv jakarta-tomcat-4.1.30 /usr/local/
- cd /usr/local
- ln -s jakarta-tomcat-4.1.30 tomcat
Tomcat is installed under /usr/local/tomcat/

6- Download Jakarta ANT at http://apache.mirror.cygnal.ca/ant/binaries/apache-ant-1.6.1-bin.tar.gz

7- Install Jakarta ANT
- tar -zxvf apache-ant-1.6.1-bin.tar.gz
- mv apache-ant-1.6.1 /usr/local/
- cd /usr/local
- ln -s apache-ant-1.6.1 ant
- ln -s /usr/local/ant/bin/ant /usr/local/bin/ant
- ln -s /usr/local/ant/bin/ant /usr/sbin/

8- Download the Java Connector from CVS and build / install mod_jk
- cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login password: anoncvs (When prompted for a password, just hit ENTER)
- cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic checkout jakarta-tomcat-connectors
- mv jakarta-tomcat-connectors /usr/local/java/
- cd /usr/local/java/jakarta-tomcat-connectors/jk/native/
- ./buildconf.sh
- ./configure --with-apxs=/usr/sbin/apxs
- make
- cp apache-1.3/mod_jk.so /etc/httpd/modules/

9- Configure httpd.conf for mod_jk
- Doing a backup : cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
- Enabling mod_jk : vi or pico -w /etc/httpd/conf/httpd.conf
After this line :
LoadModule perl_module /usr/lib/apache/libperl.so

Add :
LoadModule jk_module /usr/lib/apache/mod_jk.so

After your last AddModule line, add :
AddModule mod_jk.c

Include "/usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf"

10- Edit/Create /usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf
- vi or pico -w /usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf
- Enter those lines :


LoadModule jk_module /usr/lib/apache/mod_jk.so


JkWorkersFile "/usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-4.1.30/logs/mod_jk.log"


JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13


JkLogLevel emerg

11- Edit/Create /usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties
- mkdir /usr/local/jakarta-tomcat-4.1.30/conf/jk
- vi or pico -w /usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties
- Enter those lines :

# Setting Tomcat & Java Home
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java/java
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

12- Edit /usr/local/jakarta-tomcat-4.1.30/conf/server.xml
cd /usr/local/jakarta-tomcat-4.1.30/conf/
rm -f server.xml
vi or pico -w server.xml
Copy - Past text below :










some-site.com








13- Edit /usr/local/jakarta-tomcat-4.1.30/conf/tomcat-users.xml







14- Download and install the tomcatd script
- Download the script at http://www.linuxjava.net/howto/webapp/install_files/tomcatd
- mv tomcatd /usr/sbin
- chmod 700 /usr/sbin/tomcatd
- vi or pico -w /usr/sbin/tomcatd
- Locate any lines that contain the text : su - tomcat -c $TOMCAT_START and replace it by : $TOMCAT_START

15- FINISH !! START TOMCAT AND TEST IT :)
- service httpd restart
- tomcatd start
=======

Ref : http://www.directadmin.com/forum/archive/index.php/t-2227.html

Try :)

Wednesday, September 29, 2010

How install MRTG on linux?

Guys,

The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network links. MRTG generates HTML pages containing PNG images which provide a LIVE visual representation of this traffic.

Here are the steps those I followed :

====
Installing Library zlib :

................
wget http://www.gzip.org/zlib/zlib-1.1.4.tar.gz
tar -xvzf zlib-1.1.4.tar.gz
mv zlib-1.1.4 zlib
cd zlib
./configure
make
cd ..
................

Installing Library libpng :

................
wget http://public.planetmirror.com/pub/sourceforge/l/li/libpng/libpng-1.0.15.tar.gz
tar -xvzf libpng-1.0.15.tar.g
mv libpng-1.0.15 libpng
cd libpng
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
cd ..
................

Installing Library gd :

................
wget http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
tar -xvzf gd-1.8.4.tar.gz
mv gd-1.8.4 gd
cd gd

perl -i~ -p -e s/gd_jpeg.o//g Makefile
make INCLUDEDIRS="-I. -I../zlib -I../libpng" \
LIBDIRS="-L../zlib -L. -L../libpng" \
LIBS="-lgd -lpng -lz -lm" \
CFLAGS="-O -DHAVE_LIBPNG"
cd ..
................

Installing MRTG:

.................
cd /usr/local/src
wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.15.0.tar.gz
gunzip -c mrtg-2.15.0.tar.gz | tar xvf -
cd mrtg-2.15.0
./configure --prefix=/usr/local/mrtg-2 \
--with-gd=/usr/local/src/gd \
--with-z=/usr/local/src/zlib \
--with-png=/usr/local/src/libpng
make
make install
.................

Configuration :-

..................
cd /usr/local/src/mrtg-2.15.0/bin

cfgmaker --global 'WorkDir: /home/yourusername/public_html/mrtg' \
--global 'Options[_]: bits,growright' \
--output /usr/local/mrtg-2/mrtg.cfg \
public@localserver
..................

setup cron :

*/5 * * * * root "env LANG=C /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/mrtg.cfg" --logging /var/log/mrtg.log

View the MRTG :

htpp://domain/mrtg

That's it. try :)

Monday, September 27, 2010

make: *** [install-webconf] Error 1

Guys,

I got this error message during configuring the nagios : Here is the exact error message.

=======
root@server [/usr/local/src/nagios-3.2.1]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf
/etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file `/etc/httpd/conf.d/nagios.conf':
No such file or directory
make: *** [install-webconf] Error 1
=======

Sol: As per the error message it's clear that nagios is trying to create the nagios.conf file inside the /etc/httpd.conf file. So, to resolve this problem, please make a sysmlink with the current conf.d directory of httpd daemon. Here are the steps those I followed.

1. Grep httpd daemon :

root@server [/usr/local/nagios/etc]# ps aux | grep httpd
root 6900 0.0 0.0 4204 624 pts/1 S+ 00:12 0:00 grep httpd
root 25825 0.0 0.3 17400 7520 ? Ss Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25826 0.0 0.2 16768 5152 ? S Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25828 0.0 0.5 239148 10804 ? Sl Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25830 0.0 0.5 239012 10732 ? Sl Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25832 0.0 0.5 239284 10920 ? Sl Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25852 0.0 0.5 239148 10768 ? Sl Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 25874 0.0 0.5 239148 10772 ? Sl Sep27 0:00 /usr/local/apache/bin/httpd -k start -DSSL
root@server [/usr/local/nagios/etc]#

2. Find Document root of apache or httpd :
root@server [/usr/local/nagios/etc]# /usr/local/apache/bin/httpd -V |grep HTTPD_ROOT
-D HTTPD_ROOT="/usr/local/apache"

3. Make a symlink like :
root@server [/usr/local/nagios/etc]# ln -s /etc/httpd/conf.d /usr/local/apache/conf.d

That's it. Try to re-execute above failed command. It'll work :)

How to install nagios on cpanel or linux server?

Guys,

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

Nagios is an open source application that monitors for computer network problems so that they can be fixed more quickly. Nagios was designed for use with the Linux operating system, but it will also work under Unix and most Unix-based systems.

Nagios runs periodic checks on user-specified resources and services. Resources that can be monitored include memory usage, disk usage, microprocessor load, the number of currently running processes, and log files. Services that can be monitored include Simple Mail Transfer Protocol (SMTP), Post Office Protocol 3 (POP3), Hypertext Transfer Protocol (HTTP), and other common network protocols. The program can monitor environmental variables such as temperature, humidity, or barometric pressure in conjunction with the appropriate measuring hardware. A user-friendly Web-based graphical user interface is provided. An authorization system allows the administrator to restrict access as necessary.

I have referred following steps to install and configure the nagios.

Before proceeding to mention the steps let me tell some points. Here I have installed nagios on monitoring server. So, this server will monitor other remote servers. Here are the required tools for them.

[A] For monitoring server(Who will monitor others) : a)nagios b) nagios-plugin c) nrpe daemon
[B] For monitored remote server(who will be monitored) : a) nagios-plugin c) nrpe daemon
[C] Configuring monitoring server to monitor remote hosts.


Let IP of monitoring server is 64.34.203.8. and 76.74.238.165 is the IP of remote server.

Now please make it sure that following packages has installed on the server.

-------
php-mysql php-gd php-ldap php-xml gd gd-devel gcc glibc glibc-common libstdc++-devel gcc-c++perl-DBI perl-DBD-MySQL perl-Config-IniFiles rrdtool perl-rrdtool

Note : For cpanel server all the modules might have installed. You can also enable them using /scripts/easyapache or yum install mod_name
-------
============================================================================

I am mentioning step by step here :

[A] Installing and configuring the monitoring tools on monitoring server(Who will monitor others) : a)nagios b) nagios-plugin c) nrpe daemon :-

a)nagios :-

------------------
1. Login into the server via ssh and gain root access.
2. useradd nagios
3. passwd nagios
4. groupadd nagcmd
5. /usr/sbin/usermod -a -G nagcmd nagios
6. /usr/sbin/usermod -a -G nagcmd nobody

Note : here nobody is the apache user on my server(cpanel linux server). You can get the user by executing the following command :

root@server [/usr/local/src]# grep '^User' /usr/local/apache/conf/httpd.conf
User nobody
UserDir public_html
root@server [/usr/local/src]#

7. cd /usr/local/src/
8. wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
9. tar -xvzf nagios-3.2.1.tar.gz
10. cd nagios-3.2.1
11. ./configure --with-command-group=nagcmd
12. make all
13. make install
14. make install-init
15. make install-config
16. make install-commandmode
17. make install-webconf

Note: During executing "make install-webconf" you'll face following error message.

``````````````````````````````````````````````````````````
root@server [/usr/local/src/nagios-3.2.1]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf
/etc/httpd/conf.d/nagios.conf
/usr/bin/install: cannot create regular file `/etc/httpd/conf.d/nagios.conf':
No such file or directory
make: *** [install-webconf] Error 1

I hope you got the clue from this error message. So, please make a directory and link with cpanel apache conf.d like :

root@server [/usr/local/src/nagios-3.2.1]# mkdir -p /etc/httpd/conf.d
root@server [/usr/local/src/nagios-3.2.1]# ln -s /etc/httpd/conf.d /usr/local/apache/conf.d

Then execute the above webconf once again. It'll create nagios.conf file in that conf.d directory. That's it. This is for integrating the nagios with webserver.
``````````````````````````````````````````````````````````

18. htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin //provide password here.

That's it for nagios. For my case here are the content in conf.d

````````
root@server [/etc/httpd/conf.d]# ll
total 12
drwxr-xr-x 2 root root 4096 Sep 26 23:22 ./
drwxr-xr-x 18 root root 4096 Sep 26 23:17 ../
lrwxrwxrwx 1 root root 6 Sep 26 23:20 conf.d -> conf.d
-rw-r--r-- 1 root root 1010 Sep 26 23:22 nagios.conf
root@server [/etc/httpd/conf.d]#
````````

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

b) nagios-plugin installation :-

1. cd /usr/local/src/
2. wget wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-
plugins-1.4.11.tar.gz
3. tar -xvzf nagios-plugins-1.4.11.tar.gz
4. cd nagios-plugins-1.4.11
5. ./configure --with-nagios-user=nagios --with-nagio-group=nagios
6. make
7. make install
8. chkconfig --add nagios
9. chkconfig nagios on
10. chown nagios.nagios /usr/local/nagios
11. chown -R nagios.nagios /usr/local/nagios/libexec
12. /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

````````````````
10th command will check the configuration whether it's correct or not. If it's correct it'll show following :
..............
Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight
check

If there is no error it means your nagios configuration is correct and you can
start nagios service.
.............

`````````````````

13. /etc/init.d/nagios start
14. ps aux | grep nagios //check whether nagios is running or not.

that's it for nagios plugin :)

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

c) nrpe daemon installation : --

1. cd /usr/local/src/
2. wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
3. tar -xvzf nrpe-2.12.tar.gz
4. cd nrpe-2.12

......
Make sure openssl-devel has installed on the server. Check like

root@server [/usr/local/src/nrpe-2.12]# rpm -qa | grep openssl-devel
openssl-devel-0.9.8e-12.el5_4.6
root@server [/usr/local/src/nrpe-2.12]#

Else execute : yum install openssl*
......

5. ./configure
6. make all
7. make install-plugin
8. make install-daemon
9. make install-daemon-config
10. make install-xinetd

.......
Note : Make sure that xinetd has installed on the server. Else install it like yum install xinetd
.......

11. vi /etc/xinetd.d/nrpe and disable “only_from” directive. So, the content of the file will look like :

.......
root@server [~]# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
# only_from = 127.0.0.1
}
root@server [~]#
.......

12. echo "nrpe 5666/tcp # NRPE" >> /etc/services
13. Make it sure that you have opened the above port at the firewall.
14. chkconfig xinetd on
15. service xinetd restart

op will be like :

.....
root@server [/usr/local/src/nrpe-2.12]# chkconfig --list | grep xinetd
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd based services:
root@server [/usr/local/src/nrpe-2.12]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
root@server [/usr/local/src/nrpe-2.12]#
.....

That's it.

Test the NRPE daemon locally :

16. netstat -at | grep nrpe

Here is the o/p :
........
tcp 0 0 *:nrpe *:* LISTEN

root@server [/usr/local/src/nrpe-2.12]# netstat -plan | grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:*
LISTEN 31130/xinetd
root@server [/usr/local/src/nrpe-2.12]#
........

17. /usr/local/nagios/libexec/check_nrpe -H localhost

Here is the o/p :

........
root@server [/usr/local/src/nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12
root@server [/usr/local/src/nrpe-2.12]#
........

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

[B] Installing and configuring the monitoring tools on monitored server (who will be monitored) : a) nagios-plugin c) nrpe daemon :----

Login into the remote server via ssh and gain root access.

a) : nagios-plugin installation :

1. cd /usr/local/src/
2. /usr/sbin/useradd nagios
3. passwd nagios
4. wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
5. tar -xvzf nagios-plugins-1.4.15.tar.gz
6. cd nagios-plugins-1.4.15
7. ./configure
8. make
9. make install
11. chown nagios.nagios /usr/local/nagios
12. chown -R nagios.nagios /usr/local/nagios/libexec
13. Make sure that xinetd has installed on the server. Else install using : yum install xinetd

That's it :)
===================================

b) nrpe daemon installation :-


1. cd /usr/local/src/
2. wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
3. tar -xvzf nrpe-2.12.tar.gz
4. cd nrpe-2.12

......
Make sure openssl-devel has installed on the server. Check like

root@server [/usr/local/src/nrpe-2.12]# rpm -qa | grep openssl-devel
openssl-devel-0.9.8e-12.el5_4.6
root@server [/usr/local/src/nrpe-2.12]#

Else execute : yum install openssl*
......

5. ./configure
6. make all
7. make install-plugin
8. make install-daemon
9. make install-daemon-config
10. make install-xinetd

.......
Note : Make sure that xinetd has installed on the server. Else install it like yum install xinetd
.......

11. vi /etc/xinetd.d/nrpe and change the IP at the “only_from” directive. It'll be monitoring server's(who will monirot) IP. For my case it was 64.34.203.8. So, the content of the file will look like :

.......
root@server [/etc/xinetd.d]# hostname
server.loveme.com
root@server [/etc/xinetd.d]# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 64.34.203.8
}
root@server [/etc/xinetd.d]#
.......

12. echo "nrpe 5666/tcp # NRPE" >> /etc/services
13. Make it sure that you have opened the above port at the firewall.
14. chkconfig xinetd on
15. service xinetd restart

op will be like :

.....
root@server [/usr/local/src/nrpe-2.12]# chkconfig --list | grep xinetd
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
xinetd based services:
root@server [/usr/local/src/nrpe-2.12]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
root@server [/usr/local/src/nrpe-2.12]#
.....


Test the NRPE daemon locally :

16. netstat -at | grep nrpe

Here is the o/p :
........
tcp 0 0 *:nrpe *:* LISTEN

root@server [/usr/local/src/nrpe-2.12]# netstat -plan | grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:*
LISTEN 31130/xinetd
root@server [/usr/local/src/nrpe-2.12]#
........

17. /usr/local/nagios/libexec/check_nrpe -H localhost

Here is the o/p :

........
root@server [/usr/local/src/nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12
root@server [/usr/local/src/nrpe-2.12]#
........

That's it.

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


[C] Configuring monitoring server to monitor remote hosts :-

Login into the monitoring server(who will monitor) via ssh and gain root access.

1. Create a command definition: /usr/local/nagios/etc/commands.cfg

and add following entries in that file :
---
root@server [/usr/local/nagios/etc/objects]# cat /usr/local/nagios/etc/commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

root@server [/usr/local/nagios/etc/objects]
---

2. chown nagios. /usr/local/nagios/etc/commands.cfg
3. create the file /usr/local/nagios/etc/objects/linux-box-remote.cfg and add
following entries in that file.

........
root@server [/usr/local/nagios/etc/objects]# cat /usr/local/nagios/etc/objects/linux-box-remote.cfg
define host{
name linux-box-remote ; Name of this
template
use generic-host ; Inherit default values
check_period 24x7
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ; DONT REGISTER THIS - ITS A
TEMPLATE
}

define host{
use linux-box-remote ; Inherit default values from a
template
host_name server.ubeea2.com ; The name we're giving to this
server
alias ubeea2 ; A longer name for the server
address 76.74.238.165 ; IP address of the server
}

define service{
use generic-service
host_name server.ubeea2.com
service_description CPU Load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name server.ubeea2.com
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name server.ubeea2.com
service_description /dev/hda1 Free Space
check_command check_nrpe!check_hda1
}
define service{
use generic-service
host_name server.ubeea2.com
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service
host_name server.ubeea2.com
service_description Zombie Processes
check_command check_nrpe!check_zombie_procs
}
root@server [/usr/local/nagios/etc/objects]#
..........

Note : Change the IP and hostname. Then call this file in the nagios.cfg file. Just add
like

4. cfg_file=/usr/local/nagios/etc/objects/linux-box-remote.cfg

Example :
........
root@server [/usr/local/nagios/etc]# grep linux-box-remote.cfg /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/linux-box-remote.cfg
........

5. chown nagios. /usr/local/nagios/etc/objects/linux-box-remote.cfg
6. check config like :
....
root@server [/usr/local/nagios/etc/objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Make sure warning and error are zero.
....

7. service nagios restart
8. You can add multple remote host in the linux-box-remote.cfg file. Just add another entry like second defined "host" to last one(only you have to change the hostname and services those you want to monitor).

That's it. Try :)

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

Thursday, September 16, 2010

How to + extract + untar + unzip .tar.gz file on linux ?

Guys,

I refer following commands :

Examples :
=========
gzip -d guiderj_content.sql.gz
tar -xvzf guiderj_content.sql.gz
tar -jxvf eaccelerator-0.9.5.3.tar.bz2
=========

try :)

How to repair mysql database or tables of the database?

Guys,

I usually use following command to repair all the tables of the databases of a user.

=========
[root@server /var/lib/mysql]#for i in `ll |grep bigchakr|awk '{print $9}' |cut -d/ -f1`; do for j in `mysql -e "use $i; show tables;"|grep -v -`; do mysql -e "use $i; repair table $j;"; done done;
=========

User : bigchakr, please replace this user. It'll repair all the tables of all the DB of that user.

You can use myisamchk command to repair the DB. Here is the comamnd :

========
[root@server /var/lib/mysql]# myisamchk -r /var/lib/mysql/bigchakr_content/*.MYI
========

Note : bigchakr_content is the name of the DB. You can use following command.

========
[root@server /var/lib/mysql]# for i in `ll |grep bigchakr|awk '{print $9}'`; do myisamchk -r $i/*.MYI ; done
========

I don't prefer myisamchk since sometime it doesn't give good results.

Try. :)

Saturday, September 11, 2010

FileList::init() failed: ls_dir_wrapper() failed: Unable to logon user + Logon failure: unknown user name or bad password

Guys,

I have referred the following steps to sort out the error :

steps to recreate the error : Login into plesk cp >> domain's cp >> browse file manager. Here is the error :

------
---------------------- Debug Info -------------------------------
0: FileManagerUIPointer.php:709
FileManagerUIPointer->accessItem(string 'GET', NULL null)
1: client.domain.hosting.file-manager.php:86
plesk__client__domain__hosting__file_manager->accessItem(string 'GET', NULL null)
2: UIPointer.php:601
UIPointer->access(string 'GET')
3: plesk.php:43
------

Solutions :

1. RDP >> Mycomputer >>right click >> properties >>manage >>user & group >>click on users>> find the user(domain name) >>right click and click on properties >> uncheck 'password disable option'.

2. Go to run>>cmd>> and execute following query to retrieve the password of the user's admin area of the domain. For my case I executed the following query :

Example :
------
C:\>"%plesk_bin%"\dbclient --direct-sql --sql="select su.login, a.password from
accounts a, sys_users su where a.id=su.account_id and su.login='dhelalqamar.com
'"
login password
dhelalqamar.com domain_passwd
------

Note : Replace only login name here

3. Execute following command to be recognized the password by the system :

net user login_name password

Example :

====
C:\>
net user dhelalqamar.com qwertyu

The command executed successfully
====

Now try to browse the file manager. Error will be vanished :)

That's it. try :)