From: alex Date: Fri, 10 Nov 2023 16:45:20 +0000 (+0100) Subject: Process Nagios perfdata X-Git-Tag: 20240214-emacs~107 X-Git-Url: https://xn--ix-yja.es/gitweb/?a=commitdiff_plain;h=0f86d03ed4d516acedd1ecc5c7f841ee6d268572;p=alex.git Process Nagios perfdata --- diff --git a/personal_infra/puppet/modules/nagios/manifests/init.pp b/personal_infra/puppet/modules/nagios/manifests/init.pp index 5568fbf..52c5a64 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 8e28ceb..2bb9b5a 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 diff --git a/personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp b/personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp index 32e28f0..262b802 100644 --- a/personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp +++ b/personal_infra/puppet/site/nagios.h1.int.pdp7.net.pp @@ -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")