<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>monit init.d &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="https://lifelinux.com/tag/monit-init-d/feed/" rel="self" type="application/rss+xml" />
	<link>https://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Fri, 13 May 2011 15:31:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>How To Install Monit On Centos / Redhat</title>
		<link>https://lifelinux.com/how-to-install-monit-on-centos-redhat/</link>
					<comments>https://lifelinux.com/how-to-install-monit-on-centos-redhat/#comments</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Fri, 13 May 2011 08:06:46 +0000</pubDate>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[enable EPEL]]></category>
		<category><![CDATA[how to auto restart mysql apache on fail]]></category>
		<category><![CDATA[init.d respawn apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux script restart daemon]]></category>
		<category><![CDATA[monit]]></category>
		<category><![CDATA[monit apache]]></category>
		<category><![CDATA[monit init.d]]></category>
		<category><![CDATA[monit lighttpd]]></category>
		<category><![CDATA[monitor load and]]></category>
		<category><![CDATA[monitoring services]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[restart apache]]></category>
		<category><![CDATA[restart apache automatically]]></category>
		<category><![CDATA[restart lighttpd]]></category>
		<category><![CDATA[service availability]]></category>
		<category><![CDATA[superior solution]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[web servers]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=458</guid>

					<description><![CDATA[<p>What is Monit ? Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. What Monit can do Monit can start a process if it does not run, restart a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-install-monit-on-centos-redhat/">How To Install Monit On Centos / Redhat</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><h3>What is Monit ?</h3>
<p><strong>Monit</strong> is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.<span id="more-458"></span></p>
<h3>What Monit can do</h3>
<p><strong>Monit</strong> can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You can use Monit to monitor files, directories and filesystems for changes, such as timestamp changes, checksum changes or size changes. You can also monitor remote hosts; Monit can ping a remote host and can check TCP/IP port connections and server protocols. Monit is controlled via an easy to use control file based on a free-format, token-oriented syntax. Monit logs to syslog or to its own log file and notifies you about error conditions and recovery status via customizable alert.</p>
<h3>Install Monit</h3>
<p>The first, you need to enable EPEL (Extra Packages for Enterprise Linux) to install monit package. Login as root and type the following command:</p>
<pre>[root@lifelinux ~]# vi /etc/yum.repos.d/epel.repo</pre>
<p>Add or uncomment the following content at end of the file</p>
<pre>[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&amp;arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0</pre>
<p>Save and close the file. And type the following command</p>
<pre>[root@lifelinux ~]# yum clean all</pre>
<p>To install monit, type the following command</p>
<pre>[root@lifelinux ~]# yum install monit</pre>
<p>Turn on monit when system start up</p>
<pre>[root@lifelinux ~]# chkconfig --levels 235 monit on</pre>
<h3>Configure Monit</h3>
<p>The configuration file of monit in Centos or RedHat is /etc/monit.conf. Type the following command to edit</p>
<pre>[root@lifelinux ~]# vi /etc/monit.conf</pre>
<p>Sampe configuration file</p>
<pre>set daemon 60
set logfile /var/log/monit.log
set mailserver localhost
set mail-format { from: alert@domain.com
subject: $SERVICE $EVENT at $DATE
message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
}
set alert admin@domain.com
include /etc/monit.d/*</pre>
<p>Now to monitor Apache, create a file /etc/monit.d/httpd, enter</p>
<pre>[root@lifelinux ~]# vi /etc/monit.d/httpd</pre>
<p>Add following content</p>
<pre>check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout</pre>
<p>MySQL server restart configuration directives</p>
<pre>check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout</pre>
<p>SSH server configuration directives</p>
<pre>check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout</pre>
<p>Type the following command to start monit</p>
<pre>[root@lifelinux ~]# /etc/init.d/monit start</pre>
<p>You can verify that monit is started from /var/log/monit.log log file:</p>
<pre>
[root@lifelinux ~]# tail -f /var/log/monit.log
</pre>
<p>Sample ouputs</p>
<pre>[ICT May 12 14:51:18] info     : 'system_server2.domain.com' Monit started</pre>
<h3>Further readings</h3>
<p>Monit <a href="http://mmonit.com/">home page</a><br />
Monit <a href="http://mmonit.com/wiki/">documenation</a><br />
Monit <a href="http://mmonit.com/wiki/Monit/ConfigurationExamples">configuration examples</a></p>
<g:plusone href="https://lifelinux.com/how-to-install-monit-on-centos-redhat/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/how-to-install-monit-on-centos-redhat/">How To Install Monit On Centos / Redhat</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/how-to-install-monit-on-centos-redhat/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
