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"],
- }
-
- $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",
- }
+ $warn_1_load = 1.5*$facts["processorcount"]
+ $warn_5_load = $facts["processorcount"]
+ $warn_15_load = $facts["processorcount"]
+ $warn_load = join([$warn_1_load, $warn_5_load, $warn_15_load], ",")
- $service_local = merge($service_generic, {
- host_name => $real_hostname,
- check_interval => "5",
- max_check_attempts => "4",
- retry_interval => "1",
- })
+ $max_1_load = 2*$facts["processorcount"]
+ $max_5_load = $facts["processorcount"]
+ $max_15_load = $facts["processorcount"]
+ $max_load = join([$max_1_load, $max_5_load, $max_15_load], ",")
- sudo::conf {
- default:
- sudo_file_name => "naemon";
- 'naemon-fail2ban':
- 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!$warn_load!$max_load",
+ };
"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"];
+ sudos => {
+ "naemon-fail2ban" => "naemon ALL=(root) NOPASSWD: /usr/bin/fail2ban-client ping",
+ },
+ local => {
+ check_command => "check_command_output!fail2ban-client ping!pong!-r root",
+ };
"NTP is activated and working":
- service_description => "NTP is activated and working",
- check_command => "check_ntp";
+ master => {
+ check_interval => "60",
+ freshness_threshold => Integer(60*60*1.5),
+ },
+ local => {
+ check_command => "check_ntp",
+ check_interval => "60"
+ };
+ "No mdadm array is degraded":
+ common => {
+ ensure => (find_file("/proc/mdstat") == undef) ? { true => "absent", default =>"present" },
+ },
+ local => {
+ check_command => "check_md_raid",
+ };
}
- 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";
- }
- }
+ Profile::Monitoring::Local_service <| |>
+ Profile::Monitoring::External_service <| |>
}