Más contenido relacionado La actualidad más candente (19) Similar a PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet (20) PuppetCamp SEA @ Blk 71 - Nagios in under 10 mins with Puppet1. Nagios in <10 mins with Puppet
December 3rd, 2012
PuppetCamp SEA #2,
Singapore
Goh Choon Ming, OlinData
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' ],
}
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' ],
}
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"
}
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