Puppet Class: nrpe

Inherits:
nrpe::params
Inherited by:
nrpe::spec
Defined in:
manifests/init.pp

Overview

Class: nrpe

This is the main nrpe class

Parameters

Module Specific parameters

allowed_hosts

The Hosts that can connect to local NRPE server. Typically the Nagios server(s) Can be an array. Default: [ ‘127.0.0.1’ , $::ipaddress ]

dont_blame_nrpe

If you allow arguments in Nrpe commands. This can be a security risk. Default: ‘1’ (allow arguments) is needed for Example42 automated checks via Nagios.

use_ssl

If you want to encrypt Nagios/Nrpe communications on ssl A coherent configuration has to be placed on the Nagios server for the check_nrpe command. Default: true

pluginsdir

Where Nagios plugins are placed. Default value is calculated according to $::operatingsystem and $::architecture

pluginsdir_source

An optional source from which to retrive nagios plugins. If defined all the plugins placed in pluginsdir_source are copied in pluginsdir

pluginspackage

Name of the Nagios plugins package name. Default is automatically set for different distros, set to blank ( pluginspackage => ” ) to disable installation of Nagios plugins.

ntp

This setting is specific for the ntp checks. It defines the ntp server to use when verifying if local time is correct. Default: ‘0.pool.ntp.org’

checkdisk_warning

This setting is specific for the disk checks. It defines the warning level for disk checks. Default: 20

checkdisk_critical

This setting is specific for the disk checks. It defines the critical level for disk checks. Default: 10

command_timeout

The timeout for commands executed by Nrpe. Default: ‘60’

connection_timeout

The Nrpe connection timeout. Default: ‘300’

server_address

The listening address to which NRPE should bind. Default: ” (NRPE listens on any interface)

command_prefix

A command to prefix to every Nrpe command. Default: ” Typically this value can be ‘/usr/bin/sudo’ to launch commands via sudo

file_init_template

The template to use to populate the init configuration file. Default is provided by the module.

Standard class parameters Define the general class behaviour and customizations

my_class

Name of a custom class to autoload to manage module’s customizations If defined, nrpe class will automatically “include $my_class” Can be defined also by the (top scope) variable $nrpe_myclass

source

Sets the content of source parameter for main configuration file If defined, nrpe main config file will have the param: source => $source Can be defined also by the (top scope) variable $nrpe_source Note that by default a template file is specified, so if you want to set the content of the main configu file via source you have also to set template => undef

source_dir

If defined, the whole nrpe configuration directory content is retrieved recursively from the specified source (source => $source_dir , recurse => true) Can be defined also by the (top scope) variable $nrpe_source_dir

source_dir_purge

If set to true (default false) the existing configuration directory is mirrored with the content retrieved from source_dir (source => $source_dir , recurse => true , purge => true) Can be defined also by the (top scope) variable $nrpe_source_dir_purge

template

Sets the path to the template to use as content for main configuration file If defined, nrpe main config file has: content => content(“$template”) Note source and template parameters are mutually exclusive: don’t use both Can be defined also by the (top scope) variable $nrpe_template

options

An hash of custom options to be used in templates for arbitrary settings. Can be defined also by the (top scope) variable $nrpe_options

service_autorestart

Automatically restarts the nrpe service when there is a change in configuration files. Default: true, Set to false if you don’t want to automatically restart the service.

absent

Set to ‘true’ to remove package(s) installed by module Can be defined also by the (top scope) variable $nrpe_absent

disable

Set to ‘true’ to disable service(s) managed by module Can be defined also by the (top scope) variable $nrpe_disable

disableboot

Set to ‘true’ to disable service(s) at boot, without checks if it’s running Use this when the service is managed by a tool like a cluster software Can be defined also by the (top scope) variable $nrpe_disableboot

monitor

Set to ‘true’ to enable monitoring of the services provided by the module Can be defined also by the (top scope) variables $nrpe_monitor and $monitor

monitor_tool

Define which monitor tools (ad defined in Example42 monitor module) you want to use for nrpe checks Can be defined also by the (top scope) variables $nrpe_monitor_tool and $monitor_tool

monitor_target

The Ip address or hostname to use as a target for monitoring tools. Default is the fact $ipaddress Can be defined also by the (top scope) variables $nrpe_monitor_target and $monitor_target

puppi

Set to ‘true’ to enable creation of module data files that are used by puppi Can be defined also by the (top scope) variables $nrpe_puppi and $puppi

puppi_helper

Specify the helper to use for puppi commands. The default for this module is specified in params.pp and is generally a good choice. You can customize the output of puppi commands for this module using another puppi helper. Use the define puppi::helper to create a new custom helper Can be defined also by the (top scope) variables $nrpe_puppi_helper and $puppi_helper

firewall

Set to ‘true’ to enable firewalling of the services provided by the module Can be defined also by the (top scope) variables $nrpe_firewall and $firewall

firewall_tool

Define which firewall tool(s) (ad defined in Example42 firewall module) you want to use to open firewall for nrpe port(s) Can be defined also by the (top scope) variables $nrpe_firewall_tool and $firewall_tool

firewall_src

Define which source ip/net allow for firewalling nrpe. Default: 0.0.0.0/0 Can be defined also by the (top scope) variables $nrpe_firewall_src and $firewall_src

firewall_dst

Define which destination ip to use for firewalling. Default: $ipaddress Can be defined also by the (top scope) variables $nrpe_firewall_dst and $firewall_dst

debug

Set to ‘true’ to enable modules debugging Can be defined also by the (top scope) variables $nrpe_debug and $debug

audit_only

Set to ‘true’ if you don’t intend to override existing configuration files and want to audit the difference between existing files and the ones managed by Puppet. Can be defined also by the (top scope) variables $nrpe_audit_only and $audit_only

Default class params - As defined in nrpe::params. Note that these variables are mostly defined and used in the module itself, overriding the default values might not affected all the involved components. Set and override them only if you know what you’re doing. Note also that you can’t override/set them via top scope variables.

package

The name of nrpe package

package_provider

The package provider, required for Solaris

service

The name of nrpe service

service_status

If the nrpe service init script supports status argument

process

The name of nrpe process

process_args

The name of nrpe arguments. Used by puppi and monitor. Used only in case the nrpe process name is generic (java, ruby…)

process_user

The name of the user nrpe runs with. Used by puppi and monitor.

config_dir

Main configuration directory. Used by puppi

config_file

Main configuration file path

config_file_mode

Main configuration file path mode

config_file_owner

Main configuration file path owner

config_file_group

Main configuration file path group

config_file_init

Path of configuration file sourced by init script

pid_file

Path of pid file. Used by monitor

data_dir

Path of application data directory. Used by puppi

log_dir

Base logs directory. Used by puppi

log_file

Log file(s). Used by puppi

port

The listening port, if any, of the service. This is used by monitor, firewall and puppi (optional) components Note: This doesn’t necessarily affect the service configuration file Can be defined also by the (top scope) variable $nrpe_port

protocol

The protocol used by the the service. This is used by monitor, firewall and puppi (optional) components Can be defined also by the (top scope) variable $nrpe_protocol

version

The version of nrpe package to be installed

enable_sysstat

Enable various services through sysstat/sar.

sysstat_package

The package to install when $enable_sysstat was set to true

Examples

You can use this class in 2 ways:

  • Set variables (at top scope level on in a ENC) and “include nrpe”

  • Call nrpe as a parametrized class

See README for details.

Author

Alessandro Franceschi <al@lab42.it/>

Parameters:

  • allowed_hosts (Any) (defaults to: params_lookup( 'allowed_hosts' ))
  • dont_blame_nrpe (Any) (defaults to: params_lookup( 'dont_blame_nrpe' ))
  • use_ssl (Any) (defaults to: params_lookup( 'use_ssl' ))
  • pluginsdir (Any) (defaults to: params_lookup( 'pluginsdir' ))
  • pluginsdir_source (Any) (defaults to: params_lookup( 'pluginsdir_source' ))
  • pluginspackage (Any) (defaults to: params_lookup( 'pluginspackage' ))
  • command_timeout (Any) (defaults to: params_lookup( 'command_timeout' ))
  • connection_timeout (Any) (defaults to: params_lookup( 'connection_timeout' ))
  • command_prefix (Any) (defaults to: params_lookup( 'command_prefix' ))
  • server_address (Any) (defaults to: params_lookup( 'server_address' ))
  • file_init_template (Any) (defaults to: params_lookup( 'file_init_template' ))
  • ntp (Any) (defaults to: params_lookup( 'ntp' ))
  • checkdisk_warning (Any) (defaults to: params_lookup( 'checkdisk_warning' ))
  • checkdisk_critical (Any) (defaults to: params_lookup( 'checkdisk_critical' ))
  • my_class (Any) (defaults to: params_lookup( 'my_class' ))
  • source (Any) (defaults to: params_lookup( 'source' ))
  • source_dir (Any) (defaults to: params_lookup( 'source_dir' ))
  • source_dir_purge (Any) (defaults to: params_lookup( 'source_dir_purge' ))
  • template (Any) (defaults to: params_lookup( 'template' ))
  • service_autorestart (Any) (defaults to: params_lookup( 'service_autorestart' , 'global' ))
  • options (Any) (defaults to: params_lookup( 'options' ))
  • absent (Any) (defaults to: params_lookup( 'absent' ))
  • disable (Any) (defaults to: params_lookup( 'disable' ))
  • disableboot (Any) (defaults to: params_lookup( 'disableboot' ))
  • monitor (Any) (defaults to: params_lookup( 'monitor' , 'global' ))
  • monitor_tool (Any) (defaults to: params_lookup( 'monitor_tool' , 'global' ))
  • monitor_target (Any) (defaults to: params_lookup( 'monitor_target' , 'global' ))
  • puppi (Any) (defaults to: params_lookup( 'puppi' , 'global' ))
  • puppi_helper (Any) (defaults to: params_lookup( 'puppi_helper' , 'global' ))
  • firewall (Any) (defaults to: params_lookup( 'firewall' , 'global' ))
  • firewall_tool (Any) (defaults to: params_lookup( 'firewall_tool' , 'global' ))
  • firewall_src (Any) (defaults to: params_lookup( 'firewall_src' , 'global' ))
  • firewall_dst (Any) (defaults to: params_lookup( 'firewall_dst' , 'global' ))
  • debug (Any) (defaults to: params_lookup( 'debug' , 'global' ))
  • audit_only (Any) (defaults to: params_lookup( 'audit_only' , 'global' ))
  • package (Any) (defaults to: params_lookup( 'package' ))
  • package_provider (Any) (defaults to: params_lookup( 'package_provider' ))
  • service (Any) (defaults to: params_lookup( 'service' ))
  • service_status (Any) (defaults to: params_lookup( 'service_status' ))
  • process (Any) (defaults to: params_lookup( 'process' ))
  • process_args (Any) (defaults to: params_lookup( 'process_args' ))
  • process_user (Any) (defaults to: params_lookup( 'process_user' ))
  • config_dir (Any) (defaults to: params_lookup( 'config_dir' ))
  • config_file (Any) (defaults to: params_lookup( 'config_file' ))
  • config_file_mode (Any) (defaults to: params_lookup( 'config_file_mode' ))
  • config_file_owner (Any) (defaults to: params_lookup( 'config_file_owner' ))
  • config_file_group (Any) (defaults to: params_lookup( 'config_file_group' ))
  • config_file_init (Any) (defaults to: params_lookup( 'config_file_init' ))
  • pid_file (Any) (defaults to: params_lookup( 'pid_file' ))
  • data_dir (Any) (defaults to: params_lookup( 'data_dir' ))
  • log_dir (Any) (defaults to: params_lookup( 'log_dir' ))
  • log_file (Any) (defaults to: params_lookup( 'log_file' ))
  • port (Any) (defaults to: params_lookup( 'port' ))
  • protocol (Any) (defaults to: params_lookup( 'protocol' ))
  • version (Any) (defaults to: params_lookup( 'version' ))
  • enable_sysstat (Any) (defaults to: params_lookup( 'enable_sysstat' ))
  • oldcsw (Any) (defaults to: params_lookup( 'oldcsw' ))
  • oldcsw_config_file (Any) (defaults to: params_lookup( 'oldcsw_config_file' ))
  • oldcsw_config_dir (Any) (defaults to: params_lookup( 'oldcsw_config_dir' ))
  • sysstat_package (Any) (defaults to: params_lookup( 'sysstat_package'))


277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'manifests/init.pp', line 277

class nrpe (
  $allowed_hosts       = params_lookup( 'allowed_hosts' ),
  $dont_blame_nrpe     = params_lookup( 'dont_blame_nrpe' ),
  $use_ssl             = params_lookup( 'use_ssl' ),
  $pluginsdir          = params_lookup( 'pluginsdir' ),
  $pluginsdir_source   = params_lookup( 'pluginsdir_source' ),
  $pluginspackage      = params_lookup( 'pluginspackage' ),
  $command_timeout     = params_lookup( 'command_timeout' ),
  $connection_timeout  = params_lookup( 'connection_timeout' ),
  $command_prefix      = params_lookup( 'command_prefix' ),
  $server_address      = params_lookup( 'server_address' ),
  $file_init_template  = params_lookup( 'file_init_template' ),
  $ntp                 = params_lookup( 'ntp' ),
  $checkdisk_warning   = params_lookup( 'checkdisk_warning' ),
  $checkdisk_critical  = params_lookup( 'checkdisk_critical' ),
  $my_class            = params_lookup( 'my_class' ),
  $source              = params_lookup( 'source' ),
  $source_dir          = params_lookup( 'source_dir' ),
  $source_dir_purge    = params_lookup( 'source_dir_purge' ),
  $template            = params_lookup( 'template' ),
  $service_autorestart = params_lookup( 'service_autorestart' , 'global' ),
  $options             = params_lookup( 'options' ),
  $absent              = params_lookup( 'absent' ),
  $disable             = params_lookup( 'disable' ),
  $disableboot         = params_lookup( 'disableboot' ),
  $monitor             = params_lookup( 'monitor' , 'global' ),
  $monitor_tool        = params_lookup( 'monitor_tool' , 'global' ),
  $monitor_target      = params_lookup( 'monitor_target' , 'global' ),
  $puppi               = params_lookup( 'puppi' , 'global' ),
  $puppi_helper        = params_lookup( 'puppi_helper' , 'global' ),
  $firewall            = params_lookup( 'firewall' , 'global' ),
  $firewall_tool       = params_lookup( 'firewall_tool' , 'global' ),
  $firewall_src        = params_lookup( 'firewall_src' , 'global' ),
  $firewall_dst        = params_lookup( 'firewall_dst' , 'global' ),
  $debug               = params_lookup( 'debug' , 'global' ),
  $audit_only          = params_lookup( 'audit_only' , 'global' ),
  $package             = params_lookup( 'package' ),
  $package_provider    = params_lookup( 'package_provider' ),
  $service             = params_lookup( 'service' ),
  $service_status      = params_lookup( 'service_status' ),
  $process             = params_lookup( 'process' ),
  $process_args        = params_lookup( 'process_args' ),
  $process_user        = params_lookup( 'process_user' ),
  $config_dir          = params_lookup( 'config_dir' ),
  $config_file         = params_lookup( 'config_file' ),
  $config_file_mode    = params_lookup( 'config_file_mode' ),
  $config_file_owner   = params_lookup( 'config_file_owner' ),
  $config_file_group   = params_lookup( 'config_file_group' ),
  $config_file_init    = params_lookup( 'config_file_init' ),
  $pid_file            = params_lookup( 'pid_file' ),
  $data_dir            = params_lookup( 'data_dir' ),
  $log_dir             = params_lookup( 'log_dir' ),
  $log_file            = params_lookup( 'log_file' ),
  $port                = params_lookup( 'port' ),
  $protocol            = params_lookup( 'protocol' ),
  $version             = params_lookup( 'version' ),
  $enable_sysstat      = params_lookup( 'enable_sysstat' ),
  $oldcsw              = params_lookup( 'oldcsw' ),
  $oldcsw_config_file  = params_lookup( 'oldcsw_config_file' ),
  $oldcsw_config_dir   = params_lookup( 'oldcsw_config_dir' ),
  $sysstat_package     = params_lookup( 'sysstat_package')
  ) inherits nrpe::params {

  $bool_use_ssl=any2bool($use_ssl)
  $bool_source_dir_purge=any2bool($source_dir_purge)
  $bool_enable_sysstat=any2bool($enable_sysstat)
  $bool_service_autorestart=any2bool($service_autorestart)
  $bool_absent=any2bool($absent)
  $bool_disable=any2bool($disable)
  $bool_disableboot=any2bool($disableboot)
  $bool_monitor=any2bool($monitor)
  $bool_puppi=any2bool($puppi)
  $bool_firewall=any2bool($firewall)
  $bool_debug=any2bool($debug)
  $bool_audit_only=any2bool($audit_only)
  $bool_oldcsw=any2bool($oldcsw)

  ### Definition of some variables used in the module
  $manage_package = $nrpe::bool_absent ? {
    true  => 'absent',
    false => $nrpe::version ? {
      ''      => 'present',
      default => $nrpe::version,
    },
  }

  $manage_service_enable = $nrpe::bool_disableboot ? {
    true    => false,
    default => $nrpe::bool_disable ? {
      true    => false,
      default => $nrpe::bool_absent ? {
        true  => false,
        false => true,
      },
    },
  }

  $manage_service_ensure = $nrpe::bool_disable ? {
    true    => 'stopped',
    default =>  $nrpe::bool_absent ? {
      true    => 'stopped',
      default => 'running',
    },
  }

  $manage_service_autorestart = $nrpe::bool_service_autorestart ? {
    true    => Service[nrpe],
    false   => undef,
  }

  $manage_file = $nrpe::bool_absent ? {
    true    => 'absent',
    default => 'present',
  }

  if $nrpe::bool_absent == true or $nrpe::bool_disable == true or $nrpe::bool_disableboot == true {
    $manage_monitor = false
  } else {
    $manage_monitor = true
  }

  if $nrpe::bool_absent == true or $nrpe::bool_disable == true {
    $manage_firewall = false
  } else {
    $manage_firewall = true
  }

  $manage_audit = $nrpe::bool_audit_only ? {
    true  => 'all',
    false => undef,
  }

  $manage_file_replace = $nrpe::bool_audit_only ? {
    true  => false,
    false => true,
  }

  $manage_file_source = $nrpe::source ? {
    ''        => undef,
    default   => $nrpe::source,
  }

  $manage_dir_source = $nrpe::source_dir ? {
    ''        => undef,
    default   => $nrpe::source_dir,
  }

  $manage_file_content = $nrpe::template ? {
    ''        => undef,
    default   => template($nrpe::template),
  }

  $manage_file_init_content = $nrpe::file_init_template ? {
    ''        => undef,
    default   => template($nrpe::file_init_template),
  }

  $nrpe_plugin_require = $::nrpe::pluginspackage ? {
    ''      => Package['nrpe'],
    default => Package['nrpe' , $::nrpe::pluginspackage ]
  }

  ### Managed resources
  $real_package_provider = $package_provider ? {
    ''      => undef,
    undef   => undef,
    default => $package_provider,
  }

  package { 'nrpe':
    ensure   => $nrpe::manage_package,
    name     => $nrpe::package,
    provider => $real_package_provider,
  }

  service { 'nrpe':
    ensure    => $nrpe::manage_service_ensure,
    name      => $nrpe::service,
    enable    => $nrpe::manage_service_enable,
    hasstatus => $nrpe::service_status,
    pattern   => $nrpe::process,
    require   => Package['nrpe'],
  }

  file { 'nrpe.conf':
    ensure  => $nrpe::manage_file,
    path    => $nrpe::config_file,
    mode    => $nrpe::config_file_mode,
    owner   => $nrpe::config_file_owner,
    group   => $nrpe::config_file_group,
    require => Package['nrpe'],
    notify  => $nrpe::manage_service_autorestart,
    source  => $nrpe::manage_file_source,
    content => $nrpe::manage_file_content,
    replace => $nrpe::manage_file_replace,
    audit   => $nrpe::manage_audit,
  }

  if $nrpe::config_file_init != '' {
    file { 'nrpe.init':
      ensure  => $nrpe::manage_file,
      path    => $nrpe::config_file_init,
      mode    => $nrpe::config_file_mode,
      owner   => $nrpe::config_file_owner,
      group   => $nrpe::config_file_group,
      require => Package['nrpe'],
      notify  => $nrpe::manage_service_autorestart,
      content => $nrpe::manage_file_init_content,
      replace => $nrpe::manage_file_replace,
      audit   => $nrpe::manage_audit,
    }
  }

  file { 'nrpe.dir':
    ensure  => directory,
    path    => $nrpe::config_dir,
    mode    => $nrpe::config_file_mode,
    owner   => $nrpe::config_file_owner,
    group   => $nrpe::config_file_group,
    require => Package['nrpe'],
    notify  => $nrpe::manage_service_autorestart,
    source  => $nrpe::manage_dir_source,
    recurse => true,
    purge   => $nrpe::bool_source_dir_purge,
    replace => $nrpe::manage_file_replace,
    audit   => $nrpe::manage_audit,
  }

  ### If we're running on Solaris, deal with CSW's config file location change between CSWnrpe 2.12 and 2.13
  if $bool_oldcsw {
    file { 'nrpe.conf.link':
      ensure  => link,
      path    => $nrpe::oldcsw_config_file,
      require => Package['nrpe'],
      notify  => $nrpe::manage_service_autorestart,
      target  => $nrpe::config_file,
    }

    file { 'nrpe.dir.link':
      ensure  => link,
      path    => $nrpe::oldcsw_config_dir,
      require => Package['nrpe'],
      notify  => $nrpe::manage_service_autorestart,
      target  => $nrpe::config_dir,
      force   => true,
    }
  }

  ### Install Nagios Plugins
  if $nrpe::pluginspackage != '' {
    if ! defined(Package[$nrpe::pluginspackage]) {
      package { $nrpe::pluginspackage :
        ensure   => present,
        provider => $real_package_provider,
      }
    }
  }

  if $pluginsdir_source and $pluginsdir_source != '' {
    file { 'Nrpe_plugins':
      ensure  => directory,
      path    => $nrpe::pluginsdir,
      owner   => root,
      group   => root,
      mode    => '0755',
      require => $nrpe::nrpe_plugin_require,
      source  => $pluginsdir_source,
      recurse => true,
    }
  }


  if $bool_enable_sysstat == true {
    include nrpe::plugin::check_sar_perf
  }

  ### Include custom class if $my_class is set
  if $nrpe::my_class {
    include $nrpe::my_class
  }


  ### Provide puppi data, if enabled ( puppi => true )
  if $nrpe::bool_puppi == true {
    $classvars=get_class_args()
    puppi::ze { 'nrpe':
      ensure    => $nrpe::manage_file,
      variables => $classvars,
      helper    => $nrpe::puppi_helper,
    }
  }


  ### Service monitoring, if enabled ( monitor => true )
  if $nrpe::bool_monitor == true {
    monitor::process { 'nrpe_process':
      process  => $nrpe::process,
      service  => $nrpe::service,
      pidfile  => $nrpe::pid_file,
      user     => $nrpe::process_user,
      argument => $nrpe::process_args,
      tool     => $nrpe::monitor_tool,
      enable   => $nrpe::manage_monitor,
    }
  }


  ### Firewall management, if enabled ( firewall => true )
  if $nrpe::bool_firewall == true {
    firewall { "nrpe_${nrpe::protocol}_${nrpe::port}":
      source      => $nrpe::firewall_src,
      destination => $nrpe::firewall_dst,
      protocol    => $nrpe::protocol,
      port        => $nrpe::port,
      action      => 'allow',
      direction   => 'input',
      tool        => $nrpe::firewall_tool,
      enable      => $nrpe::manage_firewall,
    }
  }


  ### Debugging, if enabled ( debug => true )
  if $nrpe::bool_debug == true {
    file { 'debug_nrpe':
      ensure  => $nrpe::manage_file,
      path    => "${settings::vardir}/debug-nrpe",
      mode    => '0640',
      owner   => 'root',
      group   => 'root',
      content => inline_template('<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime.*|path|timestamp|free|.*password.*|.*psk.*|.*key)/ }.to_yaml %>'),
    }
  }

}