summaryrefslogtreecommitdiff
path: root/services/applications
diff options
context:
space:
mode:
Diffstat (limited to 'services/applications')
-rw-r--r--services/applications/nagios.cf31
-rw-r--r--services/applications/nginx.cf33
2 files changed, 63 insertions, 1 deletions
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";
}
diff --git a/services/applications/nginx.cf b/services/applications/nginx.cf
new file mode 100644
index 0000000..ea74612
--- /dev/null
+++ b/services/applications/nginx.cf
@@ -0,0 +1,33 @@
+bundle agent nginx(source, destination)
+{
+ methods:
+ freebsd::
+ "freebsd" usebundle => install_package("$(this.bundle)", "nginx");
+ vars:
+ freebsd::
+ "repaired_conf_classes" slist => { "nginx_nginx_conf_$(destination)_file_repaired", "nginx_needs_restarting" };
+ files:
+ freebsd::
+ "/usr/local/etc/nginx/$(destination)"
+ create => "true",
+ edit_defaults => empty,
+ perms => system_owned("444"),
+ edit_template => "$(source)",
+ classes => if_repaired(@(repaired_conf_classes));
+ classes:
+ freebsd::
+ "nginx_service_running" expression => returnszero("/usr/sbin/service nginx status", "noshell");
+ methods:
+ freebsd::
+ "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "nginx_enable=\"YES\"");
+ commands:
+ freebsd.!nginx_service_running::
+ "/usr/sbin/service nginx start" classes => if_repaired("nginx_service_repaired");
+ freebsd.nginx_needs_restarting::
+ "/usr/sbin/service nginx restart" classes => if_repaired("nginx_service_restarted");
+ reports:
+ any::
+ "$(this.bundle): /usr/local/etc/nginx/$(destination) repaired" ifvarclass => "nginx_nginx_conf_$(destination)_file_repaired";
+ "$(this.bundle): nginx service repaired" ifvarclass => "nginx_service_repaired";
+ "$(this.bundle): nginx service restarted" ifvarclass => "nginx_service_restarted";
+}