%
rubber_scripts = `#{Rubber.root}/#{rubber_env.rubber_collectd_runner} config`.split("\n") rescue []
@path = '/etc/collectd/collectd.conf'
@post = "mkdir -p /etc/collectd/conf.d/ /etc/collectd/thresholds.d/ /etc/collectd/filters.d/ /etc/collectd/plugins/ "
%>
# Config file for collectd(1). Generated by Rubber
#
# Some plugins need additional configuration and are disabled by default.
# Please read collectd.conf(5) for details.
#
# You should also read /usr/share/doc/collectd-core/README.Debian.plugins
# before enabling any more plugins.
Hostname "<%= rubber_env.host %>"
#BaseDir "/var/lib/collectd"
#PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db" "/etc/collectd/types.db"
Interval 60
#Timeout 2
#ReadThreads 5
LoadPlugin syslog
LogLevel info
LoadPlugin cpu
LoadPlugin df
LoadPlugin disk
LoadPlugin exec
LoadPlugin entropy
LoadPlugin interface
LoadPlugin irq
LoadPlugin load
LoadPlugin memory
LoadPlugin processes
#LoadPlugin python
LoadPlugin rrdtool
<% if `swapon -s | wc -l`.to_i > 1 %>
LoadPlugin swap
<% end %>
#LoadPlugin table
#LoadPlugin tail
#LoadPlugin tcpconns
LoadPlugin users
LoadPlugin notify_email
From "collectd@<%= rubber_env.full_host %>"
Recipient "<%= rubber_env.admin_email %>"
Subject "Collectd notify: %s@%s"
<%
if rubber_scripts.size > 0
%>
Exec <%= rubber_env.app_user %> "/bin/bash" "-l" "-c" "cd <%= "/mnt/#{rubber_env.app_name}-#{Rubber.env}/current" %> && bundle exec <%= rubber_env.rubber_collectd_runner %>"
<% end %>
<%
ping_hosts = []
if rubber_instances[rubber_env.host].role_names.include?('graphite_server')
# monitor all servers from graphite_server
ping_hosts = rubber_instances.collect {|ic| ic.full_name }.select {|h| h != rubber_env.full_host }
elsif rubber_instances[rubber_env.host].role_names.include?('web_tools')
# monitor just graphite_server from tools
ping_hosts = [rubber_instances.for_role('graphite_server').first.full_name]
end
%>
<% if ping_hosts.size > 0 %>
LoadPlugin ping
<% ping_hosts.each do |h| %>
Host "<%= h %>"
<% end %>
<% end %>
Include "/etc/collectd/conf.d/*.conf"
Include "/etc/collectd/thresholds.d/*.conf"
Include "/etc/collectd/filters.d/*.conf"