SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Monit
Keeping UNIX Deployments
Monitor & Manage
   System Resources
       Processes
         Files
      Directories
        Devices
   Network Services
Take Action!
alert   Send an alert
restart Stop then start a
        process
start   Start a process
stop    Stop a process
exec    Execute arbitrary
        program
unmonit Disable monitoring
or
timeout Disable monitoring
Prerequisites
             UN*X
Start/Stop Scripts for Processes
     Mail Server for Alerts
Configure
~/.monitrc
/etc/monitrc
/usr/local/etc/monitrc
~/monitrc


$ monit -c /etc/monit/monitrc
$ monit -t
Configure
## /etc/monit/monitrc
set daemon 120
set logfile /var/log/monit.log


set alert alert@brianturnbull.com


set mail-format {
    from: monit@brianturnbull.com
    subject: $SERVICE service - $EVENT
    message: $ACTION $SERVICE on $HOST: $DESCRIPTION
}


set mailserver localhost port 25


set httpd port 8877
    allow monit:passwd


include /etc/monit/monit.d/*
Monitor
## /etc/monit/monit.d/apache
check process apache with pidfile /var/run/apache2.pid
 start program = quot;/etc/init.d/apache2 startquot;
 stop program   = quot;/etc/init.d/apache2 stopquot;
 if failed host localhost port 80 protocol http then restart
 if 2 restarts within 3 cycles then timeout


## /etc/monit/monit.d/sshd
check process sshd with pidfile /var/run/sshd.pid
 start program = quot;/etc/init.d/ssh startquot;
 stop program   = quot;/etc/init.d/ssh stopquot;
 if failed port 22 protocol ssh then restart
 if 5 restarts within 5 cycles then timeout
Monitor Files
## /etc/monit/monit.d/apache_log
check file access.log with path /var/log/apache2/access.log
  if size > 100Mb
    then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot;


check file error.log with path /var/log/apache2/error.log
  if size > 100Mb
    then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot;
Monitor Directories
## /etc/monit/monit.d/sbin
check directory sbin with path /sbin
  if changed timestamp then alert


check directory sbin-usr with path /usr/sbin
  if changed timestamp then alert
Monitor Devices
## /etc/monit/monit.d/disks
check device sda1 with path /dev/sda1
 if space usage > 90% then alert
 if inode usage > 90% then alert
Monitor Resources
## /etc/monit/monit.d/system
check system brianturnbull.com
 if loadavg (1min) > 4 then alert
 if loadavg (5min) > 2 then alert
 if memory usage > 75% then alert
 if cpu usage (user) > 70% then alert
 if cpu usage (system) > 30% then alert
 if cpu usage (wait) > 20% then alert
Monitor Services
## /etc/monit/monit.d/apache
check process apache with pidfile /var/run/apache2.pid
  start program = quot;/etc/init.d/apache2 startquot;
  stop program   = quot;/etc/init.d/apache2 stopquot;
  if failed host localhost port 80 protocol http then restart
  if 2 restarts within 3 cycles then timeout


## /etc/monit/monit.d/mail
check host mail.brianturnbull.com with address mail.brianturnbull.com
  if failed port 25
    expect “^220.*rn”
    send “HELO brianturnbull.com
    expect “^250.*rn”
    send “QUIT.*rn”
    expect “^221.*rn”
      then alert
Dependancies
## /etc/monit/monit.d/apache
check process apache with pidfile /var/run/apache2.pid
  group www
  start program = quot;/etc/init.d/apache2 startquot;
  stop program   = quot;/etc/init.d/apache2 stopquot;
  if 2 restarts within 3 cycles then timeout
  if failed host localhost port 80 protocol http then restart
  depends on apache_bin
  depends on apache_rc


check file apache_bin with path /usr/sbin/apache2
  group www
  if failed checksum then unmonitor
  if failed permission 755 then unmonitor
  if failed uid root then unmonitor
  if failed gid root then unmonitor


check file apache_rc with path /etc/init.d/apache2
  group www
  if failed checksum then unmonitor
  if failed permission 755 then unmonitor
  if failed uid root then unmonitor
  if failed gid root then unmonitor
More Info
 & Examples
http://mmonit.com/monit




  Thank You
http://brianturnbull.com

Weitere ähnliche Inhalte

Was ist angesagt?

How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 
Any event intro
Any event introAny event intro
Any event introqiang
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)xSawyer
 
NSClient Workshop: 04 Protocols
NSClient Workshop: 04 ProtocolsNSClient Workshop: 04 Protocols
NSClient Workshop: 04 ProtocolsMichael Medin
 
Linux processes control and monitoring
Linux processes control and monitoringLinux processes control and monitoring
Linux processes control and monitoringalex_schemelev
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin Davide Cioccia
 
NSClient++ Workshop: 01 Introduction
NSClient++ Workshop: 01 IntroductionNSClient++ Workshop: 01 Introduction
NSClient++ Workshop: 01 IntroductionMichael Medin
 
Безопасность интернет-приложений осень 2013 лекция 7
Безопасность интернет-приложений осень 2013 лекция 7Безопасность интернет-приложений осень 2013 лекция 7
Безопасность интернет-приложений осень 2013 лекция 7Technopark
 
Perl: Coro asynchronous
Perl: Coro asynchronous Perl: Coro asynchronous
Perl: Coro asynchronous Shmuel Fomberg
 
Study2study#4 nginx conf_1_24
Study2study#4 nginx conf_1_24Study2study#4 nginx conf_1_24
Study2study#4 nginx conf_1_24Naoya Nakazawa
 
Lamp configuration u buntu 10.04
Lamp configuration   u buntu 10.04Lamp configuration   u buntu 10.04
Lamp configuration u buntu 10.04mikehie
 
5 Vampir Configuration At IU
5 Vampir Configuration At IU5 Vampir Configuration At IU
5 Vampir Configuration At IUPTIHPA
 
A little systemtap
A little systemtapA little systemtap
A little systemtapyang bingwu
 
Sockets in nach0s
Sockets in nach0sSockets in nach0s
Sockets in nach0snaniix21_3
 
Cell processor lab
Cell processor labCell processor lab
Cell processor labcoolmirza143
 

Was ist angesagt? (20)

How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
Any event intro
Any event introAny event intro
Any event intro
 
Monit
MonitMonit
Monit
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
NSClient Workshop: 04 Protocols
NSClient Workshop: 04 ProtocolsNSClient Workshop: 04 Protocols
NSClient Workshop: 04 Protocols
 
Linux processes control and monitoring
Linux processes control and monitoringLinux processes control and monitoring
Linux processes control and monitoring
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
 
NSClient++ Workshop: 01 Introduction
NSClient++ Workshop: 01 IntroductionNSClient++ Workshop: 01 Introduction
NSClient++ Workshop: 01 Introduction
 
Безопасность интернет-приложений осень 2013 лекция 7
Безопасность интернет-приложений осень 2013 лекция 7Безопасность интернет-приложений осень 2013 лекция 7
Безопасность интернет-приложений осень 2013 лекция 7
 
Perl: Coro asynchronous
Perl: Coro asynchronous Perl: Coro asynchronous
Perl: Coro asynchronous
 
Study2study#4 nginx conf_1_24
Study2study#4 nginx conf_1_24Study2study#4 nginx conf_1_24
Study2study#4 nginx conf_1_24
 
Lamp configuration u buntu 10.04
Lamp configuration   u buntu 10.04Lamp configuration   u buntu 10.04
Lamp configuration u buntu 10.04
 
5 Vampir Configuration At IU
5 Vampir Configuration At IU5 Vampir Configuration At IU
5 Vampir Configuration At IU
 
Docker: ao vivo e a cores
Docker: ao vivo e a coresDocker: ao vivo e a cores
Docker: ao vivo e a cores
 
Ethical hacking with Python tools
Ethical hacking with Python toolsEthical hacking with Python tools
Ethical hacking with Python tools
 
A little systemtap
A little systemtapA little systemtap
A little systemtap
 
59
5959
59
 
Sockets in nach0s
Sockets in nach0sSockets in nach0s
Sockets in nach0s
 
Cell processor lab
Cell processor labCell processor lab
Cell processor lab
 

Andere mochten auch (6)

Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009
 
Peer Advising Wiki Tutorial
Peer Advising Wiki TutorialPeer Advising Wiki Tutorial
Peer Advising Wiki Tutorial
 
Go Ahead, Get Close; Commit to Customer Relationships through Direct Response
Go Ahead, Get Close; Commit to Customer Relationships through Direct ResponseGo Ahead, Get Close; Commit to Customer Relationships through Direct Response
Go Ahead, Get Close; Commit to Customer Relationships through Direct Response
 
Four Bear Advisors Presentation, Spring 2012
Four Bear Advisors Presentation, Spring 2012Four Bear Advisors Presentation, Spring 2012
Four Bear Advisors Presentation, Spring 2012
 
RVM - NHRuby Nov 2009
RVM - NHRuby Nov 2009RVM - NHRuby Nov 2009
RVM - NHRuby Nov 2009
 
OOP Intro in Ruby for NHRuby Feb 2010
OOP Intro in Ruby for NHRuby Feb 2010OOP Intro in Ruby for NHRuby Feb 2010
OOP Intro in Ruby for NHRuby Feb 2010
 

Ähnlich wie Monit - NHRuby May 2009

Proactive monitoring with Monit
Proactive monitoring with MonitProactive monitoring with Monit
Proactive monitoring with MonitOSOCO
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...addame
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service managementA journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service managementLubomir Rintel
 
Document Management: Opendocman and LAMP installation on Cent OS
Document Management: Opendocman and LAMP installation on Cent OSDocument Management: Opendocman and LAMP installation on Cent OS
Document Management: Opendocman and LAMP installation on Cent OSSiddharth Ram Dinesh
 
OpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial DayOpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial DayJoshua McKenty
 

Ähnlich wie Monit - NHRuby May 2009 (20)

Proactive monitoring with Monit
Proactive monitoring with MonitProactive monitoring with Monit
Proactive monitoring with Monit
 
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
Montreal On Rails 5 : Rails deployment using : Nginx, Mongrel, Mongrel_cluste...
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service managementA journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service management
 
Document Management: Opendocman and LAMP installation on Cent OS
Document Management: Opendocman and LAMP installation on Cent OSDocument Management: Opendocman and LAMP installation on Cent OS
Document Management: Opendocman and LAMP installation on Cent OS
 
OpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial DayOpenStack Swift - MSST 2011 Tutorial Day
OpenStack Swift - MSST 2011 Tutorial Day
 
Toby3
Toby3Toby3
Toby3
 
xxxx
xxxxxxxx
xxxx
 
yyyyxxxdd
yyyyxxxddyyyyxxxdd
yyyyxxxdd
 
new title
new titlenew title
new title
 
yyyyxxx
yyyyxxxyyyyxxx
yyyyxxx
 
Tinoub1
Tinoub1Tinoub1
Tinoub1
 
yyyyxxxdd
yyyyxxxddyyyyxxxdd
yyyyxxxdd
 
Toby2
Toby2Toby2
Toby2
 
yyyyxxx
yyyyxxxyyyyxxx
yyyyxxx
 
Monit a1
Monit a1Monit a1
Monit a1
 
Tinoub1
Tinoub1Tinoub1
Tinoub1
 
Toby5
Toby5Toby5
Toby5
 
Monit a2
Monit a2Monit a2
Monit a2
 
yyyyxxx
yyyyxxxyyyyxxx
yyyyxxx
 
Toby7
Toby7Toby7
Toby7
 

Kürzlich hochgeladen

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

Monit - NHRuby May 2009

  • 2. Monitor & Manage System Resources Processes Files Directories Devices Network Services
  • 3. Take Action! alert Send an alert restart Stop then start a process start Start a process stop Stop a process exec Execute arbitrary program unmonit Disable monitoring or timeout Disable monitoring
  • 4. Prerequisites UN*X Start/Stop Scripts for Processes Mail Server for Alerts
  • 6. Configure ## /etc/monit/monitrc set daemon 120 set logfile /var/log/monit.log set alert alert@brianturnbull.com set mail-format { from: monit@brianturnbull.com subject: $SERVICE service - $EVENT message: $ACTION $SERVICE on $HOST: $DESCRIPTION } set mailserver localhost port 25 set httpd port 8877 allow monit:passwd include /etc/monit/monit.d/*
  • 7. Monitor ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if failed host localhost port 80 protocol http then restart if 2 restarts within 3 cycles then timeout ## /etc/monit/monit.d/sshd check process sshd with pidfile /var/run/sshd.pid start program = quot;/etc/init.d/ssh startquot; stop program = quot;/etc/init.d/ssh stopquot; if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout
  • 8. Monitor Files ## /etc/monit/monit.d/apache_log check file access.log with path /var/log/apache2/access.log if size > 100Mb then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot; check file error.log with path /var/log/apache2/error.log if size > 100Mb then exec quot;/usr/sbin/logrotate -f /etc/logrotate.d/apache2quot;
  • 9. Monitor Directories ## /etc/monit/monit.d/sbin check directory sbin with path /sbin if changed timestamp then alert check directory sbin-usr with path /usr/sbin if changed timestamp then alert
  • 10. Monitor Devices ## /etc/monit/monit.d/disks check device sda1 with path /dev/sda1 if space usage > 90% then alert if inode usage > 90% then alert
  • 11. Monitor Resources ## /etc/monit/monit.d/system check system brianturnbull.com if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 75% then alert if cpu usage (user) > 70% then alert if cpu usage (system) > 30% then alert if cpu usage (wait) > 20% then alert
  • 12. Monitor Services ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if failed host localhost port 80 protocol http then restart if 2 restarts within 3 cycles then timeout ## /etc/monit/monit.d/mail check host mail.brianturnbull.com with address mail.brianturnbull.com if failed port 25 expect “^220.*rn” send “HELO brianturnbull.com expect “^250.*rn” send “QUIT.*rn” expect “^221.*rn” then alert
  • 13. Dependancies ## /etc/monit/monit.d/apache check process apache with pidfile /var/run/apache2.pid group www start program = quot;/etc/init.d/apache2 startquot; stop program = quot;/etc/init.d/apache2 stopquot; if 2 restarts within 3 cycles then timeout if failed host localhost port 80 protocol http then restart depends on apache_bin depends on apache_rc check file apache_bin with path /usr/sbin/apache2 group www if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor check file apache_rc with path /etc/init.d/apache2 group www if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor
  • 14. More Info & Examples http://mmonit.com/monit Thank You http://brianturnbull.com