From 142820653f8d6a3fffacc9acde09ca74e22892bf Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 19 Sep 2017 17:55:40 +0200 Subject: Finished adding nagios policy along with simple nginx policy --- services/applications/nagios.cf | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'services/applications/nagios.cf') diff --git a/services/applications/nagios.cf b/services/applications/nagios.cf index 8e9ab44..ca37cbf 100644 --- a/services/applications/nagios.cf +++ b/services/applications/nagios.cf @@ -4,10 +4,39 @@ bundle agent nagios nagios:: "packages" slist => { "nagios4", - "nginx", + "nagios-plugins", }; methods: nagios:: "nagios" usebundle => fcgiwrap("nagios", "www", "770"); "nagios" usebundle => php56(); + "nagios" usebundle => nginx("$(sys.inputdir)/templates/nginx/nagios_nginx.conf", "nginx.conf"); + "nagios" usebundle => nginx("$(sys.inputdir)/templates/nginx/nagios_htpasswd", "htpasswd"); + "nagios" usebundle => install_package("$(this.bundle)", "$(nagios.packages)"); + "nagios" usebundle => add_rc_conf_line("$(this.bundle)", "nagios_enable=\"YES\""); + files: + nagios:: + "/usr/local/etc/nagios/." + create => "true", + depth_search => recurse("inf"), + perms => og("nagios", "nagios"), + copy_from => copyfrom_sync("$(sys.inputdir)/templates/nagios/"), + classes => if_repaired("nagios_nagios_dir_repaired"); + classes: + nagios:: + "nagios_service_running" expression => returnszero("/usr/sbin/service nagios status", "noshell"); + methods: + nagios:: + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "nagios_enable=\"YES\""); + commands: + nagios.!nagios_service_running:: + "/usr/sbin/service nagios start" classes => if_repaired("nagios_service_repaired"); + nagios.nagios_nagios_dir_repaired:: + "/usr/sbin/service nagios restart" classes => if_repaired("nagios_service_restarted"); + reports: + any:: + "$(this.bundle): /usr/local/etc/nagios/ directory repaired" ifvarclass => "nagios_nagios_dir_repaired"; + "$(this.bundle): /usr/local/etc/nginx/htpasswd file repaired" ifvarclass => "nagios_htpasswd_file_repaired"; + "$(this.bundle): nagios service repaired" ifvarclass => "nagios_service_repaired"; + "$(this.bundle): nagios service restarted" ifvarclass => "nagios_service_restarted"; } -- cgit v1.2.3