-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#658) Manage the when attribute of sensu filters
Without this patch sensu filters are unable to manage the [when attribute](https://sensuapp.org/docs/0.26/reference/filters.html#when-attributes) This patch implements the `when` property on the sensu_filter type and json provider. The `sensu::filter` defined type is also updated to support the `when` parameter. The behavior may be exercised with `vagrant up el7-client`. This will produce `/etc/sensu/conf.d/filters/offhours.json` with the content of: { "filters": { "offhours": { "attributes": { "client": { "environment": "production" } }, "when": { "days": { "all": [ { "begin": "2:00 AM", "end": "1:00 AM" } ] } }, "negate": false } } }
- Loading branch information
1 parent
37e5fae
commit e43ab62
Showing
6 changed files
with
109 additions
and
14 deletions.
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
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
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 |
---|---|---|
@@ -1,16 +1,54 @@ | ||
# 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'] | ||
} | ||
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, | ||
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, | ||
} | ||
} |