summaryrefslogtreecommitdiff
path: root/services/applications/nagios.cf
blob: ba429cf588871a6e8cf6635f617794f3cbb1d2d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
bundle agent nagios
{
    vars:
        nagios::
            "packages" slist => {
                "nagios4",
                "nagios-plugins",
                "nrpe",
            };
    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.cftpl", "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";
}