Last active
December 19, 2015 09:09
-
-
Save richardc/5930902 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # dev_env.pp | |
| node ns38 { | |
| nagios::service { "BPL_ping": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "check_ping!100.0,20%!500.0,60%", | |
| }, | |
| } | |
| nagios::service { "BPL_load": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "ss_load", | |
| }, | |
| } | |
| nagios::service { "BPL_swap": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "ss_swap", | |
| }, | |
| } | |
| nagios::service { "BPL_mem": | |
| service_block => { | |
| check_command => "ss_mem-used", | |
| 'hostgroup_name' => 'mem', | |
| }, | |
| } | |
| } | |
| node ns39 { | |
| nagios::service { "BPL_ping": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "check_ping!100.0,20%!500.0,60%", | |
| }, | |
| } | |
| nagios::service { "BPL_load": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "ss_load", | |
| }, | |
| } | |
| nagios::service { "BPL_swap": | |
| service_block => { | |
| hostgroup_name => "bpl-servers", | |
| check_command => "ss_swap", | |
| }, | |
| } | |
| } | |
| node nagios { | |
| $baseconfigdir="/etc/nagios3/conf.d" | |
| $conf_file_srvs="services.cfg" | |
| # Nagios service collection | |
| datacat { "${baseconfigdir}/${conf_file_srvs}": | |
| template => 'nagios/services.cfg.erb', | |
| owner => "root", | |
| group => "nagios", | |
| mode => "0644", | |
| } | |
| Datacat_fragment <<| tag == "nagios_service" |>> { target => "${baseconfigdir}/${conf_file_srvs}" } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #modules/nagios/manifests/service.pp | |
| define nagios::service ($service_block) { | |
| # Service block | |
| @@datacat_fragment { "${name}_${fqdn}": | |
| tag => 'nagios_service', | |
| data => { "$name" => $service_block, }, | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nagios/services.cfg.erb | |
| <% @data.keys.sort.each do |service| -%> | |
| define service { | |
| name <%= service -%> | |
| <% @data[service].keys.sort.each do |field| %> | |
| <%= field %> <%= @data[service][field] -%> | |
| <% end %> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment