Update to agent version 1.0.24
Change-Id: I0233520384052064df1d8ac3888db2c0b5d91114
This commit is contained in:
parent
8dc8415fab
commit
3930651a0e
@ -14,26 +14,24 @@ class monasca::agent(
|
||||
$password,
|
||||
$keystone_url,
|
||||
$service,
|
||||
$project_name = 'services',
|
||||
$hostname = undef,
|
||||
$dimensions = 'None',
|
||||
$project_name = 'null',
|
||||
$project_domain_id = 'null',
|
||||
$project_domain_name = 'null',
|
||||
$project_id = 'null',
|
||||
$ca_file = undef,
|
||||
$max_buffer_size = '1000',
|
||||
$backlog_send_rate = '1000',
|
||||
$amplifier = '0',
|
||||
$hostname = undef,
|
||||
$dimensions = {},
|
||||
$recent_point_threshold = '30',
|
||||
$use_mount = 'no',
|
||||
$check_freq = '15',
|
||||
$listen_port = '17123',
|
||||
$non_local_traffic = 'no',
|
||||
$system_metrics = 'cpu,disk,io,load,memory',
|
||||
$device_blacklist_re = '.*\/dev\/mapper\/lxc-box.*',
|
||||
$ignore_filesystem_types = 'tmpfs,devtmpfs',
|
||||
$statsd_port = '8125',
|
||||
$statsd_interval = '10',
|
||||
$statsd_normalize = 'yes',
|
||||
$statsd_forward_host = undef,
|
||||
$statsd_forward_port = '8125',
|
||||
|
||||
$log_level = 'INFO',
|
||||
$collector_log_file = '/var/log/monasca/agent/collector.log',
|
||||
$forwarder_log_file = '/var/log/monasca/agent/forwarder.log',
|
||||
@ -54,9 +52,6 @@ class monasca::agent(
|
||||
$additional_checksd = "${agent_dir}/checks.d"
|
||||
$conf_dir = "${agent_dir}/conf.d"
|
||||
|
||||
File[$agent_dir] -> Agent_config<||>
|
||||
Agent_config<||> ~> Service['monasca-agent']
|
||||
|
||||
if $::monasca::params::agent_package {
|
||||
if $install_python_deps {
|
||||
package { ['python-virtualenv', 'python-dev']:
|
||||
@ -102,6 +97,15 @@ class monasca::agent(
|
||||
require => File[$::monasca::monasca_dir],
|
||||
}
|
||||
|
||||
file { "${agent_dir}/agent.yaml":
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
content => template('monasca/agent.yaml.erb'),
|
||||
require => File[$agent_dir],
|
||||
before => Service['monasca-agent'],
|
||||
}
|
||||
|
||||
file { $additional_checksd:
|
||||
ensure => 'directory',
|
||||
owner => 'root',
|
||||
@ -156,82 +160,4 @@ class monasca::agent(
|
||||
ensure => $ensure,
|
||||
name => $::monasca::params::agent_service,
|
||||
}
|
||||
|
||||
if $hostname {
|
||||
agent_config {
|
||||
'Main/hostname' : value => $hostname;
|
||||
}
|
||||
}
|
||||
else {
|
||||
agent_config {
|
||||
'Main/hostname' : ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $ca_file {
|
||||
agent_config {
|
||||
'Api/insecure' : value => false;
|
||||
'Api/ca_file' : value => $ca_file;
|
||||
}
|
||||
}
|
||||
else {
|
||||
agent_config {
|
||||
'Api/insecure' : value => true;
|
||||
'Api/ca_file' : ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $statsd_forward_host {
|
||||
agent_config {
|
||||
'Statsd/monasca_statsd_forward_host' : value => $statsd_forward_host;
|
||||
'Statsd/monasca_statsd_statsd_forward_port' : value => $statsd_forward_port;
|
||||
}
|
||||
}
|
||||
else {
|
||||
agent_config {
|
||||
'Statsd/monasca_statsd_forward_host' : ensure => absent;
|
||||
'Statsd/monasca_statsd_statsd_forward_port' : ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
if $syslog_host and $syslog_port {
|
||||
agent_config {
|
||||
'Logging/syslog_host' : value => $syslog_host;
|
||||
'Logging/syslog_port' : value => $syslog_port;
|
||||
}
|
||||
}
|
||||
else {
|
||||
agent_config {
|
||||
'Logging/syslog_host' : ensure => absent;
|
||||
'Logging/syslog_port' : ensure => absent;
|
||||
}
|
||||
}
|
||||
|
||||
agent_config {
|
||||
'Api/url': value => $url;
|
||||
'Api/username': value => $username;
|
||||
'Api/password': value => $password;
|
||||
'Api/keystone_url': value => $keystone_url;
|
||||
'Api/project_name': value => $project_name;
|
||||
'Api/max_buffer_size': value => $max_buffer_size;
|
||||
'Api/backlog_send_rate': value => $backlog_send_rate;
|
||||
'Api/amplifier': value => $amplifier;
|
||||
'Main/dimensions' : value => $dimensions;
|
||||
'Main/recent_point_threshold': value => $recent_point_threshold;
|
||||
'Main/use_mount': value => $use_mount;
|
||||
'Main/listen_port': value => $listen_port;
|
||||
'Main/additional_checksd': value => $additional_checksd;
|
||||
'Main/non_local_traffic': value => $non_local_traffic;
|
||||
'Main/system_metrics': value => $system_metrics;
|
||||
'Main/device_blacklist_re': value => $device_blacklist_re;
|
||||
'Main/ignore_filesystem_types': value => $ignore_filesystem_types;
|
||||
'Statsd/monasca_statsd_port': value => $statsd_port;
|
||||
'Statsd/monasca_statsd_interval': value => $statsd_interval;
|
||||
'Statsd/monasca_statsd_normalize': value => $statsd_normalize;
|
||||
'Logging/log_level': value => $log_level;
|
||||
'Logging/collector_log_file': value => $collector_log_file;
|
||||
'Logging/forwarder_log_file': value => $forwarder_log_file;
|
||||
'Logging/monstatsd_log_file': value => $monstatsd_log_file;
|
||||
'Logging/log_to_syslog': value => $log_to_syslog;
|
||||
}
|
||||
}
|
||||
|
@ -24,22 +24,16 @@
|
||||
# [**monasca_ini**]
|
||||
# (optional) Allow configuration of monasca.ini configurations.
|
||||
#
|
||||
# [**agent_conf**]
|
||||
# (optional) Allow configuration of monasca.ini configurations.
|
||||
#
|
||||
# NOTE: The configuration MUST NOT be already handled by this module
|
||||
# or Puppet catalog compilation will fail with duplicate resources.
|
||||
#
|
||||
class monasca::config (
|
||||
$monasca_config = {},
|
||||
$monasca_config = {},
|
||||
$monasca_ini = {},
|
||||
$agent_config = {},
|
||||
) {
|
||||
validate_hash($monasca_config)
|
||||
validate_hash($monasca_ini)
|
||||
validate_hash($agent_config)
|
||||
|
||||
create_resources('monasca_config', $monasca_config)
|
||||
create_resources('monasca_ini', $monasca_ini)
|
||||
create_resources('agent_config', $agent_config)
|
||||
}
|
||||
|
52
templates/agent.yaml.erb
Normal file
52
templates/agent.yaml.erb
Normal file
@ -0,0 +1,52 @@
|
||||
Api:
|
||||
url: <%= @url %>
|
||||
username: <%= @username %>
|
||||
password: <%= @password %>
|
||||
keystone_url: <%= @keystone_url %>
|
||||
project_name: <%= @project_name %>
|
||||
project_domain_id: <%= @project_domain_id %>
|
||||
project_domain_name: <%= @project_domain_name %>
|
||||
project_id: <%= @project_id %>
|
||||
<%- if @ca_file -%>
|
||||
insecure: false
|
||||
ca_file: <%= @ca_file %>
|
||||
<%- else -%>
|
||||
insecure: true
|
||||
<%- end -%>
|
||||
max_buffer_size: <%= @max_buffer_size %>
|
||||
backlog_send_rate: <%= @backlog_send_rate %>
|
||||
amplifier: <%= @amplifier %>
|
||||
|
||||
Main:
|
||||
<%- if @hostname -%>
|
||||
hostname: <%= @hostname %>
|
||||
<%- end -%>
|
||||
dimensions:
|
||||
service: <%= @service %>
|
||||
<%- @dimensions.each_pair do |key, value| -%>
|
||||
<%= key %>: <%= value %>
|
||||
<%- end -%>
|
||||
recent_point_threshold: <%= @recent_point_threshold %>
|
||||
check_freq: <%= @check_freq %>
|
||||
listen_port: <%= @listen_port %>
|
||||
additional_checksd: <%= @additional_checksd %>
|
||||
non_local_traffic: <%= @non_local_traffic %>
|
||||
|
||||
Statsd:
|
||||
monasca_statsd_port: <%= @statsd_port %>
|
||||
monasca_statsd_interval : <%= @statsd_interval %>
|
||||
<%- if @statsd_forward_host -%>
|
||||
monasca_statsd_forward_host: <%= @statsd_forward_host %>
|
||||
monasca_statsd_statsd_forward_port: <%= @statsd_forward_port %>
|
||||
<%- end -%>
|
||||
|
||||
Logging:
|
||||
log_level: <%= @log_level %>
|
||||
collector_log_file: <%= @collector_log_file %>
|
||||
forwarder_log_file: <%= @forwarder_log_file %>
|
||||
statsd_log_file: <%= @monstatsd_log_file %>
|
||||
log_to_syslog: <%= @log_to_syslog %>
|
||||
<%- if @syslog_host and @syslog_port -%>
|
||||
syslog_host: <%= @syslog_host %>
|
||||
syslog_port: <%= @syslog_port %>
|
||||
<%- end -%>
|
@ -12,18 +12,18 @@
|
||||
|
||||
. <%= @virtual_env %>/bin/activate
|
||||
. /lib/lsb/init-functions
|
||||
PATH=$PATH:<%= @virtual_env %>/bin # supervisord might live here
|
||||
PATH=$PATH:/sbin # add the location of start-stop-daemon on Debian
|
||||
export PYTHONPATH=$PYTHONPATH:/usr/monasca/agent/
|
||||
|
||||
AGENTPATH="<%= @virtual_env %>/bin/monasca-collector"
|
||||
AGENTCONF="/etc/monasca/agent/agent.conf"
|
||||
MONSTATSDPATH="<%= @virtual_env %>/bin/monasca-statsd"
|
||||
AGENTCONF="/etc/monasca/agent/agent.yaml"
|
||||
MONASCASTATSDPATH="<%= @virtual_env %>/bin/monasca-statsd"
|
||||
AGENTUSER="monasca-agent"
|
||||
FORWARDERPATH="<%= @virtual_env %>/bin/monasca-forwarder"
|
||||
NAME="monasca-agent"
|
||||
DESC="Monasca Monitoring Agent"
|
||||
AGENT_PID_PATH="/var/tmp/monasca-agent.pid"
|
||||
SUPERVISOR_PIDFILE="/var/tmp/monasca-agent-supervisord.pid"
|
||||
AGENT_PID_PATH="/var/run/monasca-agent.pid"
|
||||
SUPERVISOR_PIDFILE="/var/run/monasca-agent-supervisord.pid"
|
||||
SUPERVISOR_FILE="<%= @virtual_env %>/share/monasca/agent/supervisor.conf"
|
||||
SUPERVISOR_SOCK="/var/tmp/monasca-agent-supervisor.sock"
|
||||
SUPERVISORD=$(which supervisord)
|
||||
@ -88,7 +88,7 @@ case "$1" in
|
||||
|
||||
|
||||
log_daemon_msg "Starting $DESC (using supervisord)" "$NAME"
|
||||
start-stop-daemon --start --quiet --oknodo --exec $SUPERVISORD -- -c $SUPERVISOR_FILE -u $AGENTUSER --pidfile $SUPERVISOR_PIDFILE
|
||||
start-stop-daemon --start --quiet --oknodo --exec $SUPERVISORD -- -c $SUPERVISOR_FILE --pidfile $SUPERVISOR_PIDFILE
|
||||
if [ $? -ne 0 ]; then
|
||||
log_end_msg 1
|
||||
fi
|
||||
@ -115,7 +115,7 @@ case "$1" in
|
||||
|
||||
log_daemon_msg "Stopping $DESC (stopping supervisord)" "$NAME"
|
||||
start-stop-daemon --stop --retry 30 --quiet --oknodo --pidfile $SUPERVISOR_PIDFILE
|
||||
|
||||
|
||||
log_end_msg $?
|
||||
|
||||
;;
|
||||
@ -126,11 +126,11 @@ case "$1" in
|
||||
# (right now only monasca-agent supports additional flags)
|
||||
su $AGENTUSER -c "$AGENTPATH info $@"
|
||||
COLLECTOR_RETURN=$?
|
||||
su $AGENTUSER -c "$MONSTATSDPATH info"
|
||||
MONSTATSD_RETURN=$?
|
||||
su $AGENTUSER -c "$MONASCASTATSDPATH info"
|
||||
MONASCASTATSD_RETURN=$?
|
||||
su $AGENTUSER -c "$FORWARDERPATH info"
|
||||
FORWARDER_RETURN=$?
|
||||
exit $(($COLLECTOR_RETURN+$MONSTATSD_RETURN+$FORWARDER_RETURN))
|
||||
exit $(($COLLECTOR_RETURN+$MONASCASTATSD_RETURN+$FORWARDER_RETURN))
|
||||
;;
|
||||
|
||||
status)
|
||||
@ -165,4 +165,4 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
exit $?
|
Loading…
Reference in New Issue
Block a user