summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2017-09-21 14:20:13 +0200
committerJulien Dessaux2017-09-21 16:21:41 +0200
commit48b0d706b0c9053472ce54e8375e797332868084 (patch)
tree64beec0744784a6025961e4e99b57e171dde44f8
parentFixed classify.inputs warning in messages log files (diff)
downloadmasterfiles-48b0d706b0c9053472ce54e8375e797332868084.tar.gz
masterfiles-48b0d706b0c9053472ce54e8375e797332868084.tar.bz2
masterfiles-48b0d706b0c9053472ce54e8375e797332868084.zip
Added nrpe policy
-rw-r--r--services/applications.cf1
-rw-r--r--services/applications/nagios.cf1
-rw-r--r--services/applications/nrpe.cf34
-rw-r--r--services/main.cf3
-rw-r--r--templates/nrpe/nrpe.cfg14
5 files changed, 53 insertions, 0 deletions
diff --git a/services/applications.cf b/services/applications.cf
index b33b344..2c66ca8 100644
--- a/services/applications.cf
+++ b/services/applications.cf
@@ -7,6 +7,7 @@ body file control
"services/applications/ipam.cf",
"services/applications/nagios.cf",
"services/applications/nginx.cf",
+ "services/applications/nrpe.cf",
"services/applications/php56.cf",
"services/applications/sshd.cf",
};
diff --git a/services/applications/nagios.cf b/services/applications/nagios.cf
index ca37cbf..8c732c8 100644
--- a/services/applications/nagios.cf
+++ b/services/applications/nagios.cf
@@ -5,6 +5,7 @@ bundle agent nagios
"packages" slist => {
"nagios4",
"nagios-plugins",
+ "nrpe",
};
methods:
nagios::
diff --git a/services/applications/nrpe.cf b/services/applications/nrpe.cf
new file mode 100644
index 0000000..f2a4c3f
--- /dev/null
+++ b/services/applications/nrpe.cf
@@ -0,0 +1,34 @@
+bundle agent nrpe
+{
+ vars:
+ freebsd.nrpe::
+ "packages" slist => {
+ "nrpe",
+ "nagios-plugins",
+ };
+ methods:
+ freebsd.nrpe::
+ "nrpe" usebundle => install_package("$(this.bundle)", "$(nrpe.packages)");
+ "nrpe" usebundle => add_rc_conf_line("$(this.bundle)", "nrpe2_enable=\"YES\"");
+ files:
+ freebsd.nrpe::
+ "/usr/local/etc/nrpe.cfg"
+ create => "true",
+ edit_defaults => empty,
+ perms => system_owned("444"),
+ edit_template => "$(sys.inputdir)/templates/nrpe/nrpe.cfg",
+ classes => if_repaired("nrpe_nrpe_cfg_file_repaired");
+ classes:
+ freebsd.nrpe::
+ "nrpe2_service_running" expression => returnszero("/usr/sbin/service nrpe2 status", "noshell");
+ commands:
+ freebsd.nrpe.!nrpe2_service_running::
+ "/usr/sbin/service nrpe2 start" classes => if_repaired("nrpe2_service_repaired");
+ freebsd.nrpe.nrpe_nrpe_cfg_file_repaired::
+ "/usr/sbin/service nrpe2 restart" classes => if_repaired("nrpe2_service_restarted");
+ reports:
+ any::
+ "$(this.bundle): /usr/local/etc/nrpe.cfg file repaired" ifvarclass => "nrpe_nrpe_cfg_file_repaired";
+ "$(this.bundle): nrpe2 service repaired" ifvarclass => "nrpe2_service_repaired";
+ "$(this.bundle): nrpe2 service restarted" ifvarclass => "nrpe2_service_restarted";
+}
diff --git a/services/main.cf b/services/main.cf
index 6d25f3e..48697a7 100644
--- a/services/main.cf
+++ b/services/main.cf
@@ -37,9 +37,12 @@ bundle agent classify
"legend",
};
"mail_servers" or => { "legend" };
+ "nrpe" expression => "freebsd";
methods:
ipam::
"ipam" usebundle => ipam;
nagios::
"nagios" usebundle => nagios;
+ nrpe::
+ "nrpe" usebundle => nrpe;
}
diff --git a/templates/nrpe/nrpe.cfg b/templates/nrpe/nrpe.cfg
new file mode 100644
index 0000000..db9e18a
--- /dev/null
+++ b/templates/nrpe/nrpe.cfg
@@ -0,0 +1,14 @@
+log_facility=daemon
+pid_file=/var/run/nrpe2/nrpe2.pid
+server_port=5666
+nrpe_user=nagios
+nrpe_group=nagios
+allowed_hosts=10.1.0.101
+
+command_timeout=60
+connection_timeout=300
+
+command[check_load]=/usr/local/libexec/nagios/check_load -w 15,10,5 -c 30,25,20
+command[check_root]=/usr/local/libexec/nagios/check_disk -w 20% -c 10% -p /
+command[check_zombie_procs]=/usr/local/libexec/nagios/check_procs -w 5 -c 10 -s Z
+command[check_total_procs]=/usr/local/libexec/nagios/check_procs -w 150 -c 200