]> xn--ix-yja.es Git - alex.git/commitdiff
Process Nagios perfdata
authoralex <alex@pdp7.net>
Fri, 10 Nov 2023 16:45:20 +0000 (17:45 +0100)
committeralex <alex@pdp7.net>
Fri, 10 Nov 2023 16:45:20 +0000 (17:45 +0100)
personal_infra/puppet/modules/nagios/manifests/init.pp
personal_infra/puppet/modules/nagios/templates/nagios.cfg.epp
personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp

index 5568fbf9e9a699d6694918ee425e4ce6a8fac909..52c5a649b0dcc2dc351538eb27da88715d24ddd4 100644 (file)
@@ -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'],
index 8e28ceb8dce749c2336b69187df32afaef9c49d2..2bb9b5a327d5d4aac0a758f63fbb64f67fe0b9b3 100644 (file)
@@ -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
 
 
index 32e28f06864949b6e3d533c5917a63026ad575c8..262b8026eaa6404cf87fda2636ae1289f66240f0 100644 (file)
@@ -1,5 +1,7 @@
 node 'nagios.h1.int.pdp7.net' {
-  class {'nagios':}
+  class {'nagios':
+    otel_host => 'clickhouse.h1.int.pdp7.net',
+  }
   class {'nagios::k8s':}
 
   $k8s_hosts = lookup("groups.k8s")