SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Nagios in <10 mins with Puppet
                December 3rd, 2012
                PuppetCamp SEA #2,
                Singapore

                Goh Choon Ming, OlinData
Setup difficulty?
Puppet made it simpler to setup
Puppet resource types
@@nagios_host   { $::fqdn:
    ensure      => present,
    address      => $::fqdn,
    use         => "generic-host",
    tag         => $domain,
  }
@@nagios_service { "check_ping_$::fqdn" :
    host_name         => $::fqdn,
    use               => "generic-service",
    check_command => "check_ping!600,20%!1000,50%",
    service_description => "check_ping",
    tag                 => $::domain,
  }
nagios_command { 'check_http_alt':
     ensure     => present,
     command_line => "/usr/lib/nagios/plugins/check_http -H
          '$HOSTADDRESS$' -p '$ARG1$' -u '$ARG2$'
-e 'HTTP/1.1 200 OK'",
   }
nagios_contact { 'choonming':
    ensure => present,
    alias => 'CM',
    email => 'choonming@olindata.com',
    host_notification_commands => 'notify-service-by-email',
    service_notification_commands => 'notify-service-by-email',
    host_notification_period => '24x7',
    service_notification_period => '24x7',
    host_notification_options    => 'd,r',
    service_notification_options => 'w,c,u,r',
  }
And many many others
http://docs.puppetlabs.com/references/stable/type.
                       html
Yet there is another problem?
What is it and how do we fix it?
Functions
Tagging
Exported resources
@@nagios_host { $::fqdn:
   address    => $::fqdn,
   use        => "generic-host",
   tag       => $::domain,
 }

Nagios_host <<| tag == 'olindata.com' |>> {
     target => '/etc/nagios3/conf.d/services.cfg',
     notify => Service[ 'nagios3' ],
  }
How to create a multi-environment Nagios setup?
Environments
if ($environment == "production" ) {
      Nagios_host <<| tag == "prod.olindata.com" |>> {
         target => "/etc/nagios3/conf.d/hosts.cfg",
         notify => Service[ 'nagios3' ],
      }

     Nagios_service <<| tag == "prod.olindata.com" |>> {
       target => "/etc/nagios3/conf.d/services.cfg",
       notify => Service[ 'nagios3' ],
    }
else {
     Nagios_host <<| tag == "test.olindata.com" |>> {
       target => "/etc/nagios3/conf.d/hosts.cfg",
       notify => Service[ 'nagios3' ],
     }

     Nagios_service <<| tag == "test.olindata.com" |>> {
       target => "/etc/nagios3/conf.d/services.cfg",
       notify => Service[ 'nagios3' ],
     }
Taking another step further with Nagios
Executing plugins on remote machines with NRPE
Defined resource types
define nagios::nrpe($command, $sudo=false) {


  $sudo_command = $sudo ? {
       true => "/usr/bin/sudo ",
       False => ' ',
   }


  file { "/etc/nagios/nrpe.d/$name.cfg":
     content => "command[$name]=$sudo_command/usr/lib/nagios/plugins/
$commandn",
     require => Package["nagios-nrpe-server"],
     notify => Service["nagios-nrpe-server"],
  }
}
@@nagios_service { "check_disk_${::fqdn}":
    check_command        => "check_nrpe_1arg!check_disk",
    use                  => "generic-service",
    host_name            => $f::qdn,
    service_description => "check_disk",
    tag                  => $::domain,
  }

nagios::nrpe { "check_disk" :
     command => "check_disk -w 20% -c 10% -l"
  }
Taking another step further with Nagios and Puppet's
              resources resource type
resources { 'nagios_host':
     purge => true,
   }

resources { 'nagios_service':
     purge => true,
   }
DEMO
Questions?
How to find me?

  Email:
  ▫ choonming[at]olindata.com


• Twitter:
  ▫ @choonming


• Github:
  ▫ https://github.com/choonming
  ▫ https://github.com/tribily


• Facebook:
  ▫ https://fb.me/olindata


• IRC:
  ▫ Freenode - choonming
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
kchodorow
 
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
Ryousei Takano
 
Huong dan cai dat hadoop
Huong dan cai dat hadoopHuong dan cai dat hadoop
Huong dan cai dat hadoop
Quỳnh Phan
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
Night Sailer
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)
MongoSF
 

Was ist angesagt? (19)

mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成mdpress(MarkDown Press)を使ったプレゼンテーション作成
mdpress(MarkDown Press)を使ったプレゼンテーション作成
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Mongo à la Resque
Mongo à la ResqueMongo à la Resque
Mongo à la Resque
 
Cache metadata
Cache metadataCache metadata
Cache metadata
 
DashProfiler 200807
DashProfiler 200807DashProfiler 200807
DashProfiler 200807
 
Huong dan cai dat hadoop
Huong dan cai dat hadoopHuong dan cai dat hadoop
Huong dan cai dat hadoop
 
Not Really PHP by the book
Not Really PHP by the bookNot Really PHP by the book
Not Really PHP by the book
 
Couchdb
CouchdbCouchdb
Couchdb
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
 
Alexander Mostovenko "Modern approach to localization in javascript with the ...
Alexander Mostovenko "Modern approach to localization in javascript with the ...Alexander Mostovenko "Modern approach to localization in javascript with the ...
Alexander Mostovenko "Modern approach to localization in javascript with the ...
 
Laporan setting dns
Laporan setting dnsLaporan setting dns
Laporan setting dns
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017
 
MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)MongoDB Replication (Dwight Merriman)
MongoDB Replication (Dwight Merriman)
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 

Andere mochten auch

Estrategias de búsqueda y recopilación de información biomédica
Estrategias de búsqueda y recopilación de información biomédicaEstrategias de búsqueda y recopilación de información biomédica
Estrategias de búsqueda y recopilación de información biomédica
Diego Rivera
 

Andere mochten auch (6)

Diapositivas twitter
Diapositivas twitterDiapositivas twitter
Diapositivas twitter
 
Estrategias de búsqueda y recopilación de información biomédica
Estrategias de búsqueda y recopilación de información biomédicaEstrategias de búsqueda y recopilación de información biomédica
Estrategias de búsqueda y recopilación de información biomédica
 
Apresentacao Multiclick Brasil - Grupo Falcon
Apresentacao Multiclick Brasil - Grupo FalconApresentacao Multiclick Brasil - Grupo Falcon
Apresentacao Multiclick Brasil - Grupo Falcon
 
Herramientas
HerramientasHerramientas
Herramientas
 
Diapositivas twitter
Diapositivas twitterDiapositivas twitter
Diapositivas twitter
 
PuppetCamp SEA @ Blk 71 - Cloud Management with Puppet
PuppetCamp SEA @ Blk 71 - Cloud Management with PuppetPuppetCamp SEA @ Blk 71 - Cloud Management with Puppet
PuppetCamp SEA @ Blk 71 - Cloud Management with Puppet
 

Ähnlich wie PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet

Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
unodelostrece
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
yiditushe
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
guoqing75
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
Kar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
diego_k
 

Ähnlich wie PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet (20)

Version Control with Puppet
Version Control with PuppetVersion Control with Puppet
Version Control with Puppet
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
CakePHP workshop
CakePHP workshopCakePHP workshop
CakePHP workshop
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
 
Understanding OpenStack Deployments - PuppetConf 2014
Understanding OpenStack Deployments - PuppetConf 2014Understanding OpenStack Deployments - PuppetConf 2014
Understanding OpenStack Deployments - PuppetConf 2014
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 

Mehr von OlinData

Mehr von OlinData (20)

AWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud CustodianAWS Cost Control: Cloud Custodian
AWS Cost Control: Cloud Custodian
 
Introduction to 2FA on AWS
Introduction to 2FA on AWSIntroduction to 2FA on AWS
Introduction to 2FA on AWS
 
AWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to GlacierAWS Data Migration case study: from tapes to Glacier
AWS Data Migration case study: from tapes to Glacier
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vault
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and Icinga
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Cfgmgmtcamp 2017 docker is the new tarball
Cfgmgmtcamp 2017  docker is the new tarballCfgmgmtcamp 2017  docker is the new tarball
Cfgmgmtcamp 2017 docker is the new tarball
 
Icinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate MonitoringIcinga 2 and Puppet - Automate Monitoring
Icinga 2 and Puppet - Automate Monitoring
 
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and OscarWebinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
Webinar - Auto-deploy Puppet Enterprise: Vagrant and Oscar
 
Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2Webinar - High Availability and Distributed Monitoring with Icinga2
Webinar - High Availability and Distributed Monitoring with Icinga2
 
Webinar - Windows Application Management with Puppet
Webinar - Windows Application Management with PuppetWebinar - Windows Application Management with Puppet
Webinar - Windows Application Management with Puppet
 
Webinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
 
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearchWebinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
 
Icinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoringIcinga 2 and puppet: automate monitoring
Icinga 2 and puppet: automate monitoring
 
Webinar - Project Management for DevOps
Webinar - Project Management for DevOpsWebinar - Project Management for DevOps
Webinar - Project Management for DevOps
 
Using puppet in a traditional enterprise
Using puppet in a traditional enterpriseUsing puppet in a traditional enterprise
Using puppet in a traditional enterprise
 
Webinar - PuppetDB
Webinar - PuppetDBWebinar - PuppetDB
Webinar - PuppetDB
 
Webinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructureWebinar - Scaling your Puppet infrastructure
Webinar - Scaling your Puppet infrastructure
 
Webinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with PuppetWebinar - Managing your Docker containers and AWS cloud with Puppet
Webinar - Managing your Docker containers and AWS cloud with Puppet
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppet
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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...
 
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...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 

PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet

  • 1. Nagios in <10 mins with Puppet December 3rd, 2012 PuppetCamp SEA #2, Singapore Goh Choon Ming, OlinData
  • 2.
  • 3.
  • 5. Puppet made it simpler to setup
  • 7. @@nagios_host { $::fqdn: ensure => present, address => $::fqdn, use => "generic-host", tag => $domain, }
  • 8. @@nagios_service { "check_ping_$::fqdn" : host_name => $::fqdn, use => "generic-service", check_command => "check_ping!600,20%!1000,50%", service_description => "check_ping", tag => $::domain, }
  • 9. nagios_command { 'check_http_alt': ensure => present, command_line => "/usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -p '$ARG1$' -u '$ARG2$' -e 'HTTP/1.1 200 OK'", }
  • 10. nagios_contact { 'choonming': ensure => present, alias => 'CM', email => 'choonming@olindata.com', host_notification_commands => 'notify-service-by-email', service_notification_commands => 'notify-service-by-email', host_notification_period => '24x7', service_notification_period => '24x7', host_notification_options => 'd,r', service_notification_options => 'w,c,u,r', }
  • 11. And many many others http://docs.puppetlabs.com/references/stable/type. html
  • 12. Yet there is another problem? What is it and how do we fix it?
  • 16. @@nagios_host { $::fqdn: address => $::fqdn, use => "generic-host", tag => $::domain, } Nagios_host <<| tag == 'olindata.com' |>> { target => '/etc/nagios3/conf.d/services.cfg', notify => Service[ 'nagios3' ], }
  • 17. How to create a multi-environment Nagios setup?
  • 19. if ($environment == "production" ) { Nagios_host <<| tag == "prod.olindata.com" |>> { target => "/etc/nagios3/conf.d/hosts.cfg", notify => Service[ 'nagios3' ], } Nagios_service <<| tag == "prod.olindata.com" |>> { target => "/etc/nagios3/conf.d/services.cfg", notify => Service[ 'nagios3' ], } else { Nagios_host <<| tag == "test.olindata.com" |>> { target => "/etc/nagios3/conf.d/hosts.cfg", notify => Service[ 'nagios3' ], } Nagios_service <<| tag == "test.olindata.com" |>> { target => "/etc/nagios3/conf.d/services.cfg", notify => Service[ 'nagios3' ], }
  • 20. Taking another step further with Nagios
  • 21. Executing plugins on remote machines with NRPE
  • 23. define nagios::nrpe($command, $sudo=false) { $sudo_command = $sudo ? { true => "/usr/bin/sudo ", False => ' ', } file { "/etc/nagios/nrpe.d/$name.cfg": content => "command[$name]=$sudo_command/usr/lib/nagios/plugins/ $commandn", require => Package["nagios-nrpe-server"], notify => Service["nagios-nrpe-server"], } }
  • 24. @@nagios_service { "check_disk_${::fqdn}": check_command => "check_nrpe_1arg!check_disk", use => "generic-service", host_name => $f::qdn, service_description => "check_disk", tag => $::domain, } nagios::nrpe { "check_disk" : command => "check_disk -w 20% -c 10% -l" }
  • 25. Taking another step further with Nagios and Puppet's resources resource type
  • 26. resources { 'nagios_host': purge => true, } resources { 'nagios_service': purge => true, }
  • 27. DEMO
  • 29. How to find me? Email: ▫ choonming[at]olindata.com • Twitter: ▫ @choonming • Github: ▫ https://github.com/choonming ▫ https://github.com/tribily • Facebook: ▫ https://fb.me/olindata • IRC: ▫ Freenode - choonming