Skip to main content

How To Install Monit on CentOS 7 / Debian 11

What is Monit?

Monit is a free, open-source process supervision tool for Unix and Linux. With Monit, system status can be viewed directly from the command line, or via the native HTTP web server. Monit is able to do automatic maintenance, repair, and run meaningful causal actions in error situations.


How To Install Monit on CentOS 7 / Debian 11


##For CentOS 7 


yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm


yum -y install monit


##



##For Debian 11


apt-get update

apt-get -y install monit


cp /etc/monit/monitrc /etc/monit/monitrc_bkp


nano /etc/monit/monitrc


##Copy paste##


####Copy from here#####


###############################################################################

## Monit control file

###############################################################################

##

## Comments begin with a '#' and extend through the end of the line. Keywords

## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.

##

## Below you will find examples of some frequently used statements. For

## information about the control file and a complete list of statements and

## options, please have a look in the Monit manual.

##

##

###############################################################################

## Global section

###############################################################################

set daemon 120            # check services at 2-minute intervals

set logfile /var/log/monit.log

set idfile /var/lib/monit/id

set statefile /var/lib/monit/state

set mailserver localhost               # primary mailserver

set eventqueue

basedir /var/lib/monit/events # set the base directory where events will be stored

slots 100                     # optionally limit the queue size

set mail-format {

   subject: monit alert on {your servername or IP}  --  $EVENT $SERVICE

 }

set alert icallify.logs@gmail.com

include /etc/monit/conf.d/*

include /etc/monit/conf-enabled/*


## Chekck mariadb service running status

check process mysqld with pidfile /var/run/mysqld/mysql.pid

start program = "/bin/systemctl start mariadb"

stop program = "/bin/systemctl stop mariadb"

if failed host 127.0.0.1 port 3306 then restart

if 5 restarts within 5 cycles then timeout


## Check fail2ban service running status

check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid 

start program = "/bin/systemctl start fail2ban"

stop program = "/bin/systemctl stop fail2ban"


## Check asterisk service running status

check process asterisk with pidfile /var/run/asterisk/asterisk.pid  

start program = "/bin/systemctl start asterisk"

stop program  = "/bin/systemctl stop asterisk"


## Check apache service running service status

check process apache2 with pidfile /var/run/apache2/apache2.pid      

start program = "/bin/systemctl start apache2" with timeout 30 seconds

stop program  = "/bin/systemctl stop apache2"


## Check overall system performance

check system localhost

if loadavg (5min) > 8 for 4 cycles then alert

if loadavg (15min) > 8 for 4 cycles then alert

if memory usage > 80% for 4 cycles then alert

if swap usage > 20% for 4 cycles then alert

if cpu usage (user) > 80% for 4 cycles then alert

if cpu usage (system) > 20% for 4 cycles then alert

if cpu usage (wait) > 20% for 4 cycles then alert

check filesystem "root" with path /

if space usage > 80% for 1 cycles then alert




######EOF##########


#Logrotaion configuration


sed -i -e 's/weekly/size 30M/g' /etc/logrotate.d/monit


#Enable service on startup

systemctl restart monit

systemctl enable monit



Comments

Popular posts from this blog

voice broadcast in vicidial Step by Step Guide

 Follow all below mention steps:- 1.  Open https://ttsmp3.com/   2.  Select Voice Indian English 3.  Type whatever you want to convert into voice.   4.  Read and confirm and then download as a MP3.   5.  Open downloaded file with wavepad and convert into 16bit Mono 8k PCM WAV. or you can use online audio converter from below mention link. site support .wav file only so you need to convert MP3 file to wav using below mention site. https://g711.org/   6.  Upload file to vicidial audio store.   7.  Manual copy file into /var/lib/asterisk/sound/ folder using winscp software. https://winscp.net/download/WinSCP-5.21.6-Portable.zip   8.  Copy campaign from existing Broadcast camp.   9.  Click on created camp and select details view then click on survey     select Survey First Audio File:- as audio file which we created in step 1 and submit.   10. Create list and select campaign as Newly created campaign broadcast, and change routing extensions.   11. Create user with same name of remote agent

Debian 11 Vicidial scratch install dynamic portal

  Step by step guide to scratch install the vidial dynamic portal in Debian 11 or ubuntu based vicidial scratch installations. If you have installed vicidial using scratch installation instead of using the default vicibox iso then you need to manually install and configure the dynamic portal , follow this blog tutorial to scratch install the vicidial dynamic portal . Here's the steps to install and configure the vicidial dynamic portal in scratch installations. Steps to install vicidial dynamic portal cd /usr/src git clone https://github.com/manish23k/vicidial-dynamicportal.git cd vicidial-dynamicportal chmod +x vici_dynportal.sh ./vici_dynportal.sh or you can install manually. Follow the below steps to install and configure the vicidial dynamic portal in your scratch installations, Step 1: Install the firewalld and ipset apt install firewalld apt  install ipset Step 2: Download the Dynamic portal files from my Github cd /usr/src/ mkdir dynamicportal cd dynamicportal wget ht

Vicidial Scratch installation Debian 11 with Asterisk 16, WebRTC and Dynamic Portal

  Vicidial Scratch installation Debian 11  Asterisk 16, WebRTC and Dynamic Portal apt update apt upgrade apt-get install git nano wget cd /usr/src/ git clone https://github.com/manish23k/Vici_Install_Scripts_Deb_11.git cd Vici_Install_Scripts_Deb_11/ chmod +x *.sh Run ./vici_install_deb_ast16.sh Install WebRTC ./vicidial-install-webrtc.sh Once Done with Configuration Secure Server with Vici Dynamic Portal Run ./vici_dynportal.sh