404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
# File 'manifests/params.pp', line 404
class confdroid_nagios::params (
# main
String $ng_nagios_server = 'nagios.example.net',
Array $ng_reqpackages_server = ['nagios','nagios-devel'],
Array $ng_reqpackages_client = ['net-snmp-utils','nagios-plugins','nagios-plugins-all','nagios-plugins-nrpe','nagios-common'],
String $ng_pkg_ensure = 'present',
Boolean $ng_include_nrpe = true,
# user
String $ng_user = 'nagios',
String $ng_u_comment = 'Nagios User',
String $ng_u_groups = 'nagios',
String $ng_u_shell = '/sbin/nologin',
String $ng_u_home = '/home/nagios',
Integer $ng_u_uid = 1004,
# nagios_cfg settings
String $ng_log_file = '/var/log/nagios/nagios.log',
String $ng_object_cache_file = '/var/spool/nagios/objects.cache',
String $ng_precached_obj_file = '/var/spool/nagios/objects.precache',
String $ng_resource_file = '/etc/nagios/private/resource.cfg',
String $ng_status_file = '/var/log/nagios/status.dat',
String $ng_status_upd_interval = '10',
String $ng_check_ext_commands = '1',
String $ng_command_file = '/var/spool/nagios/cmd/nagios.cmd',
String $ng_lock_file = '/var/run/nagios/nagios.pid',
String $ng_temp_file = '/var/spool/nagios/nagios.tmp',
String $ng_temp_path = '/tmp',
String $ng_event_broker_options = '-1',
String $ng_event_broker_module = '',
String $ng_glob_host_evt_handler = '',
String $ng_glob_svc_evt_handler = '',
String $ng_check_workers = '',
String $ng_log_rotation_method = 'h',
String $ng_log_archive_path = '/var/log/nagios/archives',
String $ng_use_syslog = '1',
String $ng_log_notifications = '1',
String $ng_log_service_retries = '1',
String $ng_log_host_retries = '1',
String $ng_log_event_handlers = '1',
String $ng_log_initial_states = '0',
String $ng_log_current_states = '1',
String $ng_log_external_commands = '1',
String $ng_log_passive_checks = '1',
String $ng_glob_host_evt_handler = '',
String $ng_glob_svc_evt_handler = '',
String $ng_svc_int_check_delay = 's',
String $ng_max_svc_check_spread = '30',
String $ng_svc_interleave_factor = 's',
String $ng_host_int_check_delay = 's',
String $ng_max_host_check_spread = '30',
String $ng_max_concurrent_checks = '0',
String $ng_check_res_reaper_freq = '10',
String $ng_max_check_res_reap_time = '30',
String $ng_check_result_path = '/var/spool/nagios/checkresults',
String $ng_max_check_res_file_age = '3600',
String $ng_cached_h_check_horizon = '15',
String $ng_cached_s_check_horizon = '15',
String $ng_pred_host_dep_checks = '1',
String $ng_pred_svc_dep_checks = '1',
String $ng_soft_state_dependencies = '0',
String $ng_time_change_threshold = '900',
String $ng_auto_reschedule_checks = '0',
String $ng_auto_reschedule_intval = '30',
String $ng_auto_reschedule_window = '180',
String $ng_service_check_timeout = '60',
String $ng_host_check_timeout = '30',
String $ng_event_handler_timeout = '30',
String $ng_notification_timeout = '30',
String $ng_ocsp_timeout = '5',
String $ng_perfdata_timeout = '5',
String $ng_retain_state_inf = '1',
String $ng_state_retention_file = '/var/spool/nagios/retention.dat',
String $ng_retention_update_intval = '60',
String $ng_use_ret_program_state = '1',
String $ng_use_ret_scheduling_info = '1',
String $ng_ret_host_attr_mask = '0',
String $ng_ret_service_attr_mask = '0',
String $ng_ret_proc_host_attr_mask = '0',
String $ng_ret_proc_svc_attr_mask = '0',
String $ng_ret_contact_h_attr_mask = '0',
String $ng_ret_contact_s_attr_mask = '0',
String $ng_interval_length = '60',
String $ng_check_for_updates = '1',
String $ng_bare_update_check = '0',
String $ng_use_aggr_host_checking = '0',
String $ng_execute_service_checks = '1',
String $ng_accept_pass_svc_checks = '1',
String $ng_execute_host_checks = '1',
String $ng_accept_pass_host_checks = '1',
String $ng_enable_notifications = '1',
String $ng_enable_event_handlers = '1',
String $ng_process_perf_data = '0',
String $ng_host_perfdata_command = 'process-host-perfdata',
String $ng_svc_perfdata_command = 'process-service-perfdata',
String $ng_host_perfdata_file = '/var/spool/nagios/host-perfdata',
String $ng_service_perfdata_file = '/var/spool/nagios/service-perfdata',
String $ng_host_perfdata_template = '[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$',
String $ng_svc_perfdata_template = '[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$',
String $ng_host_perfdata_file_mode = 'a',
String $ng_svc_perfdata_file_mode = 'a',
String $ng_h_perfdata_proc_intval = '0',
String $ng_s_perfdata_proc_intval = '0',
String $ng_h_perfdata_proc_cmd = 'process-host-perfdata-file',
String $ng_s_perfdata_proc_cmd = 'process-service-perfdata-file',
String $ng_h_perfdata_proc_e_res = '1',
String $ng_s_perfdata_proc_e_res = '1',
String $ng_obsess_over_services = '0',
String $ng_ocsp_command = '',
String $ng_obsess_over_hosts = '0',
String $ng_ochp_command = '',
String $ng_translate_pass_h_checks = '0',
String $ng_pass_h_checks_are_soft = '0',
String $ng_check_orphaned_svc = '1',
String $ng_check_orphaned_hosts = '1',
String $ng_check_service_freshness = '1',
String $ng_svc_fresh_check_intval = '60',
String $ng_svc_check_timeout_state = 'c',
String $ng_check_host_freshness = '0',
String $ng_host_fresh_check_intval = '60',
String $ng_add_freshness_latency = '15',
String $ng_enable_flap_detection = '1',
String $ng_low_svc_flap_threshold = '5.0',
String $ng_high_svc_flap_threshold = '20.0',
String $ng_low_h_flap_threshold = '5.0',
String $ng_high_h_flap_threshold = '20.0',
String $ng_date_format = 'us',
Boolean $ng_use_timezone_offset = false,
String $ng_use_timezone = '',
String $ng_illegal_obj_name_chars = '`~!$%^&*|\'"<>?,()=',
String $ng_ill_macro_output_chars = '`~$&|\'"<>',
String $ng_use_regexp_matching = '0',
String $ng_true_regexp_matching = '0',
String $ng_daemon_dumps_core = '0',
String $ng_use_large_inst_tweaks = '0',
String $ng_enable_env_macros = '0',
String $ng_free_child_process_mem = '1',
String $ng_child_proc_fork_twice = '1',
String $ng_debug_level = '0',
String $ng_debug_verbosity = '1',
String $ng_debug_file = '/var/spool/nagios/nagios.debug',
String $ng_max_debug_file_size = '1000000',
String $ng_allow_empty_hostgroups = '0',
String $ng_check_workers = '',
String $ng_host_down_svc_checks = '0',
Boolean $ng_enable_load_ctl_options = false,
String $ng_loadctl_options = 'jobs_max=100;backoff_limit=10;rampup_change=5',
# httpd
Boolean $ng_use_https = false,
) {
# Default facts
$fqdn = $facts['networking']['fqdn']
$domain = $facts['networking']['domain']
$os_name = $facts['os']['name']
$os_release = $facts['os']['release']['major']
# service
$ng_nagios_service = 'nagios'
# directories
$ng_main_dir = '/etc/nagios'
$ng_conf_d_dir = "${ng_main_dir}/conf.d"
$ng_objects_dir = "${ng_main_dir}/objects"
$ng_private_dir = "${ng_main_dir}/private"
$ng_usr_incl = '/usr/include/nagios'
$ng_lib_dir = '/usr/lib64/nagios'
$ng_log_dir = '/var/log/nagios'
$ng_log_archives = "${ng_log_dir}/archives"
$ng_spool_dir = '/var/spool/nagios'
$ng_usr_share = '/usr/share/nagios'
$ng_share_html = "${ng_usr_share}/html"
$ng_run_dir = '/var/run/nagios'
$ng_cmd_dir = "${ng_spool_dir}/cmd"
$ng_checkresults_dir = "${ng_spool_dir}/checkresults"
# files
$ng_nagios_cfg_file = "${ng_main_dir}/nagios.cfg"
$ng_nagios_cfg_erb = 'confdroid_nagios/nagios/nagios_cfg.erb'
## old
$ng_main_config = "${ng_main_dir}/nagios.cfg"
$ng_cgi_cfg_file = "${ng_main_dir}/cgi.cfg"
$ng_cgi_cfg_erb = 'confdroid_nagios/nagios/cgi_cfg.erb'
$ng_htpasswd_file = "${ng_main_dir}/passwd"
$ng_htpasswd_head = 'confdroid_nagios/nagios/htpasswd_head.erb'
$ng_htpasswd_rule = 'confdroid_nagios/nagios/htpasswd_rule.erb'
$ng_taccgi_erb = 'confdroid_nagios/selinux/taccgi.erb'
$ng_statcgi_erb = 'confdroid_nagios/selinux/statuscgi.erb'
$ng_statdat_erb = 'confdroid_nagios/selinux/statusdat.erb'
$ng_checknrpe_erb = 'confdroid_nagios/selinux/checknrpe.erb'
$ng_checknagios_erb = 'confdroid_nagios/selinux/checknagios.erb'
$ng_nagios_conf = '/etc/httpd/conf.d/nagios.conf'
$ng_nagios_conf_erb = 'confdroid_nagios/httpd/nagios_conf.erb'
$ng_welcome_conf = '/etc/httpd/conf.d/welcome.conf'
$ng_welcome_conf_erb = 'confdroid_nagios/httpd/welcome_conf.erb'
$ng_forward_conf = '/etc/httpd/conf.d/nagios_forward.conf'
$ng_forward_conf_erb = 'confdroid_nagios/httpd/forward_conf.erb'
$ng_get_cert_erb = 'confdroid_nagios/certbot/get_cert.erb'
$ng_unless_get_cert = 'confdroid_nagios/certbot/unless_get_cert.erb'
$ng_unless_renew_erb = 'confdroid_nagios/certbot/unless_renew_cert.erb'
$ng_index_html_file = '/var/www/html/index.html'
$ng_index_html_erb = 'confdroid_nagios/httpd/index_html.erb'
$ng_ssl_vhost_file = '/etc/httpd/conf.d/nagios_ssl.conf'
$ng_ssl_vhost_erb = 'confdroid_nagios/httpd/nagios_ssl_vhost.erb'
$ng_resource_erb = 'confdroid_nagios/nagios/resource_cfg.erb'
$ng_grep_erb = 'confdroid_nagios/selinux/grep.erb'
# nagios
$ng_target_templates = "${ng_conf_d_dir}/nagios_templates.cfg"
$ng_templates_head_erb = 'confdroid_nagios/nagios/templates_cfg_head.erb'
$ng_templates_rule_erb = 'confdroid_nagios/nagios/templates_cfg_rule.erb'
$ng_tgt_timeperiods_base = "${ng_conf_d_dir}/nagios_timeperiods.cfg"
$ng_tgt_timep_add = "${ng_conf_d_dir}/nagios_timeperiods_add.cfg"
$ng_tgt_timep_head_erb = 'confdroid_nagios/nagios/timeperiods_cfg_head.erb'
$ng_tgt_timep_rule_erb = 'confdroid_nagios/nagios/timeperiods_cfg_rule.erb'
$ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
$ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"
$ng_target_hostgroup_base = "${ng_conf_d_dir}/nagios_hostgroups_base.cfg"
$ng_tgt_hostgroup_add = "${ng_conf_d_dir}/nagios_hostgroups_add.cfg"
$ng_tgt_hostgrp_head_erb = 'confdroid_nagios/nagios/hostgroups_cfg_head.erb'
$ng_tgt_hostgrp_rule_erb = 'confdroid_nagios/nagios/hostgroups_cfg_rule.erb'
$ng_target_hostdep = "${ng_conf_d_dir}/nagios_hostdependency.cfg"
$ng_target_hostesc = "${ng_conf_d_dir}/nagios_hostescalation.cfg"
$ng_target_hostext = "${ng_conf_d_dir}/nagios_hostextinfo.cfg"
$ng_target_service = "${ng_conf_d_dir}/nagios_service.cfg"
$ng_target_svcgrp_base = "${ng_conf_d_dir}/nagios_servicegroups_base.cfg"
$ng_tgt_servicegroup_add = "${ng_conf_d_dir}/nagios_servicegroups_add.cfg"
$ng_tgt_svcgrp_head_erb = 'confdroid_nagios/nagios/svcgroups_cfg_head.erb'
$ng_tgt_svcgrp_rule_erb = 'confdroid_nagios/nagios/svcgroups_cfg_rule.erb'
$ng_target_base_contact = "${ng_conf_d_dir}/nagios_contact_base.cfg"
$ng_target_add_contact = "${ng_conf_d_dir}/nagios_contact_add.cfg"
$ng_contacts_head_erb = 'confdroid_nagios/nagios/contacts_cfg_head.erb'
$ng_contacts_rule_erb = 'confdroid_nagios/nagios/contacts_cfg_rule.erb'
$ng_tgt_contactgroup_base = "${ng_conf_d_dir}/nagios_contactgroup_base.cfg"
$ng_tgt_contactgroup_add = "${ng_conf_d_dir}/nagios_contactgroup_add.cfg"
$ng_cntctgrps_head_erb = 'confdroid_nagios/nagios/contactgroups_cfg_head.erb'
$ng_cntctgrps_rule_erb = 'confdroid_nagios/nagios/contactgroups_cfg_rule.erb'
$ng_target_command = "${ng_conf_d_dir}/nagios_commands_base.cfg"
$ng_nagios_service_cmd = 'check_nagios!/var/log/nagios/status.dat!5!/usr/sbin/nagios'
# includes must be last
include confdroid_nagios::main::config
}
|