Update plugin recipe and template, remove plugin attribute files replaced by mon_setup

This commit is contained in:
Dave Shurtleff 2014-06-11 12:48:16 -04:00
parent 4d281b98f1
commit 6f9fa9a721
4 changed files with 9 additions and 79 deletions

View File

@ -1,6 +0,0 @@
default['mon-agent']['network']['instances'] = [
{
'collect_connection_state' => 'false',
'excluded_interfaces' => ['lo', 'lo0']
}
]

View File

@ -1,62 +0,0 @@
#### agent plugin checks for basenode
# Host alive check for api server
node.default[:mon_agent][:plugin][:host_alive][:init_config] = {
:ssh_port => 22,
:ssh_timeout => 0.5,
:ping_timeout => 1
}
node.default[:mon_agent][:plugin][:host_alive][:instances][:api_with_ssh] = {
:host_name => "192.168.10.4",
:alive_test => "ssh"
}
# Process checks: Everyone should be running ssh/sshd and ntpd
node.default[:mon_agent][:plugin][:process][:init_config] = {
}
node.default[:mon_agent][:plugin][:process][:instances][:ssh] = {
:name => "ssh",
:search_string => ["ssh", "sshd"]
}
node.default[:mon_agent][:plugin][:process][:instances][:ntpd] = {
:name => "ntpd",
:search_string => ["/usr/sbin/ntpd"],
:exact_match => "True"
}
# Service checks: For demo, everyone can check mon api
node.default[:mon_agent][:plugin][:http_check][:init_config] = {
}
node.default[:mon_agent][:plugin][:http_check][:instances][:monapi] = {
:name => "mon_api",
:url => "http://192.168.10.4:8080",
:timeout => 10,
:collect_response_time => "true",
:match_pattern => '.*status.*CURRENT.*',
}
node.default[:mon_agent][:plugin][:http_check][:instances][:monapi_health] = {
:name => "mon_api_health",
:url => "http://192.168.10.4:8081/healthcheck",
:timeout => 10,
:include_content => "true",
:collect_response_time => "true",
:match_pattern => '.*"healthy":true.*"healthy":true.*"healthy":true.*',
}
# mon_nagios_wrapper checks: For demo, everyone can check disk
#
#node.default[:mon_agent][:plugin][:nagios_wrapper][:init_config] = {
# :check_path => "/usr/lib/nagios/plugins:/usr/local/bin/nagios"
#}
#
#node.default[:mon_agent][:plugin][:nagios_wrapper][:instances][:check_disk] = {
# :service_name => "disk",
# :check_command => "check_disk -w 15\\% -c 5\\% -A -i /srv/node",
# :check_interval => 300
#}

View File

@ -15,18 +15,12 @@ package 'nagios-plugins-basic' do
only_if { node[:mon_agent][:plugin].has_key?(:nagios_wrapper) }
end
# Make sure the datadog conf.d directory exists
directory "/etc/mon-agent/conf.d" do
recursive true
action :create
owner node['mon_agent']['owner']
group node['mon_agent']['group']
mode 0755
end
# Configures the plugin yaml files based on node[:mon_agent][:plugin]
# attributes
node[:mon_agent][:plugin].each_key do |plugin|
if not node[:mon_agent][:plugin][plugin].has_key?(:init_config):
node[:mon_agent][:plugin][plugin][:init_config] = {}
end
template "/etc/mon-agent/conf.d/#{plugin}.yaml" do
source "plugin_yaml.erb"
action :create

View File

@ -15,14 +15,18 @@ instances:
<% inst.sort.each do |key, value| %>
<% if new_item %>
<% if value.is_a?(Array) %>
<%= " - #{key}: "%> [<%= value.sort.map { |val| %Q/"#{val}"/ }.join(', ') %>]
<%= " - #{key}: "%>[<%= value.sort.map { |val| %Q/"#{val}"/ }.join(', ') %>]
<% elsif value.is_a?(Hash) %>
<%= " - #{key}: "%><%= value.sort.map { |hkey, hval| %Q/#{hkey}:#{hval}/ }.join(', ') %>
<% else %>
<%= " - #{key}: #{value}" %>
<% end %>
<% new_item = FALSE %>
<% else %>
<% if value.is_a?(Array) %>
<%= " #{key}: "%> [<%= value.sort.map { |val| %Q/"#{val}"/ }.join(', ') %>]
<%= " #{key}: "%>[<%= value.sort.map { |val| %Q/"#{val}"/ }.join(', ') %>]
<% elsif value.is_a?(Hash) %>
<%= " #{key}: "%>[<%= value.sort.map { |hkey, hval| %Q/#{hkey}:#{hval}/ }.join(', ') %>
<% else %>
<%= " #{key}: #{value}" %>
<% end %>