Agents Thruk Plugin

Agent configuration for SNClient+ agents in Naemon.

agents plugin

Installation

Assuming you are using OMD (omd.consol.de).

This is a core plugin, so it is shipped with Thruk and can simply be enabled by running: thruk plugins enable agents or from the plugins section in the config tool.

It worked if you have a new menu item under SystemAgents.

Configuration

Create a example configuration file:

~/etc/thruk/thruk_local.d/agents.conf.

For example:

<Component Thruk::Agents>
  <snclient>
    # use a default backend if there are multiple
    default_backend = LOCAL

    # set a default password macro, ex.: $USER5$
    default_password = $USER5$

    # add extra options to check_nsc_web
    check_nsc_web_extra_options = "-k -t 35"

    # override check interval
    check_interval = 1
    retry_interval = 0.5
    max_check_attempts = 5

    # override inventory interval
    inventory_interval = 60

    # override os updates interval
    os_updates_interval = 60

    # set default contact(s)
    #default_contacts = admin, other

    # set default contactgroups(s)
    #default_contactgroups = group, ...

    # set performance data templates (default is autodetect based
    # on whether grafana is enabled)
    #perf_template      = srv-perf
    #host_perf_template = host-perf

    # set default options for specific check types
    <default_opt>
      drivesize = show-all freespace-ignore-reserved=false
    </default_opt>

    # disable network checks matching these attributes
    <disable network>
      enabled != true
      name    ~ ^(lo|.*Loopback)
      flags   ~ loopback
    </disable>

    # disable check_drivesize checks matching these attributes
    <disable drivesize>
      fstype  ~ ^(tracefs|securityfs|debugfs|configfs|pstorefs|fusectl|cgroup2fs|bpf|efivarfs|sysfs|fuseblk|rpc_pipefs|nsfs|ramfs|binfmt_misc|proc|nfs|devpts|mqueue|hugetlbfs)$
      drive   ~ ^(/run/|/dev|/boot/efi|/proc|/sys)
      mounted = 0
      drive   =
    </disable>

    # disable services by name or type
    <exclude>
      #name = check_users   # name string match
      #name ~ net lo        # name regex match
      #type = df./proc      # type string match
      #type ~ ^extscript\.  # type regex, disable all external scripts by default
      #host !~ \.win\.      # apply this exclude only to specific hosts, only hosts not matching ".win."
      #host ~ ^l            # apply this exclude only to hosts starting with an "l"
      #section ~ test       # apply this exclude only to sections containing "test"
    </exclude>

    # include services in discovery
    <service>
      # service name (available placeholder: %s - service name)
      name  = service %s
      service = snclient
      service = apache2
      service = postfix
      service = ssh
      service = exim4
      service = mariadb
      service = ntp
      service = squid

      # restrict to specific hosts (regular expression)
      #host = ANY
      #section ~ test # apply this service only to sections containing "test"
    </service>

    <proc>
      # service name (available placeholder: %u - user | %e - executable)
      name  = ssh controlmaster %u
      match = /usr/bin/ssh.*ControlMaster=yes
      user  = mon
      # restrict to specific hosts (regular expression)
      #host = ANY
      #section ~ test # apply this process check only to sections containing "test"
      #warn = 1:5  # warning threshold for number of processes (low:high)
      #crit = 1:10 # critical threshold
    </proc>

    <proc>
      # if no match is given, use the name as exe filter
      name  = snclient
      name  = httpd
    </proc>

    # set generic process threshold
    <extra_service_opts>
      service = ^processes$
      args    = warn='count > 2000' crit='count > 2000'
    </extra_service_opts>

    # set zombie process threshold
    <extra_service_opts>
      service = ^zombie processes$
      args    = warn='count > 0' crit='count > 5'
    </extra_service_opts>

    # set extra service attributes (if multiple blocks match, each is applied in order and overwrites previous values)
    # block can be used multiple times
    <extra_service_opts>
      service = ^cpu$ # regex match on service description
      # restrict to specific hosts (regular expression)
      #host = ANY
      #section ~ test # apply this attributes only to sections containing "test"

      # can be used to append extra arguments to the command line
      #args = warn='load > 95' crit='load > 100'

      # naemon service attributes will be added to the generated host configuration
      first_notification_delay = 30
      notification_options     = w,c
      # other naemon service attributes...
    </extra_service_opts>

    # set extra host attributes (if multiple blocks match, each is applied in order)
    # block can be used multiple times
    <extra_host_opts>
      host = ^hostname$ # regex match on host name
      #section ~ test # apply this attributes only to sections containing "test"

      # naemon host attributes will be added to the generated host configuration
      #first_notification_delay = 30
      #check_command = check-host-alive!$HOSTADDRESS$
      # other naemon host attributes...
    </extra_host_opts>

    # add custom snclient based service checks
    <extra_service_checks>
      # on which host / sections should this serice be created
      host    = ANY
      section = ANY

      name    = dns           # the actual service description
      check   = check_dns     # snclient check
      args    = -H thruk.org  # check arguments
      # add arbitray naemon config attributes here as well
      first_notification_delay = 30
    </extra_service_checks>

    # add custom service checks
    <extra_service_checks>
      # on which host / sections should this serice be created
      host    = ANY
      section = ANY

      name    = ping  # the actual service description
      check_command = check-host-alive!$HOSTADDRESS$
      # add arbitray naemon config attributes here as well
      first_notification_delay = 30
    </extra_service_checks>
  </snclient>
</Component>
Edit page on GitHub