Installing and Configuring Monit Step by Step

install and configure monit

apt-get install monit

Monit Configuration file is  /etc/monit/monitrc

Now make the list of services you want to monitor

for example sshd,apache,Mysql

Now for monit web interface the default port number is 2812

Now let us configure the monit

vi /etc/monit/monitrc
set daemon  60    // time interval of the daemon
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: }
set alert root@localhost // mail id to send email alerts
set httpd port 2812 and  // If you want to chang port number change here better leave it default
     SSL ENABLE          // for SSL
     PEMFILE  /var/certs/monit.pem   // SSL certificate location
     allow admin:test                // user name and password Basic Auth

// monitoring sshd

check process sshd with pidfile /var/run/
   start program  "/etc/init.d/ssh start"
   stop program  "/etc/init.d/ssh stop"
   if failed port 22 protocol ssh then restart
   if 5 restarts within 5 cycles then timeout
// monitoring mysql

check process mysql with pidfile /var/run/mysqld/
   group database
   start program = "/etc/init.d/mysql start"
   stop program = "/etc/init.d/mysql stop"
   if failed host port 3306 then restart
   if 5 restarts within 5 cycles then timeout
// monitoring apache

check process apache with pidfile /var/run/
   group www
   start program = "/etc/init.d/apache2 start"
   stop program  = "/etc/init.d/apache2 stop"

   if failed host port 80 protocol http
      and request "/monit/token" then restart
here monit tries to connect on port 80 and tries to access a file
the actual location of /monit/token is 
as our website document root is   
if monit cannot access this file it means apache is not runnig so it will
restart apache.
Creation of token is given below  
   if cpu is greater than 60% for 2 cycles then alert
   if cpu > 80% for 5 cycles then restart
   if totalmem > 500 MB for 5 cycles then restart
   if children > 250 then restart
   if loadavg(5min) greater than 10 for 8 cycles then stop
   if 3 restarts within 5 cycles then timeout

you can add your custom process for 
monitoring here


Creation of token


mkdir /var/www/

echo "hello" > /var/www/ 

Creation of SSL-encrypted monit web interface

(  /var/certs/monit.pem  )

openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
openssl gendh 512 >> /var/certs/monit.pem
openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
chmod 700 /var/certs/monit.pem

then we need to configure OpenSSL configuration file to create our certificate
vi /var/certs/monit.cnf

example file is 
# create RSA certs - Server

RANDFILE = ./openssl.rnd

[ req ]
default_bits = 1024
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type

[ req_dn ]
countryName = Country Name (2 letter code)
countryName_default = MO

stateOrProvinceName             = State or Province Name (full name)
stateOrProvinceName_default     = Monitoria

localityName                    = Locality Name (eg, city)
localityName_default            = Monittown

organizationName                = Organization Name (eg, company)
organizationName_default        = Monit Inc.

organizationalUnitName          = Organizational Unit Name (eg, section)
organizationalUnitName_default  = Dept. of Monitoring Technologies

commonName                      = Common Name (FQDN of your server)
commonName_default              =

emailAddress                    = Email Address
emailAddress_default            =

[ cert_type ]
nsCertType = server
enable monit daemon now
in this file set startup =1 and interval for running the monit daemon
example file is below 
# Defaults for monit initscript
# sourced by /etc/init.d/monit
# installed at /etc/default/monit by maintainer scripts
# Fredrik Steen 

# You must set this variable to for monit to start

# To change the intervals which monit should run uncomment
# and change this variable.
now let us start monit
/etc/init.d/monit start  
Now point your browser to
 (make sure port 2812 is not blocked by your firewall), log in with admin and test 
as specified in /etc/monit/monitrc

How to rename temp files in temporary tablespace

ALTER DATABASE RENAME FILE 'oldpath' TO 'newfile path';

delete older file

Steps to start the multiple listener in Oracle

LSNRCTL>set current DEMO
LSNRCTL> start
LSNRCTL> set current PROD
LSNRCTL> start

Veritas Storage Area Network Concepts step by step material download

Veritas Storage Area Network Concepts Part1

Veritas Storage Area Network Concepts Part2

Veritas Disaster Recovery Planning step by step material download

 Veritas Disaster Recovery Planning Concepts Part1

 Veritas Disaster Recovery Planning Concepts Part2

Veritas Backup and Restore Step by Step Material download

Veritas Backup and Restore Concepts Part1

Veritas Backup and Restore Concepts Part2

Storage Virtulization Concepts Step by Step material download

Download Storage Virtulization Concepts Part 1

Download Storage Virtulization Concepts Part 2

High Availability Concepts Step by Step Download Material

Download Part 1

Download Part 2

EMC Training material download


Size: 612 KB


Size: 4357 KB


Size: 3465 KB


Size: 1773 KB


Size: 1168 KB


Size: 3249 KB

How does DNS work step by step

Client enters a domain name ( into his browser
The browser contacts the Client's ISP for the IP address of the domain name
The ISP first tries to answer by itself using "cached" data.
If the answer is found it is returned. Since the ISP isn't in charge of the DNS, and is just acting as a "dns relay", the answer is marked "non-authoritative"
If the answer isn't found, or it's too old (past the TTL), then the ISP DNS contacts the nameservers for the domain directly for the answer.
If the nameservers are not known, the ISP's looks for the information at the 'root servers', or 'registry servers'. For com/net/org, these start with
NOTE: The 'whois' information is never used for DNS, and is often misleading and inaccurate 

For More Detaild Explanation Click Here

ZFS file system Step by Step

ZFS stands for Zettabyte File System .
It is designed by Sun Microsystems for the Solaris Operating.
The features of ZFS include support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs. ZFS is implemented as open-source software, licensed under the Common Development and Distribution License (CDDL).  

Some of the benefits of the ZFS file system:

  • Filesystem and Volumemanger in one system
  • Easy administration with only 2 commands - #zpool and #zfs
  • advanced raid level and functions
  • snapshots
  • automatic checksum over all data
  • 128 Bit
  • automatic shrinking and growing volumes
  • No RAID cards required, using ZFS built in RAID-Z redundancy. (reduces hardware cost drastically)
  • Effective and Optimal SnapShots
  • Compressed Zpools.
  • Built in NFS/ISCSI/SMB Sharing
  • Support PNFS for high speed interconnects. (Will use all the 6 GigE ports) 
Configuring ZFS 

 Permitted subcommands  are  listiostatstatus online,
       offline, scrub, import, and history.
Find version of ZFS
  # kextstat | grep zfs

zpool   - configuring zfs storage pools 

  # zpool create myzfs /disk1 /disk2

  # zpool create mypool mirror disk1s1 disk0s1 mirror disk1s2 disk0s2

# mkfile 100m disk1 disk2 disk3 disk5# mkfile 50m disk4
# ls -l disk*
-rw------T   1 root     root     104857600 Sep 11 12:15 disk1
-rw------T   1 root     root     104857600 Sep 11 12:15 disk2
-rw------T   1 root     root     104857600 Sep 11 12:15 disk3
-rw------T   1 root     root     52428800 Sep 11 12:15 disk4
-rw------T   1 root     root     104857600 Sep 11 12:15 disk5
Creating hot spares
when any disk goes down the disk marked as hotspare will 
automatically take its functionality after it gets replaced.
#  zpool create pool mirror disk0 disk1 spare disk2 disk3
These spares can be across multiple pools and can be added 
with zpool add  and removed with zpool remove

Automated Installation of MySQL without asking password

is your  the installation process  pops up a blue dialog asking for a root password ?? want to make automated

without the asking of password then

First give this two commands

echo "mysql-server mysql-server/root_password select (password omitted)" | debconf-set-selections 

echo "mysql-server mysql-server/root_password_again select (password omitted)" | debconf-set-selections 

Then the installation will not ask for passowrd then continue installation.

apt-get install mysql-client-5.1 mysql-server-5.1 -y