From 2fa66f62265c7f54d17b0339554594697eaaadfe Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 3 Aug 2017 13:54:15 +0000 Subject: Added basic check_mk management --- services/check_mk.cf | 41 +++++++++++++++++++++++++++++++++++++++++ services/debian.cf | 1 + services/main.cf | 2 ++ services/ubuntu.cf | 1 + 4 files changed, 45 insertions(+) create mode 100644 services/check_mk.cf (limited to 'services') diff --git a/services/check_mk.cf b/services/check_mk.cf new file mode 100644 index 0000000..90c04b1 --- /dev/null +++ b/services/check_mk.cf @@ -0,0 +1,41 @@ +bundle agent check_mk +{ + vars: + freebsd:: + "rc_conf_lines" slist => { + "inetd_enable=\"YES\"", + "inetd_flags=\"-wW\"", + }; + files: + freebsd:: + "/etc/rc.conf" + edit_defaults => std_defs, + perms => system_owned("444"), + edit_line => append_if_no_line("$(rc_conf_lines)"), + classes => if_repaired("check_mk_rc_conf_file_repaired"); + "/etc/services" + edit_defaults => std_defs, + perms => system_owned("444"), + edit_line => append_if_no_line("check_mk_agent 6556/tcp"), + classes => if_repaired("check_mk_services_file_repaired"); + "/etc/inetd.conf" + edit_defaults => std_defs, + perms => system_owned("444"), + edit_line => append_if_no_line("check_mk_agent stream tcp nowait root /usr/local/bin/check_mk_agent check_mk_agent"), + classes => if_repaired("check_mk_inetd_conf_file_repaired"); + classes: + freebsd:: + "sshd_service_running" expression => returnszero("/usr/sbin/service sshd status", "noshell"); + commands: + freebsd.!sshd_service_running:: + "/usr/sbin/service inetd start" classes => if_repaired("inetd_service_repaired"); + freebsd.check_mk_inetd_conf_file_repaired:: + "/usr/sbin/service inetd restart" classes => if_repaired("inetd_service_restarted"); + reports: + any:: + "$(this.bundle): /etc/rc.conf repaired" ifvarclass => "check_mk_rc_conf_file_repaired"; + "$(this.bundle): /etc/services repaired" ifvarclass => "check_mk_services_file_repaired"; + "$(this.bundle): /etc/inetd.conf repaired" ifvarclass => "check_mk_inetd_conf_file_repaired"; + "$(this.bundle): inetd service repaired" ifvarclass => "inetd_service_repaired"; + "$(this.bundle): inetd service restarted" ifvarclass => "inetd_service_restarted"; +} diff --git a/services/debian.cf b/services/debian.cf index 30f09c6..4fe3a75 100644 --- a/services/debian.cf +++ b/services/debian.cf @@ -5,6 +5,7 @@ bundle common flavour "packages" slist => { "at", "bridge-utils", + "check-mk-agent", "curl", "dstat", "git", diff --git a/services/main.cf b/services/main.cf index 266cd86..94a52be 100644 --- a/services/main.cf +++ b/services/main.cf @@ -4,9 +4,11 @@ bundle common classify any:: "bundles" slist => { "common", + "check_mk", "flavour", }; "inputs" slist => { + "services/check_mk.cf", "services/common.cf", "services/$(flavour).cf", }; diff --git a/services/ubuntu.cf b/services/ubuntu.cf index 919a5fe..f8fc91a 100644 --- a/services/ubuntu.cf +++ b/services/ubuntu.cf @@ -5,6 +5,7 @@ bundle common flavour "packages" slist => { "at", "bridge-utils", + "check-mk-agent", "curl", "dstat", "git", -- cgit v1.2.3