X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprofile%2Fmanifests%2Fmonitoring%2Fservices.pp;h=6e59ab1f91c21937c611f2b6ed3bf93a7e5e09df;hb=6962463657db999c33f1aabe60e0567be218918d;hp=39c2deff73194733f6169153b2d65b272593f7f6;hpb=d8f933bd00a5cc416da00cd26c9d13f7a1c02486;p=perso%2FImmae%2FProjets%2FPuppet.git diff --git a/modules/profile/manifests/monitoring/services.pp b/modules/profile/manifests/monitoring/services.pp index 39c2def..6e59ab1 100644 --- a/modules/profile/manifests/monitoring/services.pp +++ b/modules/profile/manifests/monitoring/services.pp @@ -1,45 +1,14 @@ class profile::monitoring::services { - $real_hostname = lookup("base_installation::real_hostname") Nagios_service { - ensure => "present", - owner => "naemon", - group => "naemon", - target => "/etc/naemon/objects.cfg", - notify => Service["naemon"], - before => Service["naemon"], + ensure => "present", + owner => "naemon", + group => "naemon", + notify => Service["naemon"], + before => Service["naemon"], + require => File["/etc/naemon"], } - $service_generic = { - active_checks_enabled => "1", - check_freshness => "0", - check_interval => "10", - check_period => "24x7", - contact_groups => "admins", - event_handler_enabled => "1", - flap_detection_enabled => "1", - is_volatile => "0", - max_check_attempts => "3", - notification_interval => "60", - notification_options => "w,u,c,r", - notification_period => "24x7", - notifications_enabled => "1", - obsess_over_service => "1", - passive_checks_enabled => "1", - process_perf_data => "1", - retain_nonstatus_information => "1", - retain_status_information => "1", - retry_interval => "2", - } - - - $service_local = merge($service_generic, { - host_name => $real_hostname, - check_interval => "5", - max_check_attempts => "4", - retry_interval => "1", - }) - sudo::conf { default: sudo_file_name => "naemon"; @@ -47,43 +16,38 @@ class profile::monitoring::services { content => "naemon ALL=(root) NOPASSWD: /usr/bin/fail2ban-client ping"; } - nagios_service { - default: * => $service_local; + profile::monitoring::local_service { "Size on root partition": - service_description => "Size on root partition", - check_command => "check_local_disk!20%!10%!/"; + local => { + check_command => "check_local_disk!20%!10%!/", + }; "Total number of process": - service_description => "Total number of process", - check_command => "check_local_procs!250!400!RSZDT"; + local => { + check_command => "check_local_procs!50!100!RSZDT", + }; "Average load": - service_description => "Average load", - check_command => "check_local_load!8.0,8.0,8.0!10.0,10.0,10.0"; + local => { + check_command => "check_local_load!8.0,8.0,8.0!10.0,10.0,10.0", + }; "Swap usage": - service_description => "Swap usage", - check_command => "check_local_swap!20!10"; + local => { + check_command => "check_local_swap!20!10", + }; "fail2ban is active": - service_description => "fail2ban is active", - check_command => "check_command_output!fail2ban-client ping!pong!-r root", - require => Sudo::Conf["naemon-fail2ban"]; + local => { + check_command => "check_command_output!fail2ban-client ping!pong!-r root", + require => Sudo::Conf["naemon-fail2ban"], + }; "NTP is activated and working": - service_description => "NTP is activated and working", - check_command => "check_ntp"; - } - - if empty(find_file("/proc/mdstat")) { - nagios_service { - default: * => $service_local; - "No mdadm array is degraded": - ensure => "absent", - service_description => "No mdadm array is degraded", - check_command => "check_md_raid"; - } - } else { - nagios_service { - default: * => $service_local; - "No mdadm array is degraded": - service_description => "No mdadm array is degraded", - check_command => "check_md_raid"; - } + local => { + check_command => "check_ntp", + }; + "No mdadm array is degraded": + common => { + ensure => (find_file("/proc/mdstat") == undef) ? { true => "absent", default =>"present" }, + }, + local => { + check_command => "check_md_raid", + }; } }