sudo nano /etc/.monit.conf for For RHEL
sudo nano /etc/monit/monitrc For Dabian
set httpd port 2812 and
allow admin:monit # require user 'admin' with password 'monit'
allow @monit # allow users of group 'monit' to connect (rw)
allow @users readonly # allow users of group 'users' to connect readonly
`````````````````````````````````````````````````````````````````````
### Below example for nginx and mongodb.Add then in last of file.
Below hooks for **nginx**
````````````````````````````````````````````````
check process nginx_web_server with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
````````````````````````````````````````````````
Below hooks for **mongodb**
```````````````````````````````````````````
check process mongodb with pidfile /var/lib/mongo/mongod.lock
start program = "/etc/init.d/mongod start"
stop program = "/etc/init.d/mongod stop"
if failed host 127.0.0.1 port 27017 then restart
if 5 restart within 5 cycles then timeout
``````````````````````````````````