Skip to content

Commit

Permalink
Merge pull request #932 from treydock/sensu2-docs
Browse files Browse the repository at this point in the history
Sensu2 docs
  • Loading branch information
ghoneycutt authored Jul 30, 2018
2 parents 992eb77 + d4edf5a commit c330c51
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 29 deletions.
4 changes: 0 additions & 4 deletions lib/puppet/provider/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ def convert_boolean_property_value(value)
end
end

#def self.sensuctl(args)
# execute(['sensuctl'] + args, combine: false, failonfail: true)
#end

def self.sensuctl_list(command)
args = [command]
args << 'list'
Expand Down
19 changes: 17 additions & 2 deletions lib/puppet/type/sensu_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
handlers => ['email'],
interval => 60,
}
@example Create a check that is subdued
sensu_check { 'test':
ensure => 'present',
command => 'test.sh',
subscriptions => ['linux'],
handlers => ['email'],
interval => 60,
subdue_days => {
'all' => [
{ 'begin' => '8:00 AM', 'end' => '5:00 PM' },
],
'friday' => [
{ 'begin' => '7:00 AM', 'end' => '6:00 PM' },
],
}
}
DESC

extend PuppetX::Sensu::Type
Expand Down Expand Up @@ -127,8 +144,6 @@
newvalues(:true, :false)
end

# extended_attributes

newproperty(:organization) do
desc "The Sensu RBAC organization that this check belongs to."
defaultto 'default'
Expand Down
15 changes: 14 additions & 1 deletion lib/puppet/type/sensu_silenced.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
Puppet::Type.newtype(:sensu_silenced) do
desc <<-DESC
Manages Sensu silencing
@example Create a silencing
The name of `sensu_silenced` can be used to define `check` and `subscription`.
@example Create a silencing for all checks with subscription entity:sensu_agent
sensu_silenced { 'test':
ensure => 'present',
subscription => 'entity:sensu_agent',
}
@example Define silencing using composite name where `subscription=entity:sensu_agent` and `check=*`.
sensu_silenced { 'entity:sensu_agent:*':
ensure => 'present',
}
@example Define silencing using composite name where `subscription=linux` and `check=check-http`.
sensu_silenced { 'linux:check-http':
ensure => 'present',
}
DESC

extend PuppetX::Sensu::Type
Expand Down
17 changes: 12 additions & 5 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
#
# Class to manage the Sensu agent.
#
# @example
# class { 'sensu::agent':
# config_hash => {
# 'backend-url' => 'ws://sensu-backend.example.com:8081',
# }
# }
#
# @param version
# Version of sensu agent to install. Defaults to `installed` to support
# Windows MSI packaging and to avoid surprising upgrades.
# @param package_name
# Name of Sensu agent package. Defaults to `sensu-agent`.
# Name of Sensu agent package.
# @param service_name
# Name of the Sensu agent service. Defaults to `sensu-agent`.
# Name of the Sensu agent service.
# @param service_ensure
# Sensu agent service ensure value. Defaults to `running`.
# Sensu agent service ensure value.
# @param service_enable
# Sensu agent service enable value. Defaults to `true`
# Sensu agent service enable value.
# @param config_hash
# Sensu agent configuration hash used to define agent.yml. Defaults to `{}`
# Sensu agent configuration hash used to define agent.yml.
#
class sensu::agent (
Optional[String] $version = undef,
Expand Down
21 changes: 11 additions & 10 deletions manifests/backend.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,34 @@
#
# Class to manage the Sensu backend.
#
# @example
# class { 'sensu::backend':
# password => 'secret',
# }
#
# @param version
# Version of sensu backend to install. Defaults to `installed` to support
# Windows MSI packaging and to avoid surprising upgrades.
# @param package_name
# Name of Sensu backend package. Defaults to `sensu-backend`.
# Name of Sensu backend package.
# @param cli_package_name
# Name of Sensu CLI package. Defaults to `sensu-cli`.
# Name of Sensu CLI package.
# @param service_name
# Name of the Sensu backend service. Defaults to `sensu-backend`.
# Name of the Sensu backend service.
# @param service_ensure
# Sensu backend service ensure value. Defaults to `running`.
# Sensu backend service ensure value.
# @param service_enable
# Sensu backend service enable value. Defaults to `true`
# Sensu backend service enable value.
# @param config_hash
# Sensu backend configuration hash used to define backend.yml. Defaults to `{}`
# Sensu backend configuration hash used to define backend.yml.
# @param url_host
# Sensu backend host used to configure sensuctl and verify API access.
# Defaults to `127.0.0.1`.
# @param url_port
# Sensu backend port used to configure sensuctl and verify API access.
# Defaults to `8080`.
# @param username
# Sensu backend admin username used to confiure sensuctl.
# Default to `admin`.
# @param password
# Sensu backend admin password used to confiure sensuctl.
# Default to `P@ssw0rd!`
#
class sensu::backend (
Optional[String] $version = undef,
Expand Down
18 changes: 11 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
#
# This is the main Sensu class
#
# @param version Version of Sensu to install. Defaults to `installed` to support
# @param version
# Version of Sensu to install. Defaults to `installed` to support
# Windows MSI packaging and to avoid surprising upgrades.
#
# @param etc_dir Absolute path to the Sensu etc directory. Default:
# '/etc/sensu' and 'C:/opt/sensu' on windows.
# @param etc_dir
# Absolute path to the Sensu etc directory.
# Default: '/etc/sensu' and 'C:/opt/sensu' on windows.
#
# @param etc_dir_purge Boolean to determine if the etc_dir should be purged
# such that only Puppet managed files are present.
# @param etc_dir_purge
# Boolean to determine if the etc_dir should be purged
# such that only Puppet managed files are present.
#
# @param manage_repo Boolean to determine if software repository for Sensu
# should be managed.
# @param manage_repo
# Boolean to determine if software repository for Sensu
# should be managed.
#
class sensu (
String $version = 'installed',
Expand Down

0 comments on commit c330c51

Please sign in to comment.