{"id":1550,"date":"2015-01-08T15:06:20","date_gmt":"2015-01-08T15:06:20","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=1550"},"modified":"2015-01-08T15:06:20","modified_gmt":"2015-01-08T15:06:20","slug":"mmonit","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2015\/01\/08\/mmonit\/","title":{"rendered":"Install and Configure Monit on CentOS 6.6"},"content":{"rendered":"<p>Monit is not available from the system base repositories, you need to add and enable third party epel repository to install monit package under your RHEL\/CentOS systems.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# wget http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm\n# sudo rpm -Uvh epel-release-6*.rpm\n\n<\/pre>\n<p>Install Monit<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# yum install monit\n<\/pre>\n<p>Monit has it\u2019s web interface that runs on port 2812 using web server. To enable web interface you need to make changes in monit configuration file. <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# nano \/etc\/monit.conf\n<\/pre>\n<p>Uuncomment the following section and add the IP address or domain name of your server, allow anyone to connect and change monit user and password or you can use default ones.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n set httpd port 2812 and\n     use address localhost  # only accept connection from localhost\n     allow localhost        # allow localhost to connect to the server and\n     allow admin:monit      # require user &#039;admin&#039; with password &#039;monit&#039;\n     allow @monit           # allow users of group &#039;monit&#039; to connect (rw)\n     allow @users readonly  # allow users of group &#039;users&#039; to connect readonly\n\n<\/pre>\n<p>Restart Monit<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# \/etc\/init.d\/monit start\n<\/pre>\n<p>Add Monit to start at boot<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# chkconfig monit on\n<\/pre>\n<p>in \/etc\/monit.d<\/p>\n<p>Add httpd<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# nano \/etc\/monit.d\/httpd\ncheck process httpd with pidfile \/var\/run\/httpd\/httpd.pid\nstart program = \/etc\/init.d\/httpd start\nstop  program = \/etc\/init.d\/httpd stop\nif failed host 127.0.0.1 port 80\nprotocol http then restart\nif 5 restarts within 5 cycles then timeout\n#Use for specific host\n#if failed host domain.com port 80 protocol HTTP\n#    then restart\n#if totalmem &gt; 75% for 2 cycles then restart\n\n<\/pre>\n<p>Add mysql<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#nano \/etc\/monit.d\/mysql\ncheck process mysqld with pidfile \/var\/run\/mysqld\/mysqld.pid\nstart program = &quot;\/etc\/init.d\/mysqldd start&quot;\nstop  program = &quot;\/etc\/init.d\/mysqld stop&quot;\nif failed host 127.0.0.1 port 3306 then restart\nif 5 restarts within 5 cycles then timeout\n<\/pre>\n<p>Nginx<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncheck process nginx with pidfile \/var\/run\/nginx.pid\nstart program = &quot;\/etc\/init.d\/nginx start&quot;\nstop program = &quot;\/etc\/init.d\/nginx stop&quot;\n<\/pre>\n<p>Check the syntax<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# monit -t\n<\/pre>\n<p>Restart monit<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# service monit restart\n<\/pre>\n<p>You can verify that monit service is started by checking log file.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# tail -f \/var\/log\/monit\n&#x5B;BDT Apr  3 03:06:04] info     : Starting monit HTTP server at &#x5B;localhost:2812]\n&#x5B;BDT Apr  3 03:06:04] info     : monit HTTP server started\n&#x5B;BDT Apr  3 03:06:04] info     : &#039;tecmint.com&#039; Monit started\n&#x5B;BDT Apr  3 03:06:04] error    : &#039;nginx&#039; process is not running\n&#x5B;BDT Apr  3 03:06:04] info     : &#039;nginx&#039; trying to restart\n&#x5B;BDT Apr  3 03:06:04] info     : &#039;nginx&#039; start: \/etc\/init.d\/nginx\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Monit is not available from the system base repositories, you need to add and enable third party epel repository to install monit package under your RHEL\/CentOS systems. # wget http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm # sudo rpm -Uvh epel-release-6*.rpm Install Monit # yum install monit Monit has it\u2019s web interface that runs on port 2812 using web server. To &#8230; <a title=\"Install and Configure Monit on CentOS 6.6\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2015\/01\/08\/mmonit\/\" aria-label=\"Read more about Install and Configure Monit on CentOS 6.6\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[],"class_list":["post-1550","post","type-post","status-publish","format-standard","hentry","category-security"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=1550"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1550\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=1550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=1550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=1550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}