forked from sensu/sensu-puppet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP (sensu#637) Add check proxy_requests functionality
Left off setting up an example for proxy request checks using Vagrant. Pick back up here following the proxy requests guide: https://sensuapp.org/docs/0.29/reference/checks.html#proxy-requests-attributes
- Loading branch information
1 parent
9e5b3d9
commit 35830c0
Showing
5 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,5 +88,4 @@ def set_property(property, value) | |
conf['checks'][resource[:name]][property.to_s] = value | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Proxy Client. See: | ||
# https://sensuapp.org/docs/latest/guides/getting-started/adding-a-client.html#proxy-clients | ||
node default { | ||
$filters = { | ||
'offhours' => { | ||
'attributes' => { | ||
'client' => { | ||
'environment' => 'production', | ||
}, | ||
}, | ||
'when' => { | ||
'days' => { | ||
'all' => [ | ||
{ | ||
'begin' => '2:00 AM', | ||
'end' => '1:00 AM', | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
$filter_defaults = { | ||
'when' => { | ||
'days' => { | ||
'all' => [ | ||
{ | ||
'begin' => '2:00 AM', | ||
'end' => '1:00 AM', | ||
}, | ||
], | ||
}, | ||
}, | ||
} | ||
|
||
# Use the internal 192.168.56.* address | ||
if $facts['networking']['interfaces']['eth1'] != undef { | ||
$ip = $facts['networking']['interfaces']['eth1']['ip'] | ||
} elsif $facts['networking']['interfaces']['enp0s8'] != undef { | ||
$ip = $facts['networking']['interfaces']['enp0s8']['ip'] | ||
} else { | ||
$ip = $facts['networking']['ip'] | ||
} | ||
|
||
class { '::sensu': | ||
rabbitmq_password => 'correct-horse-battery-staple', | ||
rabbitmq_host => '192.168.56.10', | ||
rabbitmq_vhost => '/sensu', | ||
subscriptions => 'all', | ||
client_address => $ip, | ||
filters => $filters, | ||
filter_defaults => $filter_defaults, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# This test manifest is intended to layer on top of the sensu-server Vagrant VM. | ||
# It defines additional checks executed using proxy clients. To add a remote | ||
# proxy client, use the Uchiwa UI at http://localhost:3000/#/clients and add a | ||
# client like so. Once added, request a check for `remote_http` and it will | ||
# automatically run against the Google proxy client. | ||
# | ||
# { | ||
# "address": "www.google.com", | ||
# "keepalives": false, | ||
# "name": "google", | ||
# "subscriptions": [ | ||
# "client:google", | ||
# "http" | ||
# ], | ||
# "type": "proxy" | ||
# } | ||
node 'sensu-server' { | ||
Package { | ||
ensure => installed, | ||
} | ||
Sensu::Plugin { | ||
type => 'package', | ||
pkg_provider => 'sensu_gem', | ||
pkg_version => 'installed', | ||
require => [Package['gcc-c++']], | ||
} | ||
|
||
class { '::sensu': | ||
install_repo => true, | ||
server => true, | ||
manage_services => true, | ||
manage_user => true, | ||
rabbitmq_password => 'correct-horse-battery-staple', | ||
rabbitmq_vhost => '/sensu', | ||
api => true, | ||
api_user => 'admin', | ||
api_password => 'secret', | ||
client_address => $::ipaddress_eth1, | ||
subscriptions => ['all', 'poller', 'proxytarget', 'roundrobin:poller'], | ||
} | ||
|
||
sensu::handler { 'default': | ||
command => 'mail -s \'sensu alert\' [email protected]', | ||
} | ||
|
||
sensu::check { 'check_ntp': | ||
command => 'PATH=$PATH:/usr/lib64/nagios/plugins check_ntp_time -H pool.ntp.org -w 30 -c 60', | ||
handlers => 'default', | ||
subscribers => 'sensu-test', | ||
} | ||
|
||
# sensu-plugins-http requires a c++ compiler during install | ||
package { 'gcc-c++': } | ||
|
||
# (#637) Create a [Proxy | ||
# Check](https://sensuapp.org/docs/latest/reference/checks.html#proxy-requests-attributes) | ||
# This needs to have a corresponding sensu-client matching the client | ||
# attributes. | ||
sensu::plugin { 'sensu-plugins-http': } | ||
|
||
# A client defined in the Dashboard with a subscription of "http" will | ||
# automatically have this check associated with it. | ||
sensu::check { 'remote_http': | ||
command => "/opt/sensu/embedded/bin/check-http.rb -u http://:::address:::", | ||
occurrences => 2, | ||
interval => 300, | ||
refresh => 600, | ||
low_flap_threshold => 20, | ||
high_flap_threshold => 60, | ||
standalone => false, | ||
subscribers => 'roundrobin:poller', | ||
custom => { | ||
'proxy_requests' => { | ||
'client_attributes' => { | ||
'subscriptions' => 'eval: value.include?("http")' | ||
} | ||
} | ||
}, | ||
} | ||
# Similar to above, but not using round robin checks. | ||
sensu::check { 'remote_http-dashboard': | ||
command => "/opt/sensu/embedded/bin/check-http.rb -u http://:::address::::3000", | ||
occurrences => 2, | ||
interval => 300, | ||
refresh => 600, | ||
low_flap_threshold => 20, | ||
high_flap_threshold => 60, | ||
standalone => false, | ||
subscribers => 'poller', | ||
custom => { | ||
'proxy_requests' => { | ||
'client_attributes' => { | ||
'subscriptions' => 'eval: value.include?("proxytarget")' | ||
} | ||
} | ||
}, | ||
} | ||
} |