Puppet Class: sensu

Defined in:
manifests/init.pp

Summary

Base Sensu class

Overview

This is the main Sensu class

Parameters:

  • version (Pattern[/^absent$/, /^installed$/, /^latest$/, /^present$/, /^[\d\.\-el]+$/]) (defaults to: 'installed')

    Version of sensu to install. Defaults to installed to support Windows MSI packaging and to avoid surprising upgrades.

  • sensu_etc_dir (Stdlib::Absolutepath) (defaults to: $::osfamily)

    Absolute path to the sensu etc directory. Default: '/etc/sensu' on Linux, 'C:/opt/sensu' on windows

  • sensu_plugin_name (String) (defaults to: 'sensu-plugin')

    Name of the sensu-plugin package. Refers to the sensu-plugin rubygem, not the community sensu-plugins community scripts.

  • sensu_plugin_provider (Optional[String]) (defaults to: $::osfamily)

    String. Provider used to install the sensu-plugin package. Refers to the sensu-plugin rubygem, not the sensu-plugins community scripts. On windows, defaults to gem, all other platforms defaults to undef

  • sensu_plugin_version (Pattern[/^absent$/, /^installed$/, /^latest$/, /^present$/, /^\d[\d\.\-\w]+$/]) (defaults to: 'installed')

    Version of the sensu-plugin gem to install. Refers to the sensu-plugin rubygem, not the sensu-plugins community scripts

  • install_repo (Boolean) (defaults to: true)

    Whether or not to install the sensu repo

  • enterprise (Boolean) (defaults to: false)

    Whether or not to install and configure Sensu Enterprise

  • enterprise_dashboard (Boolean) (defaults to: false)

    Whether or not to install sensu-enterprise-dashboard

  • manage_repo (Boolean) (defaults to: true)

    Whether or not to manage apt/yum repositories

  • repo (Enum['main','unstable']) (defaults to: 'main')

    Which sensu repo to install

  • repo_source (Optional[String]) (defaults to: undef)

    Location of the yum/apt repo. Overrides the default location

  • repo_key_id (String) (defaults to: 'EE15CFF6AB6E4E290FDAB681A20F259AEB9C94BB')

    The apt GPG key id

  • repo_key_source (String) (defaults to: 'https://sensu.global.ssl.fastly.net/apt/pubkey.gpg')

    URL of the apt GPG key

  • repo_release (Optional[String]) (defaults to: undef)

    Release for the apt source. Only set this if you want to run packages from another release, which is not supported by Sensu. Only works with systems that use apt.

  • spawn_limit (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    Tune concurrency of the sensu-server pipe handler and the sensu-client check execution. This setting should not need to be tuned except in specific situations, e.g. when there are a large number of JIT clients. See #727 for more information. The default is undefined, which does not manage /etc/sensu/conf.d/spawn.json

  • client (Boolean) (defaults to: true)

    Include the sensu client

  • server (Boolean) (defaults to: false)

    Include the sensu server

  • api (Boolean) (defaults to: false)

    Include the sensu api service

  • manage_services (Boolean) (defaults to: true)

    Manage the sensu services with puppet

  • client_service_enable (Boolean) (defaults to: true)

    Set enable value for sensu client service (applies when manage_services is set to true)

  • client_service_ensure (String) (defaults to: running)

    Set ensure value for sensu client service (applies when manage_services is set to true)

  • server_service_enable (Boolean) (defaults to: true)

    Set enable value for sensu server service (applies when manage_services is set to true)

  • server_service_ensure (String) (defaults to: running)

    Set ensure value for sensu server service (applies when manage_services is set to true)

  • manage_user (Boolean) (defaults to: true)

    Manage the sensu user with puppet

  • manage_plugins_dir (Boolean) (defaults to: true)

    Manage the sensu plugins directory. Must be false if you use sensu::plugin with type 'directory'.

  • manage_handlers_dir (Boolean) (defaults to: true)

    Manage the sensu handlers directory

  • manage_mutators_dir (Boolean) (defaults to: true)

    Manage the sensu mutators directory

  • sensu_user (Optional[String]) (defaults to: undef)

    Name of the user Sensu is running as. Default is calculated according to the underlying OS

  • sensu_group (Optional[String]) (defaults to: undef)

    Name of the group Sensu is running as. Default is calculated according to the underlying OS

  • config_dir_mode (Optional[Stdlib::Filemode]) (defaults to: $::osfamily)

    Directory mode for Sensu conf directory. Default is calculated according to the underlying OS

  • config_file_mode (Optional[Stdlib::Filemode]) (defaults to: $::osfamily)

    File mode for config files under Sensu conf directory . Default is calculated according to the underlying OS

  • rabbitmq_port (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    Rabbitmq port to be used by sensu

  • rabbitmq_host (Optional[String]) (defaults to: undef)

    Host running rabbitmq for sensu

  • rabbitmq_user (Optional[String]) (defaults to: undef)

    Username to connect to rabbitmq with for sensu

  • rabbitmq_password (Optional[String]) (defaults to: undef)

    Password to connect to rabbitmq with for sensu

  • rabbitmq_vhost (Optional[String]) (defaults to: undef)

    Rabbitmq vhost to be used by sensu

  • rabbitmq_ssl (Optional[Boolean]) (defaults to: undef)

    Use SSL transport to connect to RabbitMQ. If rabbitmq_ssl_private_key and/or rabbitmq_ssl_cert_chain are set, then this is enabled automatically. Set rabbitmq_ssl => true without specifying a private key or cert chain to use SSL transport, but not cert auth.

  • rabbitmq_ssl_private_key (Optional[String]) (defaults to: undef)

    Private key to be used by sensu to connect to rabbitmq. If the value starts with 'puppet://' the file will be copied and used. Also the key itself can be given as the parameter value, or a variable, or using hiera. Absolute paths will just be used as a file reference, as you'd normally configure sensu.

  • rabbitmq_ssl_cert_chain (Optional[String]) (defaults to: undef)

    Private SSL cert chain to be used by sensu to connect to rabbitmq If the value starts with 'puppet://' the file will be copied and used. Also the key itself can be given as the parameter value, or a variable, or using hiera. Absolute paths will just be used as a file reference, as you'd normally configure sensu.

  • rabbitmq_prefetch (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    The integer value for the RabbitMQ prefetch attribute

  • rabbitmq_cluster (Variant[Undef,Hash,Array]) (defaults to: undef)

    Array of hashes. Rabbitmq Cluster configuration and connection information for one or more Cluster

  • rabbitmq_heartbeat (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    The integer value for the RabbitMQ heartbeat attribute

  • redis_host (Optional[String]) (defaults to: '127.0.0.1')

    Hostname of redis to be used by sensu

  • redis_port (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: 6379)

    Redis port to be used by sensu

  • redis_password (Optional[String]) (defaults to: undef)

    Password to be used to connect to Redis

  • redis_reconnect_on_error (Boolean) (defaults to: true)

    Reconnect to Redis in the event of a Redis error, e.g. READONLY (not to be confused with a connection failure).

  • redis_db (Integer) (defaults to: 0)

    The Redis instance DB to use/select

  • redis_sentinels (Optional[Array]) (defaults to: undef)

    Redis Sentinel configuration and connection information for one or more Sentinels

  • redis_master (Optional[String]) (defaults to: undef)

    Redis master name in the sentinel configuration In the end whatever sensu defaults to, which is "mymaster" currently.

  • redis_auto_reconnect (Boolean) (defaults to: true)

    Reconnect to Redis in the event of a connection failure

  • redis_tls (Boolean) (defaults to: false)

    Enable TLS encryption when connecting to Redis

  • transport_type (Enum['rabbitmq','redis']) (defaults to: 'rabbitmq')

    Transport type to be used by Sensu

  • transport_reconnect_on_error (Boolean) (defaults to: true)

    If the transport connection is closed, attempt to reconnect automatically when possible.

  • api_bind (String) (defaults to: '0.0.0.0')

    IP to bind api service

  • api_host (String) (defaults to: '127.0.0.1')

    Hostname of the sensu api service

  • api_port (Integer) (defaults to: 4567)

    Port of the sensu api service

  • api_user (Optional[String]) (defaults to: undef)

    Password of the sensu api service

  • api_password (Optional[String]) (defaults to: undef)

    Password of the sensu api service

  • api_ssl_port (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    Port of the HTTPS (SSL) sensu api service. Enterprise only feature.

  • api_ssl_keystore_file (Optional[String]) (defaults to: undef)

    The file path for the SSL certificate keystore. Enterprise only feature.

  • api_ssl_keystore_password (Optional[String]) (defaults to: undef)

    The SSL certificate keystore password. Enterprise only feature.

  • subscriptions (Variant[String,Array]) (defaults to: [])

    Default subscriptions used by the client

  • client_socket_enabled (Boolean) (defaults to: true)

    Boolean that determines if client socket will be enabled

  • client_address (String) (defaults to: $::ipaddress)

    Address of the client to report with checks

  • client_name (String) (defaults to: $::fqdn)

    Name of the client to report with checks

  • client_custom (Hash) (defaults to: {})

    Custom client variables.

  • client_deregister (Variant[Undef,Boolean]) (defaults to: undef)

    Enable the deregistration event if true.

  • client_deregistration (Variant[Undef,Hash]) (defaults to: undef)

    (https://sensuapp.org/docs/latest/reference/clients#deregistration-attributes) used to generate check result data for the de-registration event. Client deregistration attributes are merged with some default check definition attributes by the Sensu server during client deregistration, so any valid check definition attributes – including custom check definition attributes – may be used as deregistration attributes, with the following exceptions (which are used to ensure the check result is valid): check name, output, status, and issued timestamp. The following attributes are provided as recommendations for controlling client deregistration behavior.

  • client_registration (Variant[Undef,Hash]) (defaults to: undef)

    (https://sensuapp.org/docs/latest/reference/clients#registration-attributes) used to generate check result data for the registration event. Client registration attributes are merged with some default check definition attributes by the Sensu server during client registration.

  • client_keepalive (Hash) (defaults to: {})

    Client keepalive configuration

  • client_http_socket (Hash) (defaults to: {})

    Client http_socket configuration. Must be an Hash of parameters as described in: https://sensuapp.org/docs/latest/reference/clients.html#http-socket-attributes

  • client_servicenow (Hash) (defaults to: {})

    Client servicenow configuration. Supported only on Sensu Enterprise. It expects an Hash with a single key named 'configuration_item' containing an Hash of parameters, as described in: https://sensuapp.org/docs/latest/reference/clients.html#servicenow-attributes

  • client_ec2 (Hash) (defaults to: {})

    Client ec2 configuration. Supported only on Sensu Enterprise. It expects an Hash with valid paramters as described in: https://sensuapp.org/docs/latest/reference/clients.html#ec2-attributes

  • client_chef (Hash) (defaults to: {})

    Client chef configuration. Supported only on Sensu Enterprise. It expects an Hash with valid paramters as described in: https://sensuapp.org/docs/latest/reference/clients.html#chef-attributes

  • client_puppet (Hash) (defaults to: {})

    Client puppet configuration. Supported only on Sensu Enterprise. It expects an Hash with valid paramters as described in: https://sensuapp.org/docs/latest/reference/clients.html#puppet-attributes

  • safe_mode (Boolean) (defaults to: false)

    Force safe mode for checks

  • plugins (Variant[String,Array,Hash]) (defaults to: [])

    Plugins to install on the node Strings and Arrays of strings will set 'install_path' => '/etc/sensu/plugins' as default. Example string: 'puppet:///data/sensu/plugins/plugin1.rb' Example array: [ 'puppet:///data/sensu/plugins/plugin1.rb', 'puppet:///data/sensu/plugins/plugin2.rb' ] Example hash: { 'puppet:///data/sensu/plugins/plugin1.rb' => { 'pkg_version' => '2.4.2' }, 'puppet:///data/sensu/plugins/plugin1.rb' => { 'pkg_provider' => 'sensu-gem' }

  • plugins_defaults (Hash) (defaults to: {})

    Defaults for Plugins to install on the node. Will be added when plugins is set to a hash. Example value: { 'install_path' => '/other/path' }

  • plugins_dir (Optional[String]) (defaults to: undef)

    Puppet url to plugins directory

  • purge (Variant[Boolean,Hash]) (defaults to: false)

    If unused plugins, configs, handlers, extensions and mutators should be removed from the system. If set to true, all unused plugins, configs, handlers, extensions and mutators will be removed from the system. If set to a Hash, only unused files of the specified type(s) will be removed from the system. Valid values: true, false, Hash containing any of the keys 'plugins', 'config', 'handlers', 'extensions', 'mutators' Example value: { config => true, plugins => true }

  • use_embedded_ruby (Boolean) (defaults to: true)

    If the embedded ruby should be used, e.g. to install the sensu-plugin gem. This value is overridden by a defined sensu_plugin_provider. Note, the embedded ruby should always be used to provide full compatibility. Using other ruby runtimes, e.g. the system ruby, is not recommended.

  • rubyopt (Optional[String]) (defaults to: undef)

    Ruby opts to be passed to the sensu services

  • gem_path (Optional[String]) (defaults to: undef)

    Paths to add to GEM_PATH if we need to look for different dirs.

  • log_level (Enum['debug','info','warn','error','fatal']) (defaults to: 'info')

    Sensu log level to be used

  • log_dir (Stdlib::Absolutepath) (defaults to: '/var/log/sensu')

    Sensu log directory to be used

  • init_stop_max_wait (Variant[Integer,Pattern[/^(\d+)$/]]) (defaults to: 10)

    Number of seconds to wait for the init stop script to run

  • gem_install_options (Optional[Any]) (defaults to: undef)

    Optional configuration to use for the installation of the sensu plugin gem with sensu_gem provider. See: https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options Example value: [{ '-p' => 'http://user:pass@myproxy.company.org:8080' }]

  • hasrestart (Boolean) (defaults to: true)

    Value of hasrestart attribute for sensu services. If you use your own startup scripts for upstart and want puppet to properly stop and start sensu services when those scripts change, set it to false. See also http://upstart.ubuntu.com/faq.html#reload

  • enterprise_dashboard_auth (Optional[Any]) (defaults to: undef)

    Optional auth configuration for Enterprise Dashboard

  • enterprise_dashboard_oidc (Optional[Any]) (defaults to: undef)

    Optional OIDC configuration for Enterprise Dashboard

  • enterprise_dashboard_custom (Optional[Hash]) (defaults to: undef)

    List of custom attributes to include in the check. You can use it to pass any attribute that is not listed here explicitly. Example: { 'usersOptions' => { 'requireSilencingReason' => true } }

  • path (Variant[Stdlib::Absolutepath,Pattern[/^\$PATH$/]]) (defaults to: '$PATH')

    Used to set PATH in /etc/default/sensu

  • env_vars (Optional[Hash[String[1], Variant[String, Boolean, Integer]]]) (defaults to: {})

    Additional environment variables for /etc/default/sensu

  • redact (Optional[Array]) (defaults to: undef)

    Use to redact passwords from checks on the client side

  • deregister_on_stop (Boolean) (defaults to: false)

    Whether the sensu client should deregister from the API on service stop

  • deregister_handler (Optional[String]) (defaults to: undef)

    The handler to use when deregistering a client on stop.

  • handlers (Hash) (defaults to: {})

    Hash of handlers for use with create_resources(sensu::handler). Example value: { 'email' => { 'type' => 'pipe', 'command' => 'mail' } }

  • handler_defaults (Hash) (defaults to: {})

    Handler defaults when not provided explicitly in $handlers. Example value: { 'filters' => ['production'] }

  • checks (Hash) (defaults to: {})

    Hash of checks for use with create_resources(sensu::check). Example value: { 'check-cpu' => { 'command' => 'check-cpu.rb' } }

  • check_defaults (Hash) (defaults to: {})

    Check defaults when not provided explicitly in $checks. Example value: { 'occurrences' => 3 }

  • filters (Hash) (defaults to: {})

    Hash of filters for use with create_resources(sensu::filter). Example value: { 'occurrence' => { 'attributes' => { 'occurrences' => '1' } } }

  • filter_defaults (Hash) (defaults to: {})

    Filter defaults when not provided explicitly in $filters. Example value: { 'negate' => true }

  • package_checksum (Optional[String]) (defaults to: undef)

    Used to set package_checksum for windows installs

  • windows_logrotate (Boolean) (defaults to: false)

    Whether or not to use logrotate on Windows OS family.

  • windows_log_size (Variant[Integer,Pattern[/^(\d+)$/]]) (defaults to: 10240)

    The integer value for the size of log files on Windows OS family. sizeThreshold in sensu-client.xml.

  • windows_log_number (Variant[Integer,Pattern[/^(\d+)$/]]) (defaults to: 10)

    The integer value for the number of log files to keep on Windows OS family. keepFiles in sensu-client.xml.

  • windows_pkg_url (Optional[String]) (defaults to: undef)

    If specified, override the behavior of computing the package source URL from windows_repo_prefix and os major release fact. This parameter is intended to allow the end user to override the source URL used to install the Windows package. For example: "https://repositories.sensuapp.org/msi/2012r2/sensu-0.29.0-11-x64.msi"

  • windows_package_provider (Optional[String]) (defaults to: undef)

    When something other than undef, use the specified package provider to install Windows packages. The default behavior of undef defers to the default package provider in Puppet which is expected to be the msi provider. Valid values are undef or 'chocolatey'.

  • windows_choco_repo (Optional[String]) (defaults to: undef)

    The URL of the Chocolatey repository, used with the chocolatey windows package provider.

  • windows_package_name (String) (defaults to: 'Sensu')

    The package name used to identify the package filename. Defaults to 'sensu' which matches the MSI filename published at https://repositories.sensuapp.org/msi. Note, this is distinct from the windows_package_title, which is used to identify the package name as displayed in Add/Remove programs in Windows.

  • windows_package_title (String) (defaults to: 'sensu')

    The package name used to identify the package as listed in Add/Remove programs. Note this is distinct from the package filename identifier specified with windows_package_name.

  • windows_service_user (Optional[Struct[{NotUndef[user] => String, NotUndef[password] => String}]]) (defaults to: undef)

    The credentials to use for running the Windows service Takes the form of { 'user' => 'username', 'password' => 'secret' } replacing 'username' and 'secret' with appropriate values.

  • confd_dir (Optional[Variant[Stdlib::Absolutepath,Array[Stdlib::Absolutepath]]]) (defaults to: undef)

    Additional directories to load configuration snippets from.

  • heap_size (Variant[Integer,Pattern[/^(\d+)/],Undef]) (defaults to: undef)

    Value of the HEAP_SIZE environment variable. Note: This has effect only on Sensu Enterprise.

  • max_open_files (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)

    Value of the MAX_OPEN_FILES environment variable.

  • config_file (Variant[Stdlib::Absolutepath,Undef]) (defaults to: undef)

    Value of the CONFIG_FILE environment variable.

  • heap_dump_path (Variant[Undef,String]) (defaults to: undef)

    Value of the HEAP_DUMP_PATH environment variable.

  • java_opts (Variant[Undef,String]) (defaults to: undef)

    Value of the JAVA_OPTS environment variable.

  • enterprise_version (Pattern[/^absent$/,/^installed$/,/^latest$/,/^present$/,/^[\d\.\-]+$/]) (defaults to: 'latest')
  • enterprise_user (Optional[String]) (defaults to: undef)
  • enterprise_pass (Optional[String]) (defaults to: undef)
  • enterprise_dashboard_version (String) (defaults to: 'latest')
  • enterprise_repo_key_id (String) (defaults to: '910442FF8781AFD0995D14B311AB27E8C3FE3269')
  • client_bind (String) (defaults to: '127.0.0.1')
  • client_port (Integer) (defaults to: 3030)
  • purge_config (Boolean) (defaults to: false)
  • purge_plugins_dir (Boolean) (defaults to: false)
  • dashboard (Boolean) (defaults to: false)
  • enterprise_dashboard_base_path (Optional[String]) (defaults to: undef)
  • enterprise_dashboard_host (Optional[String]) (defaults to: undef)
  • enterprise_dashboard_port (Variant[Undef,Integer,Pattern[/^(\d+)$/]]) (defaults to: undef)
  • enterprise_dashboard_refresh (Optional[Any]) (defaults to: undef)
  • enterprise_dashboard_user (Optional[String]) (defaults to: undef)
  • enterprise_dashboard_pass (Optional[String]) (defaults to: undef)
  • enterprise_dashboard_ssl (Optional[Any]) (defaults to: undef)
  • enterprise_dashboard_audit (Optional[Any]) (defaults to: undef)
  • enterprise_dashboard_github (Optional[Any]) (defaults to: undef)
  • enterprise_dashboard_gitlab (Optional[Any]) (defaults to: undef)
  • enterprise_dashboard_ldap (Optional[Any]) (defaults to: undef)
  • windows_repo_prefix (Optional[String]) (defaults to: 'https://repositories.sensuapp.org/msi')
  • extensions (Hash) (defaults to: {})
  • mutators (Hash) (defaults to: {})


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
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
# File 'manifests/init.pp', line 349

class sensu (
  Pattern[/^absent$/, /^installed$/, /^latest$/, /^present$/, /^[\d\.\-el]+$/] $version = 'installed',
  String             $sensu_plugin_name = 'sensu-plugin',
  Optional[String]   $sensu_plugin_provider = $::osfamily ? {
    'windows' => 'gem',
    default   => undef,
  },
  Stdlib::Absolutepath $sensu_etc_dir = $::osfamily ? {
    'windows' => 'C:/opt/sensu',
    default   => '/etc/sensu',
  },
  Pattern[/^absent$/, /^installed$/, /^latest$/, /^present$/, /^\d[\d\.\-\w]+$/] $sensu_plugin_version = 'installed',
  Boolean            $install_repo = true,
  Boolean            $enterprise = false,
  Pattern[/^absent$/,/^installed$/,/^latest$/,/^present$/,/^[\d\.\-]+$/] $enterprise_version = 'latest',
  Optional[String]   $enterprise_user = undef,
  Optional[String]   $enterprise_pass = undef,
  Boolean            $enterprise_dashboard = false,
  String             $enterprise_dashboard_version = 'latest',
  Boolean            $manage_repo = true,
  Enum['main','unstable'] $repo = 'main',
  Optional[String]   $repo_source = undef,
  String             $repo_key_id = 'EE15CFF6AB6E4E290FDAB681A20F259AEB9C94BB',
  String             $repo_key_source = 'https://sensu.global.ssl.fastly.net/apt/pubkey.gpg',
  Optional[String]   $repo_release = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $spawn_limit = undef,
  String             $enterprise_repo_key_id = '910442FF8781AFD0995D14B311AB27E8C3FE3269',
  Boolean            $client = true,
  Boolean            $server = false,
  Boolean            $api = false,
  Boolean            $manage_services = true,
  Boolean            $client_service_enable = true,
  String             $client_service_ensure = running,
  Boolean            $server_service_enable = true,
  String             $server_service_ensure = running,
  Boolean            $manage_user = true,
  Boolean            $manage_plugins_dir = true,
  Boolean            $manage_handlers_dir = true,
  Boolean            $manage_mutators_dir = true,
  Optional[String]   $sensu_user = undef,
  Optional[String]   $sensu_group = undef,
  Optional[Stdlib::Filemode] $config_dir_mode = $::osfamily ? {
    'windows' => undef,
    default   => '0555',
  },
  Optional[Stdlib::Filemode] $config_file_mode = $::osfamily ? {
    'windows' => undef,
    default   => '0440',
  },
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $rabbitmq_port = undef,
  Optional[String]   $rabbitmq_host = undef,
  Optional[String]   $rabbitmq_user = undef,
  Optional[String]   $rabbitmq_password = undef,
  Optional[String]   $rabbitmq_vhost = undef,
  Optional[Boolean]  $rabbitmq_ssl = undef,
  Optional[String]   $rabbitmq_ssl_private_key = undef,
  Optional[String]   $rabbitmq_ssl_cert_chain = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $rabbitmq_prefetch = undef,
  Variant[Undef,Hash,Array]                  $rabbitmq_cluster = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $rabbitmq_heartbeat = undef,
  Optional[String]   $redis_host = '127.0.0.1',
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $redis_port = 6379,
  Optional[String]   $redis_password = undef,
  Boolean            $redis_reconnect_on_error = true,
  Integer            $redis_db = 0,
  Boolean            $redis_auto_reconnect = true,
  Boolean            $redis_tls = false,
  Optional[Array]    $redis_sentinels = undef,
  Optional[String]   $redis_master = undef,
  Enum['rabbitmq','redis'] $transport_type = 'rabbitmq',
  Boolean            $transport_reconnect_on_error = true,
  String             $api_bind = '0.0.0.0',
  String             $api_host = '127.0.0.1',
  Integer            $api_port = 4567,
  Optional[String]   $api_user = undef,
  Optional[String]   $api_password = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $api_ssl_port = undef,
  Optional[String]   $api_ssl_keystore_file = undef,
  Optional[String]   $api_ssl_keystore_password = undef,
  Variant[String,Array] $subscriptions = [],
  Boolean            $client_socket_enabled = true,
  String             $client_bind = '127.0.0.1',
  Integer            $client_port = 3030,
  String             $client_address =  $::ipaddress,
  String             $client_name =  $::fqdn,
  Hash               $client_custom = {},
  Variant[Undef,Boolean] $client_deregister = undef,
  Variant[Undef,Hash] $client_deregistration = undef,
  Variant[Undef,Hash] $client_registration = undef,
  Hash               $client_keepalive = {},
  Hash               $client_http_socket = {},
  Hash               $client_servicenow = {},
  Hash               $client_ec2 = {},
  Hash               $client_chef = {},
  Hash               $client_puppet = {},
  Boolean            $safe_mode = false,
  Variant[String,Array,Hash] $plugins = [],
  Hash               $plugins_defaults = {},
  Optional[String]   $plugins_dir = undef,
  Variant[Boolean,Hash] $purge = false,
  Boolean            $purge_config = false,
  Boolean            $purge_plugins_dir = false,
  Boolean            $use_embedded_ruby = true,
  Optional[String]   $rubyopt = undef,
  Optional[String]   $gem_path = undef,
  Enum['debug','info','warn','error','fatal'] $log_level = 'info',
  Stdlib::Absolutepath $log_dir = '/var/log/sensu',
  Boolean            $dashboard = false,
  Variant[Integer,Pattern[/^(\d+)$/]] $init_stop_max_wait = 10,
  Optional[Any]      $gem_install_options = undef,
  Boolean            $hasrestart = true,
  Optional[String]   $enterprise_dashboard_base_path = undef,
  Optional[String]   $enterprise_dashboard_host = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $enterprise_dashboard_port = undef,
  Optional[Any]      $enterprise_dashboard_refresh = undef,
  Optional[String]   $enterprise_dashboard_user = undef,
  Optional[String]   $enterprise_dashboard_pass = undef,
  Optional[Any]      $enterprise_dashboard_auth = undef,
  Optional[Any]      $enterprise_dashboard_ssl = undef,
  Optional[Any]      $enterprise_dashboard_audit = undef,
  Optional[Any]      $enterprise_dashboard_github = undef,
  Optional[Any]      $enterprise_dashboard_gitlab = undef,
  Optional[Any]      $enterprise_dashboard_ldap = undef,
  Optional[Any]      $enterprise_dashboard_oidc = undef,
  Optional[Hash]     $enterprise_dashboard_custom = undef,
  Variant[Stdlib::Absolutepath,Pattern[/^\$PATH$/]] $path = '$PATH',
  Optional[Hash[String[1], Variant[String, Boolean, Integer]]] $env_vars = {},
  Optional[Array]    $redact = undef,
  Boolean            $deregister_on_stop = false,
  Optional[String]   $deregister_handler = undef,
  Optional[String]   $package_checksum = undef,
  Optional[String]   $windows_pkg_url = undef,
  Optional[String]   $windows_repo_prefix = 'https://repositories.sensuapp.org/msi',
  Boolean            $windows_logrotate = false,
  Variant[Integer,Pattern[/^(\d+)$/]] $windows_log_number = 10,
  Variant[Integer,Pattern[/^(\d+)$/]] $windows_log_size = 10240,
  Optional[String]   $windows_package_provider = undef,
  Optional[String]   $windows_choco_repo = undef,
  String             $windows_package_name = 'Sensu',
  String             $windows_package_title = 'sensu',
  Optional[Struct[{NotUndef[user] => String, NotUndef[password] => String}]] $windows_service_user = undef,
  Optional[Variant[Stdlib::Absolutepath,Array[Stdlib::Absolutepath]]] $confd_dir = undef,
  Variant[Integer,Pattern[/^(\d+)/],Undef] $heap_size = undef,
  Variant[Stdlib::Absolutepath,Undef] $config_file = undef,
  Variant[Undef,Integer,Pattern[/^(\d+)$/]] $max_open_files = undef,
  Variant[Undef,String] $heap_dump_path = undef,
  Variant[Undef,String] $java_opts      = undef,
  ### START Hiera Lookups###
  Hash               $extensions = {},
  Hash               $handlers = {},
  Hash               $handler_defaults = {},
  Hash               $checks = {},
  Hash               $check_defaults = {},
  Hash               $filters = {},
  Hash               $filter_defaults = {},
  Hash               $mutators = {},
  ### END Hiera Lookups ###
) {

  case $::kernel {
    'Darwin': {
      $api_service_name  = 'org.sensuapp.sensu-api'
      $etc_dir           = $sensu_etc_dir
      $conf_dir          = "${etc_dir}/conf.d"
      $user              = '_sensu'
      $group             = 'wheel'
      $home_dir          = '/opt/sensu'
      $shell             = '/bin/false'
      $dir_mode          = $config_dir_mode
      $file_mode         = $config_file_mode
      $service_name      = 'org.sensuapp.sensu-client'
    }
    'Linux': {
      $api_service_name  = 'sensu-api'
      $etc_dir           = $sensu_etc_dir
      $conf_dir          = "${etc_dir}/conf.d"
      $user              = $sensu_user  ? {
        undef   => 'sensu',
        default => $sensu_user,
      }
      $group        = $sensu_group ? {
        undef   => 'sensu',
        default => $sensu_group,
      }
      $home_dir          = '/opt/sensu'
      $shell             = '/bin/false'
      $dir_mode          = $config_dir_mode
      $file_mode         = $config_file_mode
      $service_name      = 'sensu-client'
    }
    'windows': {
      $api_service_name  = undef
      $etc_dir           = $sensu_etc_dir
      $conf_dir          = "${etc_dir}/conf.d"
      $user              = $sensu_user  ? {
        undef   => 'NT Authority\SYSTEM',
        default => $sensu_user,
      }
      $group        = $sensu_group ? {
        undef   => 'Administrators',
        default => $sensu_group,
      }
      $home_dir          = $etc_dir
      $shell             = undef
      $dir_mode          = $config_dir_mode
      $file_mode         = $config_file_mode
      $service_name      = 'sensu-client'
    }
    default: {
      fail("Detected kernel is <${::kernel}> and must be Darwin, Linux or windows.")
    }
  }

  if $dashboard { fail('Sensu-dashboard is deprecated, use a dashboard module. See https://github.com/sensu/sensu-puppet#dashboards')}
  if $purge_config { fail('purge_config is deprecated, set the purge parameter to a hash containing `config => true` instead') }
  if $purge_plugins_dir { fail('purge_plugins_dir is deprecated, set the purge parameter to a hash containing `plugins => true` instead') }

  # sensu-enterprise supersedes sensu-server and sensu-api
  if ( $enterprise and $api ) or ( $enterprise and $server ) {
    fail('Sensu Enterprise: sensu-enterprise replaces sensu-server and sensu-api')
  }
  # validate enterprise repo credentials
  if $manage_repo {
    if ( $enterprise or $enterprise_dashboard ) and $install_repo {
      if $enterprise_user == undef or $enterprise_pass == undef {
        fail('The Sensu Enterprise repos require both enterprise_user and enterprise_pass to be set')
      }
    }
  }

  # Put here to avoid computing the conditionals for every check
  if $client and $manage_services {
    $client_service = Service['sensu-client']
  } else {
    $client_service = undef
  }

  if $enterprise and $manage_services {
    $enterprise_service = Service['sensu-enterprise']
  } else {
    $enterprise_service = undef
  }

  if $server {
    $server_service_class = Class['sensu::server::service']
  } else {
    $server_service_class = undef
  }

  if $api and $manage_services and $::osfamily != 'windows' {
    $api_service = $::osfamily ? {
      'Darwin' => Service['org.sensuapp.sensu-client'],
      default  => Service[$api_service_name],
    }
  } else {
    $api_service = undef
  }

  $_check_notify = [ $client_service, $server_service_class, $api_service, $enterprise_service ]
  $check_notify = $_check_notify.filter |$val| { $val =~ NotUndef }

  # Because you can't reassign a variable in puppet and we need to set to
  # false if you specify a directory, we have to use another variable.
  if $plugins_dir {
    $_manage_plugins_dir = false
  } else {
    $_manage_plugins_dir = $manage_plugins_dir
  }

  if $purge =~ Boolean {
    # If purge is a boolean, we either purge everything or purge nothing
    $_purge_plugins    = $purge
    $_purge_config     = $purge
    $_purge_handlers   = $purge
    $_purge_extensions = $purge
    $_purge_mutators   = $purge
  } else {
    # Default anything not specified to false
    $default_purge_hash = { plugins => false, config => false, handlers => false, extensions => false, mutators => false }
    $full_purge_hash = merge($default_purge_hash, $purge)
    validate_bool($full_purge_hash['plugins'], $full_purge_hash['config'], $full_purge_hash['handlers'], $full_purge_hash['extensions'], $full_purge_hash['mutators'])
    # Check that all keys are valid
    $invalid_keys = difference(keys($purge), keys($default_purge_hash))
    if !empty($invalid_keys) {
      fail("Invalid keys for purge parameter: ${invalid_keys}")
    }

    $_purge_plugins    = $full_purge_hash['plugins']
    $_purge_config     = $full_purge_hash['config']
    $_purge_handlers   = $full_purge_hash['handlers']
    $_purge_extensions = $full_purge_hash['extensions']
    $_purge_mutators   = $full_purge_hash['mutators']
  }

  # (#463) This well-known anchor serves as a reference point so all checks are
  # managed after all plugins.  It must always exist in the catalog.
  anchor { 'plugins_before_checks': }

  $extensions.each |$k,$v| {
    ::sensu::extension { $k:
      * => $v,
    }
  }
  $handlers.each |$k,$v| {
    ::sensu::handler { $k:
      * => $handler_defaults + $v,
    }
  }
  $checks.each |$k,$v| {
    ::sensu::check { $k:
      * => $check_defaults + $v,
    }
  }
  $filters.each |$k,$v| {
    ::sensu::filter { $k:
      * => $filter_defaults + $v,
    }
  }
  $mutators.each |$k,$v| {
    ::sensu::mutator { $k:
      * => $v,
    }
  }

  # Include everything and let each module determine its state.  This allows
  # transitioning to purged config and stopping/disabling services
  contain ::sensu::package
  contain ::sensu::enterprise
  contain ::sensu::transport
  contain ::sensu::rabbitmq::config
  contain ::sensu::api
  contain ::sensu::redis::config
  contain ::sensu::client
  contain ::sensu::server::service
  contain ::sensu::enterprise::dashboard

  Class['::sensu::package']
  -> Class['::sensu::transport']
  -> Class['::sensu::rabbitmq::config']
  -> Sensu_api_config[$::fqdn]
  -> Class['::sensu::redis::config']
  -> Sensu_client_config[$::fqdn]
  -> Class['::sensu::server::service']
  -> Class['::sensu::enterprise::dashboard']

  # Dependencies for Plugins #
  # Without this line, plugins installed with the sensu_gem provider may get
  # evaluated before the sensu package, which, on sensu package upgrades that
  # install a new version of Ruby, would mean that two runs of Puppet would be
  # necessary to get the plugins installed into the new embedded Ruby folder.
  Package['sensu']
  ~> Package<| provider == 'sensu_gem' |>
  ~> Service<| title == 'sensu-client' or title == 'sensu-server' or title == 'sensu-api'|>

  if $plugins_dir {
    sensu::plugin { $plugins_dir: type => 'directory' }
  } else {
    case $plugins {
      String,Array: { sensu::plugin { $plugins: } }
      Hash:         { create_resources('::sensu::plugin', $plugins, $plugins_defaults ) }
      default:      { fail('Invalid data type for $plugins, must be a string, an array, or a hash.') }
    }
  }
}