Skip to content

Instantly share code, notes, and snippets.

@acqant
Created December 11, 2018 15:33
Show Gist options
  • Save acqant/a6727368bd900e2a29557ce3168cae1b to your computer and use it in GitHub Desktop.
Save acqant/a6727368bd900e2a29557ce3168cae1b to your computer and use it in GitHub Desktop.
Databag:
{
'sensu_checks':
{
'ntp_check':
{
'sensu_check': 'ntp',
'command': "#{nagios_path}/check_ntp_time -H localhost -w 0.5 -c 1",
'handlers': ['almn_client'],
'subscribers': ['all'],
'interval': 120,
'additional': { condition: 'ntp-offset-error', notification: 'NTP Offset Error', occurrences: 3, refresh: 86_400, low_flap_threshold: 5, high_flap_threshold: 25 }
},
# cookbook
case node['platform']
when 'debian', 'ubuntu'
nagios_path = '/usr/lib/nagios/plugins'
when 'redhat', 'centos', 'fedora', 'amazon', 'scientific', 'oracle'
nagios_path = '/usr/lib64/nagios/plugins'
end
node['gb']['sensu_checks'].each do |check|
data = check[1]
s = data['command']
command = eval("s")
log("#{command}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment