aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/puppet/modules/nagios
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-11-10 17:45:20 +0100
committeralex <alex@pdp7.net>2023-11-10 17:45:20 +0100
commit0f86d03ed4d516acedd1ecc5c7f841ee6d268572 (patch)
tree7ecb19d02b9f52f6c95c9f182279ecc9228d384f /personal_infra/puppet/modules/nagios
parentda6b5cdb741366e69b7152d0a580504ba8ff24ed (diff)
Process Nagios perfdata
Diffstat (limited to 'personal_infra/puppet/modules/nagios')
-rw-r--r--personal_infra/puppet/modules/nagios/manifests/init.pp10
-rw-r--r--personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp20
2 files changed, 18 insertions, 12 deletions
diff --git a/personal_infra/puppet/modules/nagios/manifests/init.pp b/personal_infra/puppet/modules/nagios/manifests/init.pp
index 5568fbf9..52c5a649 100644
--- a/personal_infra/puppet/modules/nagios/manifests/init.pp
+++ b/personal_infra/puppet/modules/nagios/manifests/init.pp
@@ -1,4 +1,4 @@
-class nagios {
+class nagios($otel_host) {
package {'nagios':}
->
service {'nagios':
@@ -49,6 +49,14 @@ class nagios {
owner => 'nagios',
}
+ nagios_command {'process-host-perfdata-file':
+ command_name => 'process-host-perfdata-file',
+ command_line => "/opt/nagios-otel/venv/bin/python3 /opt/nagios-otel/examples/host_example.py ${otel_host} /var/log/nagios/host-perfdata",
+ require => Package['nagios'],
+ notify => Service['nagios'],
+ owner => 'nagios',
+ }
+
nagios_hostgroup {'linux':
hostgroup_name => 'linux',
require => Package['nagios'],
diff --git a/personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp b/personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp
index 8e28ceb8..2bb9b5a3 100644
--- a/personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp
+++ b/personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp
@@ -804,7 +804,7 @@ enable_event_handlers=1
# performance data.
# Values: 1 = process performance data, 0 = do not process performance data
-process_performance_data=0
+process_performance_data=1
@@ -826,7 +826,7 @@ process_performance_data=0
# Performance data is only written to these files if the
# enable_performance_data option (above) is set to 1.
-#host_perfdata_file=/var/log/nagios/host-perfdata
+host_perfdata_file=/var/log/nagios/host-perfdata
#service_perfdata_file=/var/log/nagios/service-perfdata
@@ -839,8 +839,8 @@ process_performance_data=0
# to the performance data file. Some examples of what you can do are
# shown below.
-#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
-#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
+host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
+service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
@@ -851,8 +851,8 @@ process_performance_data=0
# pipe ("p") mode which avoid blocking at startup, otherwise you will
# likely want the default append ("a") mode.
-#host_perfdata_file_mode=a
-#service_perfdata_file_mode=a
+host_perfdata_file_mode=a
+service_perfdata_file_mode=a
@@ -862,17 +862,15 @@ process_performance_data=0
# below. A value of 0 indicates the files should not be periodically
# processed.
-#host_perfdata_file_processing_interval=0
-#service_perfdata_file_processing_interval=0
-
-
+host_perfdata_file_processing_interval=60
+service_perfdata_file_processing_interval=0
# HOST AND SERVICE PERFORMANCE DATA FILE PROCESSING COMMANDS
# These commands are used to periodically process the host and
# service performance data files. The interval at which the
# processing occurs is determined by the options above.
-#host_perfdata_file_processing_command=process-host-perfdata-file
+host_perfdata_file_processing_command=process-host-perfdata-file
#service_perfdata_file_processing_command=process-service-perfdata-file