###############################################################################
#
#  Nagios-Mod-Gearman - distribute checks with gearman
#
#  Copyright (c) 2010 Sven Nierlein
#
#  Copyright (c) 2024 Nagios Development Team <devteam@nagios.com>
#
#  Nagios Worker Module Config
#
###############################################################################

# Identifier, hostname will be used if undefined
{% if identifier is defined %}identifier={{identifier}}{% endif %}

# use debug to increase the verbosity of the module.
# Possible values are:
#     0 = only errors
#     1 = debug messages
#     2 = trace messages
#     3 = trace and all gearman related logs are going to stdout.
# Default is 0.
{% if debug is defined %}debug={{debug}}{% endif %}

# Path to the logfile.
{% if logfile is defined %}logfile={{logfile}}{% endif %}

# sets the addess of your gearman job server. Can be specified
# more than once to add more server.
{% if server is defined %}server={{server}}{% endif %}


# sets the address of your 2nd (duplicate) gearman job server. Can
# be specified more than once o add more servers.
{% if dupserver is defined %}dupserver={{dupserver}}{% endif %}


# defines if the worker should execute eventhandlers.
{% if eventhandler is defined %}eventhandler={{eventhandler}}{% endif %}


# defines if the worker should execute notifications.
{% if notifications is defined %}notifications={{notifications}}{% endif %}


# defines if the worker should execute
# service checks.
{% if services is defined %}services={{services}}{% endif %}


# defines if the worker should execute
# host checks.
{% if hosts is defined %}hosts={{hosts}}{% endif %}


# sets a list of hostgroups which this worker will work
# on. Either specify a comma seperated list or use
# multiple lines.
{% if hostgroups is defined %}hostgroups={{hostgroups}}{% endif %}


# sets a list of servicegroups which this worker will
# work on.
{% if servicegroups is defined %}servicegroups={{servicegroups}}{% endif %}

# enables or disables encryption. It is strongly
# advised to not disable encryption. Anybody will be
# able to inject packages to your worker.
# Encryption is enabled by default and you have to
# explicitly disable it.
# When using encryption, you will either have to
# specify a shared password with key=... or a
# keyfile with keyfile=...
# Default is On.
{% if encryption is defined %}encryption={{encryption}}{% endif %}


# A shared password which will be used for
# encryption of data pakets. Should be at least 8
# bytes long. Maximum length is 32 characters.
{% if key is defined %}key={{key}}{% endif %}


# The shared password will be read from this file.
# Use either key or keyfile. Only the first 32
# characters will be used.
#keyfile=/path/to/secret.file
{% if keyfile is defined %}keyfile={{keyfile}}{% endif %}

# Path to the pidfile. Usually set by the init script
#pidfile=%PIDFILE%
{% if pidfile is defined %}pidfile={{pidfile}}{% endif %}

# Default job timeout in seconds. Currently this value is only used for
# eventhandler. The worker will use the values from the core for host and
# service checks.
{% if job_timeout is defined %}job_timeout={{job_timeout}}{% endif %}

# Minimum number of worker processes which should
# run at any time.
{% if min_workers is defined %}min-worker={{min_workers}}{% endif %}

# Maximum number of worker processes which should
# run at any time. You may set this equal to
# min-worker setting to disable dynamic starting of
# workers. When setting this to 1, all services from
# this worker will be executed one after another.
{% if max_workers is defined %}max-worker={{max_workers}}{% endif %}

# Time after which an idling worker exists
# This parameter controls how fast your waiting workers will
# exit if there are no jobs waiting.
{% if idle_timeout is defined %}idle-timeout={{idle_timeout}}{% endif %}

# Controls the amount of jobs a worker will do before he exits
# Use this to control how fast the amount of workers will go down
# after high load times
{% if max_jobs is defined %}max-jobs={{max_jobs}}{% endif %}

# max-age is the threshold for discarding too old jobs. When a new job is older
# than this amount of seconds it will not be executed and just discarded. Set to
# zero to disable this check.
#max-age=0
{% if max_age is defined %}max-age={{max_age}}{% endif %}

# defines the rate of spawned worker per second as long
# as there are jobs waiting
{% if spawn_rate is defined %}spawn-rate={{spawn_rate}}{% endif %}

# Use this option to disable an extra fork for each plugin execution. Disabling
# this option will reduce the load on the worker host but can lead to problems with
# unclean plugin. Default: yes
{% if fork_on_exec is defined %}fork_on_exec={{fork_on_exec}}{% endif %}

# Set a limit based on the 1min load average. When exceding the load limit,
# no new worker will be started until the current load is below the limit.
# No limit will be used when set to 0.
{% if load_limit1 is defined %}load_limit1={{load_limit1}}{% endif %}

# Same as load_limit1 but for the 5min load average.
{% if load_limit5 is defined %}load_limit5={{load_limit5}}{% endif %}

# Same as load_limit1 but for the 15min load average.
{% if load_limit15 is defined %}load_limit15={{load_limit15}}{% endif %}

# Use this option to show stderr output of plugins too.
# Default: yes
{% if show_error_output is defined %}show_error_output={{show_error_output}}{% endif %}

# Defines the return code for timed out checks. Accepted return codes
# are 0 (Ok), 1 (Warning), 2 (Critical) and 3 (Unknown)
# Default: 2
{% if timeout_return is defined %}timeout_return={{timeout_return}}{% endif %}

# Use dup_results_are_passive to set if the duplicate result send to the dupserver
# will be passive or active.
# Default is yes (passive).
{% if dup_results_are_passive is defined %}dup_results_are_passive={{dup_results_are_passive}}{% endif %}

# Gearman connection timeout(in milliseconds) while submitting jobs to
# gearmand server
# Default is 5000
{% if gearman_connection_timeout is defined %}gearman_connection_timeout={{gearman_connection_timeout}}{% endif %}

# Security
# restrict_path allows you to restrict this worker to only execute plugins
# from these particular folders. Can be used multiple times to specify more
# than one folder.
#restrict_path=/usr/local/plugins/
{% if restrict_path is defined %}restrict_path={{restrict_path}}{% endif %}

# list of forbidden characters in command lines. Only active if 'restrict_path'
# is in use.
#restrict_command_characters=$&();<>`"'|
{% if restrict_command_characters is defined %}restrict_command_characters={{restrict_command_characters}}{% endif %}


# Workarounds

# workaround for rc 25 bug
# duplicate jobs from gearmand result in exit code 25 of plugins
# because they are executed twice and get killed because of using
# the same ressource.
# Sending results (when exit code is 25 ) will be skipped with this
# enabled.
{% if workaround_rc_25 is defined %}workaround_rc_25={{workaround_rc_25}}{% endif %}
