Nagios in <10 mins with Puppet                December 3rd, 2012                PuppetCamp SEA #2,                Singapor...
Setup difficulty?
Puppet made it simpler to setup
Puppet resource types
@@nagios_host   { $::fqdn:    ensure      => present,    address      => $::fqdn,    use         => "generic-host",    tag...
@@nagios_service { "check_ping_$::fqdn" :    host_name         => $::fqdn,    use               => "generic-service",    c...
nagios_command { check_http_alt:     ensure     => present,     command_line => "/usr/lib/nagios/plugins/check_http -H    ...
nagios_contact { choonming:    ensure => present,    alias => CM,    email => choonming@olindata.com,    host_notification...
And many many othershttp://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 <...
How to create a multi-environment Nagios setup?
Environments
if ($environment == "production" ) {      Nagios_host <<| tag == "prod.olindata.com" |>> {         target => "/etc/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 =>  , ...
@@nagios_service { "check_disk_${::fqdn}":    check_command        => "check_nrpe_1arg!check_disk",    use                ...
Taking another step further with Nagios and Puppets              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  ▫ h...
Thank you!
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
PuppetCamp SEA @ Blk 71 -  Nagios in under 10 mins with Puppet
Upcoming SlideShare
Loading in …5
×

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

1,020
-1

Published on

Choon Ming, senior consultant at OlinData, gave an overview of how Puppet compliments Nagios, and how you can make Puppet work with Nagios in under 10 minutes.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,020
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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

  1. 1. Nagios in <10 mins with Puppet December 3rd, 2012 PuppetCamp SEA #2, Singapore Goh Choon Ming, OlinData
  2. 2. Setup difficulty?
  3. 3. Puppet made it simpler to setup
  4. 4. Puppet resource types
  5. 5. @@nagios_host { $::fqdn: ensure => present, address => $::fqdn, use => "generic-host", tag => $domain, }
  6. 6. @@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, }
  7. 7. 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", }
  8. 8. 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, }
  9. 9. And many many othershttp://docs.puppetlabs.com/references/stable/type. html
  10. 10. Yet there is another problem?What is it and how do we fix it?
  11. 11. Functions
  12. 12. Tagging
  13. 13. Exported resources
  14. 14. @@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 ], }
  15. 15. How to create a multi-environment Nagios setup?
  16. 16. Environments
  17. 17. 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 ], }
  18. 18. Taking another step further with Nagios
  19. 19. Executing plugins on remote machines with NRPE
  20. 20. Defined resource types
  21. 21. 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"], }}
  22. 22. @@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" }
  23. 23. Taking another step further with Nagios and Puppets resources resource type
  24. 24. resources { nagios_host: purge => true, }resources { nagios_service: purge => true, }
  25. 25. DEMO
  26. 26. Questions?
  27. 27. 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
  28. 28. Thank you!

×