<?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 monitoring tool for centos 8 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/monit-monitoring-tool-for-centos-8/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Sun, 22 Mar 2020 23:31:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install Monit on CentOS 8</title>
		<link>https://www.osradar.com/how-to-install-monit-on-centos-8/</link>
					<comments>https://www.osradar.com/how-to-install-monit-on-centos-8/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Sun, 22 Mar 2020 23:30:01 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[how to install monit on centos 8]]></category>
		<category><![CDATA[install monit on linux]]></category>
		<category><![CDATA[monit monitoring tool for centos 8]]></category>
		<category><![CDATA[monitor and manage process with monit on linux]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=18980</guid>

					<description><![CDATA[<p>Today we are going to learn that how to Install Monit on Centos 8. Before proceeding further let&#8217;s have a short introduction about Monit. What is Monit? Monit is an Open Source process tracking tool for Linux OS that helps you to monitor the processes by system. When the process is going down, it robotically [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-monit-on-centos-8/">How To Install Monit on CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Today we are going to learn that <a href="https://www.osradar.com/?p=18980">how to Install Monit on Centos 8</a>. Before proceeding further let&#8217;s have a short introduction about Monit.</p>



<h2><strong>What is Monit?</strong></h2>



<p>Monit is an Open Source process tracking tool for Linux OS that helps you to monitor the processes by system. When the process is going down, it robotically does the preservation and restore that specific process and guarantees it is introduced again on-line.<br>Monit also can be used for handling and monitoring of packages, files, directories, filesystems, TCP/IP network exams, protocol assessments, and can make use of SSL for such tests. So, follow the below steps for an easy and smooth installation of Monit on your system.</p>



<h3><strong>Step 1: Update System</strong></h3>



<p>Update your system by running</p>



<pre class="wp-block-verse">sudo yum update -y</pre>



<p>And install the required tools by typing</p>



<pre class="wp-block-verse">sudo dnf install -y git gcc glibc make glibc-devel kernel-headers autoconf automake libtool bison flex libzip-devel pam-devel openssl openssl-devel</pre>



<h3><strong>Step 2: Clone Monit</strong></h3>



<p>Fire the below command to clone the source code of Monit for compiling</p>



<pre class="wp-block-verse">git clone https://bitbucket.org/tildeslash/monit.git</pre>



<p>After this run the given commands step by step to Compile the Monit.</p>



<pre class="wp-block-verse">cd monit<br> ./bootstrap<br> ./configure<br> make<br> make install</pre>



<h3><strong>Step 3: Configuring Monit Functionality</strong></h3>



<p>First of all copy the monitrc file we&#8217;ve downloaded above to the<strong> /etc</strong> directory</p>



<pre class="wp-block-verse">sudo cp monitrc /etc/</pre>



<p>Then edit that file using any editor you prefer.</p>



<pre class="wp-block-verse">sudo nano /etc/monitrc</pre>



<p>And apply the few changes as below</p>



<p>Provide the time interval that required for the process checking by Monit. Modify it by changing the line</p>



<pre class="wp-block-verse">set daemon 30</pre>



<p>Provide the email server to get notified about the alerts in your inbox.</p>



<pre class="wp-block-verse">set mailserver mx.osradar.local port 25</pre>



<p>Note: You can also customize the alert templates. For doing so modify the configuration file.</p>



<p>Now, change the log setting by running</p>



<pre class="wp-block-verse">set log /var/log/monit.log</pre>



<p>And don&#8217;t forget to change uncomment the given line</p>



<pre class="wp-block-verse">include /etc/monit.d/*</pre>



<h3><strong>Step 4: Configuring Monit Web Interface</strong></h3>



<p>Monit also provides the Web Interface to monitor and manage the configured services with the Monit. By default, it listens to the port <strong>2812</strong>. To configure the web interface edit the <strong>/etc/monitrc</strong> file with your favorite editor.</p>



<pre class="wp-block-verse">sudo nano /etc/monitrc</pre>



<p>Then moderate the below entries </p>



<p>From </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="835" height="133" src="https://www.osradar.com/wp-content/uploads/2020/03/1-14.png" alt="" class="wp-image-19145" srcset="https://www.osradar.com/wp-content/uploads/2020/03/1-14.png 835w, https://www.osradar.com/wp-content/uploads/2020/03/1-14-300x48.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/1-14-768x122.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/1-14-696x111.png 696w" sizes="(max-width: 835px) 100vw, 835px" /></figure></div>



<p>To:</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="830" height="138" src="https://www.osradar.com/wp-content/uploads/2020/03/2-16.png" alt="" class="wp-image-19146" srcset="https://www.osradar.com/wp-content/uploads/2020/03/2-16.png 830w, https://www.osradar.com/wp-content/uploads/2020/03/2-16-300x50.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/2-16-768x128.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/2-16-696x116.png 696w" sizes="(max-width: 830px) 100vw, 830px" /></figure></div>



<p>By doing these setting, Monit will be able to listen to all the interfaces on port 2812. Only the administrator will be able to access the Web based dashboard.</p>



<h3><strong>Step 5: Configuring Systemd For Monit</strong></h3>



<p>As to start Monit automatically on boot, create a new configuration file for systemd</p>



<pre class="wp-block-verse">sudo nano /lib/systemd/system/monit.service</pre>



<p>Then paste the below data into the file</p>



<pre class="wp-block-verse">This file is systemd template for monit service. To<br> # register monit with systemd, place the monit.service file<br>  # to the /lib/systemd/system/ directory and then start it<br>  # using systemctl (see below).<br>  #<br>  # Enable monit to start on boot:<br>  #         systemctl enable monit.service<br>  #<br>  # Start monit immediately:<br>  #         systemctl start monit.service<br>  #<br>  # Stop monit:<br>  #         systemctl stop monit.service<br>  #<br>  # Status:<br>  #         systemctl status monit.service<br> [Unit]<br>  Description=Pro-active monitoring utility for unix systems<br>  After=network.target<br>  Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo<br> [Service]<br>  Type=simple<br>  KillMode=process<br>  ExecStart=/usr/local/bin/monit -I<br>  ExecStop=/usr/local/bin/monit quit<br>  ExecReload=/usr/local/bin/monit reload<br>  Restart = on-abnormal<br>  StandardOutput=null<br> [Install]<br>  WantedBy=multi-user.target</pre>



<p>Then reload the systemd daemon</p>



<pre class="wp-block-verse">sudo systemctl daemon-reload</pre>



<p>And start &amp; enable the systemd services.</p>



<pre class="wp-block-verse">sudo systemctl start monit<br>sudo systemctl enable monit</pre>



<h3><strong>Step 6: Allow Firewall Access</strong></h3>



<p>Give permissions Monit web interface through firewall by typing</p>



<pre class="wp-block-verse">firewall-cmd --permanent --add-port=2812/tcp<br>firewall-cmd --reload</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="791" height="386" src="https://www.osradar.com/wp-content/uploads/2020/03/3-16.png" alt="How To Install Monit on CentOS 8" class="wp-image-19149" srcset="https://www.osradar.com/wp-content/uploads/2020/03/3-16.png 791w, https://www.osradar.com/wp-content/uploads/2020/03/3-16-300x146.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/3-16-768x375.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/3-16-533x261.png 533w, https://www.osradar.com/wp-content/uploads/2020/03/3-16-696x340.png 696w" sizes="(max-width: 791px) 100vw, 791px" /></figure></div>



<h3><strong>Step 7: Accessing Monit Web Dashboard</strong></h3>



<p>Go to your browser &amp; type <strong>127.0.0.1:2812/</strong></p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="799" height="603" src="https://www.osradar.com/wp-content/uploads/2020/03/4-12.png" alt="How To Install Monit on CentOS 8" class="wp-image-19150" srcset="https://www.osradar.com/wp-content/uploads/2020/03/4-12.png 799w, https://www.osradar.com/wp-content/uploads/2020/03/4-12-300x226.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/4-12-768x580.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/4-12-80x60.png 80w, https://www.osradar.com/wp-content/uploads/2020/03/4-12-696x525.png 696w, https://www.osradar.com/wp-content/uploads/2020/03/4-12-557x420.png 557w" sizes="(max-width: 799px) 100vw, 799px" /></figure></div>



<p>Provide the credential details as <strong>admin</strong> <strong>admin</strong> (or use whatever you&#8217;ve given in step 4).</p>



<p>Then click on the OK button and you will be redirected to the Homepage of Monit.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1024" height="486" src="https://www.osradar.com/wp-content/uploads/2020/03/5-13-1024x486.png" alt="How To Install Monit on CentOS 8" class="wp-image-19151" srcset="https://www.osradar.com/wp-content/uploads/2020/03/5-13-1024x486.png 1024w, https://www.osradar.com/wp-content/uploads/2020/03/5-13-300x142.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/5-13-768x364.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/5-13-696x330.png 696w, https://www.osradar.com/wp-content/uploads/2020/03/5-13-1068x507.png 1068w, https://www.osradar.com/wp-content/uploads/2020/03/5-13-886x420.png 886w, https://www.osradar.com/wp-content/uploads/2020/03/5-13.png 1362w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>Here you can see the configured services.</p>



<h3><strong>Step 8: Configuring Services with Monit for Monitoring &amp; Managing</strong></h3>



<p>First of all create a new directory</p>



<pre class="wp-block-verse">sudo mkdir /etc/monit.d/</pre>



<p>Then configure the services for syslog</p>



<pre class="wp-block-verse">sudo nano /etc/monit.d/syslogmonitor</pre>



<p>And paste the below info.</p>



<pre class="wp-block-verse">check process SysLog with pidfile /var/run/rsyslogd.pid<br> start program = "/usr/bin/systemctl start rsyslog.service"<br> stop program = "/usr/bin/systemctl stop rsyslog.service"</pre>



<p>Edit the file <strong>/etc/monit.d/httpdmonitor</strong> for configuring the HTTP services.</p>



<pre class="wp-block-verse">sudo nano /etc/monit.d/httpdmonitor</pre>



<p>And modify the changes like this</p>



<pre class="wp-block-verse">check process HTTPD with pidfile /var/run/httpd/httpd.pid<br>start program "/usr/bin/systemctl start httpd.service"<br>stop program "/usr/bin/systemctl stop httpd.service"<br>if failed port 80 protocol http then restart</pre>



<p>After doing all these settings, verify the Monit syntax by</p>



<pre class="wp-block-verse">monit -t</pre>



<p>Now, reload the Monit to take the effect of changes.</p>



<pre class="wp-block-verse">sudo systemctl reload monit</pre>



<p>Now, again go to the Web Dashboard to see if the services, we&#8217;ve configured are showing.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1024" height="429" src="https://www.osradar.com/wp-content/uploads/2020/03/6-12-1024x429.png" alt="How To Install Monit on CentOS 8" class="wp-image-19155" srcset="https://www.osradar.com/wp-content/uploads/2020/03/6-12-1024x429.png 1024w, https://www.osradar.com/wp-content/uploads/2020/03/6-12-300x126.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/6-12-768x321.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/6-12-696x291.png 696w, https://www.osradar.com/wp-content/uploads/2020/03/6-12-1068x447.png 1068w, https://www.osradar.com/wp-content/uploads/2020/03/6-12-1004x420.png 1004w, https://www.osradar.com/wp-content/uploads/2020/03/6-12.png 1362w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>When you click on the any listed service, it will give you the information in details.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1024" height="465" src="https://www.osradar.com/wp-content/uploads/2020/03/7-8-1024x465.png" alt="How To Install Monit on CentOS 8" class="wp-image-19154" srcset="https://www.osradar.com/wp-content/uploads/2020/03/7-8-1024x465.png 1024w, https://www.osradar.com/wp-content/uploads/2020/03/7-8-300x136.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/7-8-768x349.png 768w, https://www.osradar.com/wp-content/uploads/2020/03/7-8-696x316.png 696w, https://www.osradar.com/wp-content/uploads/2020/03/7-8-1068x485.png 1068w, https://www.osradar.com/wp-content/uploads/2020/03/7-8-925x420.png 925w, https://www.osradar.com/wp-content/uploads/2020/03/7-8.png 1356w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>Here you can perform various functions like start, stop, restart or disable these services.</p>



<h3><strong>Step 9: Testing the Monitoring</strong></h3>



<p>First of all stop the http service for testing purposes.</p>



<pre class="wp-block-verse">sudo systemctl stop httpd</pre>



<p>After 30s type this command to check the logs</p>



<pre class="wp-block-verse">cat /var/log/monit.log</pre>



<p>Ouput:]</p>



<pre class="wp-block-verse">EDT Mar 19 13:01:49] error    : 'HTTPD' process is not running<br> [EDT Mar 19 13:01:49] info     : 'HTTPD' trying to restart<br> [EDT Mar 19 13:01:49] info     : 'HTTPD' start: '/usr/bin/systemctl start httpd.service'</pre>



<p>Type the command to edit the configuration</p>



<pre class="wp-block-verse">sudo nano /etc/monitrc</pre>



<p>Set the alert template like this according to your requirements.</p>



<pre class="wp-block-verse">set mail-format {<br>   from:    Monit <br>   subject: monit alert --  $EVENT $SERVICE<br>   message: $EVENT Service $SERVICE<br>                 Date:        $DATE<br>                 Action:      $ACTION<br>                 Host:        $HOST<br>                 Description: $DESCRIPTION<br>Your faithful employee ,       monit<br> }</pre>



<p>Now, set the recipient address to get notified of all actions.</p>



<pre class="wp-block-verse">set alert root@localhost</pre>



<p>And set the recipient address for not alerting on user initiated service restarts.</p>



<pre class="wp-block-verse">set alert root@localhost not on { instance, action }</pre>



<p>Then finally, set up the email server in order to receive emails.</p>



<pre class="wp-block-verse">set mailserver localhost</pre>



<p>As I&#8217;ve installed the local relay in order to read email from terminal you can also do so or set up your own email server.</p>



<pre class="wp-block-verse">dnf install -y sendmail &amp;&amp; systemctl start sendmail</pre>



<p>Reload the services </p>



<pre class="wp-block-verse">sudo systemctl reload monit</pre>



<p>Now, you can see the email alerts by running</p>



<pre class="wp-block-verse">cat /var/spool/mail/root</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="717" height="437" src="https://www.osradar.com/wp-content/uploads/2020/03/9-5.png" alt="How To Install Monit on CentOS 8" class="wp-image-19157" srcset="https://www.osradar.com/wp-content/uploads/2020/03/9-5.png 717w, https://www.osradar.com/wp-content/uploads/2020/03/9-5-300x183.png 300w, https://www.osradar.com/wp-content/uploads/2020/03/9-5-696x424.png 696w, https://www.osradar.com/wp-content/uploads/2020/03/9-5-689x420.png 689w" sizes="(max-width: 717px) 100vw, 717px" /></figure></div>



<p>You can also install the mutt, an email client to view alerts by running</p>



<pre class="wp-block-verse">dnf install -y mutt</pre>



<p>So, this is how you can Install Monit on Your CentOS system and easily Monitor and Manage the process.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-monit-on-centos-8/">How To Install Monit on CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-monit-on-centos-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
