Friday, April 29, 2011

installing Webmin and pptp with ssl on openvz

This post explains installing and configuring webmin and pptp with ssl on openvz vps. The os template is centos5.

On the node :
modprobe ppp_async
modprobe ppp_deflate
modprobe ppp_mppe
vzlist -a |grep IP_of_vps
vzctl stop [VEID]
vzctl set [VEID] --features ppp:on --save
vzctl start [VEID]
vzctl set [VEID] --devices c:108:0:rw --save
vzctl exec [VEID] mknod /dev/ppp c 108 0
vzctl exec [VEID] mknod /dev/ppp c 108 0
vzctl exec [VEID] chmod 600 /dev/ppp

You need all these modules on node:
[root@dallas5 ~]# lsmod | grep ppp
ppp_mppe 39816 0
ppp_deflate 39168 0
zlib_deflate 52760 1 ppp_deflate
ppp_async 45184 0
ppp_generic 63760 4 ppp_mppe,ppp_deflate,ppp_async
slhc 39680 1 ppp_generic
crc_ccitt 35200 1 ppp_async

On the VPS:[Openvz]
rpm -ivh webmin-1.550-1.noarch.rpm
/etc/init.d/webmin start
chkconfig --level 35 webmin on
rpm -ivh pptpd-1.3.4-2.rhel5.i386.rpm
/etc/init.d/pptpd start
chkconfig --level 35 pptpd on
yum install openssl openssl-devel
yum install perl-Net-SSLeay #for ssl+webmin
perl -e 'use Net::SSLeay' #testing
echo $? #testing exit status '0'

You can access the webmin at https://IP_address:10000 and do the further configuration of pptpd and ppp.

Some useful links :

Squid not starting with error visible hostname not set

[root@jlturbovps1 ~]#/etc/init.d/squid start
init_cache_dir /var/spool/squid... /etc/init.d/squid: line 62: 3944 Aborted $SQUID -z -F -D >> /var/log/squid/squid.out 2>&1
Starting squid: /etc/init.d/squid: line 42: 3945 Aborted $SQUID $SQUID_OPTS >> /var/log/squid/squid.out 2>&1 [FAILED]

#vi /etc/squid/squid.conf
visible_hostname GIVE_yourtour_hostname_here
:wq ##save it

Now start squid.

#/etc/init.d/squid start
init_cache_dir /var/spool/squid... Starting squid: . [ OK ]

Thats it.have fun.

Monday, April 25, 2011

How to setup url or website monitoring in nagios server

First of all create a configuration directory for writing the rules. You can also create the rules in localhost.cfg but I recommend  to create a separate directory and create the files in it.

#mkdir /etc/nagios/monitor_websites
and cd to this directory

And create file host.cfg in this directory for setting the urls.
#vi host.cfg

Suppose I want to monitor three sites,,

Configure host.cfg as below.
#vi host.cfg

define host{
alias         abc
use        generic-host

define host{
alias      xyz
use        generic-host

define host{
alias           pqr
use        generic-host

#Defining group of urls  - you should add this if you want to set up an HTTP check service.
define hostgroup {
hostgroup_name    monitor_websites
alias           monitor_urls
:wq #save it

And now create the file services.cfg for setting the service ( http_check )

#vi services.cfg
## Hostgroups services ##
define service {
hostgroup_name                 monitor_websites
service_description             HTTP
check_command                 check_http
use                             generic-service
notification_interval           0

Now give the permissions for directory and configuration files.
#chown  -R nagios:nagios monitor_websites

List and check.
[root@mail nagios]#  ll monitor_websites
total 16
-rw-r--r-- 1 nagios nagios 669 Apr 25 23:13 host.cfg
-rw-r--r-- 1 nagios nagios 253 Apr 25 23:15 services.cfg
[root@mail nagios]#

Now give the configuration directory path in main nagios configuration file.
#vi /etc/nagios/nagios.cfg

Now restart the nagios service.
#service nagios restart

Thats it. Check the nagios site. You are done. You rocks.