Puppet analytics class added

This commit contains puppet code, files and templates
to deploy the software packages and configuration
for contrail analytics service.

Change-Id: I72f0b3b52c50d8772f339ec2f3af80099872a608
This commit is contained in:
Oleksandr Martsyniuk
2015-08-19 16:52:23 +03:00
parent 7fbbe0fb5a
commit b9e3f353f4
10 changed files with 373 additions and 1 deletions

View File

@@ -19,7 +19,8 @@ Exec { path => '/bin:/sbin:/usr/bin:/usr/sbin', refresh => 'echo NOOP_ON_REFRESH
if $contrail::node_name =~ /^contrail.\d+$/ {
class { 'contrail::database': } ->
class { 'contrail::vip': } ->
class { 'contrail::cfgm': }
class { 'contrail::cfgm': } ->
class { 'contrail::analytics': }
}
if $contrail::node_name == $contrail::deployment_node {

View File

@@ -0,0 +1,42 @@
daemonize yes
pidfile /var/run/redis/redis-server.pid
port 6379
#bind 127.0.0.1
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

View File

@@ -0,0 +1,86 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class contrail::analytics {
# Resources defaults
Package { ensure => present }
File {
ensure => present,
mode => '0644',
owner => root,
group => root,
require => Package['contrail-openstack-analytics'],
}
Exec { path => '/usr/bin:/usr/sbin:/bin:/sbin' }
# Packages
package { 'redis-server': } ->
package { 'contrail-analytics': } ->
package { 'contrail-openstack-analytics': }
# Analytics config files
file { '/etc/redis/redis.conf':
source => 'puppet:///modules/contrail/redis.conf',
require => Package['redis-server'],
}
file { '/etc/contrail/contrail-analytics-api.conf':
content => template('contrail/contrail-analytics-api.conf.erb'),
}
file { '/etc/contrail/contrail-collector.conf':
content => template('contrail/contrail-collector.conf.erb'),
}
file { '/etc/contrail/contrail-query-engine.conf':
content => template('contrail/contrail-query-engine.conf.erb'),
}
file { '/etc/contrail/contrail-analytics-nodemgr.conf':
content => template('contrail/contrail-analytics-nodemgr.conf.erb'),
}
file { '/etc/contrail/contrail-snmp-collector.conf':
content => template('contrail/contrail-snmp-collector.conf.erb'),
}
file { '/etc/contrail/contrail-topology.conf':
content => template('contrail/contrail-topology.conf.erb'),
}
# Services
service { 'redis-server':
ensure => running,
enable => true,
require => Package['redis-server'],
subscribe => File['/etc/redis/redis.conf'],
}
service { 'supervisor-analytics':
ensure => running,
enable => true,
require => [Package['contrail-openstack-analytics'],Service['redis-server']],
subscribe => [File['/etc/contrail/contrail-analytics-api.conf'],
File['/etc/contrail/contrail-collector.conf'],
File['/etc/contrail/contrail-query-engine.conf'],
File['/etc/contrail/contrail-analytics-nodemgr.conf'],
File['/etc/contrail/contrail-snmp-collector.conf'],
File['/etc/contrail/contrail-topology.conf'],
],
}
}

View File

@@ -0,0 +1,43 @@
<%-
nodes=scope.function_hiera(['nodes'])
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
priv_ip=Array.new
nodes.each do |node|
case node['role']
when 'base-os'
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
priv_ip << node['private_address']
end
end
end
-%>
[DEFAULTS]
host_ip = <%= scope.lookupvar('contrail::address') %>
cassandra_server_list=<%= priv_ip.map{ |ip| "#{ip}:9160" }.join(' ') %>
collectors = <%= scope.lookupvar('contrail::address') %>:8086
http_server_port = 8090
rest_api_port = 9081
rest_api_ip = 0.0.0.0
log_local = 1
log_level = SYS_NOTICE
log_category =
log_file = /var/log/contrail/contrail-analytics-api.log
# Time-to-live in hours of the various data stored by collector into
# cassandra
# analytics_config_audit_ttl, if not set (or set to -1), defaults to analytics_data_ttl
# analytics_statistics_ttl, if not set (or set to -1), defaults to analytics_data_ttl
# analytics_flow_ttl, if not set (or set to -1), defaults to analytics_statsdata_ttl
analytics_data_ttl=48
analytics_config_audit_ttl=-1
analytics_statistics_ttl=-1
analytics_flow_ttl=-1
[DISCOVERY]
disc_server_ip = <%= scope.lookupvar('contrail::contrail_private_vip') %>
disc_server_port = 5998
[REDIS]
redis_server_port = 6379
redis_query_port = 6379

View File

@@ -0,0 +1,6 @@
[DISCOVERY]
server=<%= scope.lookupvar('contrail::contrail_private_vip') %>
port=5998
[COLLECTOR]
#server_list=ip1:port1 ip2:port2

View File

@@ -0,0 +1,98 @@
<%-
nodes=scope.function_hiera(['nodes'])
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
priv_ip=Array.new
nodes.each do |node|
case node['role']
when 'base-os'
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
priv_ip << node['private_address']
end
end
end
-%>
[DEFAULT]
# Everything in this section is optional
# Time-to-live in hours of the various data stored by collector into
# cassandra
# analytics_config_audit_ttl, if not set (or set to -1), defaults to analytics_data_ttl
# analytics_statistics_ttl, if not set (or set to -1), defaults to analytics_data_ttl
# analytics_flow_ttl, if not set (or set to -1), defaults to analytics_statsdata_ttl
analytics_data_ttl=48
analytics_config_audit_ttl=-1
analytics_statistics_ttl=-1
analytics_flow_ttl=-1
# IP address and port to be used to connect to cassandra.
# Multiple IP:port strings separated by space can be provided
cassandra_server_list=<%= priv_ip.map{ |ip| "#{ip}:9160" }.join(' ') %>
# IP address and port to be used to connect to kafka.
# Multiple IP:port strings separated by space can be provided
kafka_broker_list=
# IP address of analytics node. Resolved IP of 'hostname'
hostip=<%= scope.lookupvar('contrail::address') %>
# Hostname of analytics node. If this is not configured value from `hostname`
# will be taken
# hostname=
# Http server port for inspecting collector state (useful for debugging)
http_server_port=8089
# Category for logging. Default value is '*'
# log_category=
# Local log file name
log_file=/var/log/contrail/contrail-collector.log
# Maximum log file rollover index
# log_files_count=10
# Maximum log file size
# log_file_size=1048576 # 1MB
# Log severity levels. Possible values are SYS_EMERG, SYS_ALERT, SYS_CRIT,
# SYS_ERR, SYS_WARN, SYS_NOTICE, SYS_INFO and SYS_DEBUG. Default is SYS_DEBUG
log_level=SYS_NOTICE
# Enable/Disable local file logging. Possible values are 0 (disable) and
# 1 (enable)
log_local=1
# TCP and UDP ports to listen on for receiving syslog messages. -1 to disable.
syslog_port=-1
# UDP port to listen on for receiving sFlow messages. -1 to disable.
# sflow_port=6343
# UDP port to listen on for receiving ipfix messages. -1 to disable.
# ipfix_port=4739
[COLLECTOR]
# Everything in this section is optional
# Port to listen on for receiving Sandesh messages
port=8086
# IP address to bind to for listening
# server=0.0.0.0
# UDP port to listen on for receiving Google Protocol Buffer messages
# protobuf_port=3333
[DISCOVERY]
# Port to connect to for communicating with discovery server
# port=5998
# IP address of discovery server
server=<%= scope.lookupvar('contrail::contrail_private_vip') %>
[REDIS]
# Port to connect to for communicating with redis-server
port=6379
# IP address of redis-server
server=127.0.0.1

View File

@@ -1,3 +1,16 @@
<%-
nodes=scope.function_hiera(['nodes'])
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
priv_ip=Array.new
nodes.each do |node|
case node['role']
when 'base-os'
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
priv_ip << node['private_address']
end
end
end
-%>
[DEFAULTS]
api_server_ip=<%= scope.lookupvar('contrail::contrail_mgmt_vip') %>
api_server_port=8082

View File

@@ -0,0 +1,37 @@
<%-
nodes=scope.function_hiera(['nodes'])
contrail_node_basename=scope.lookupvar('contrail::contrail_node_basename')
priv_ip=Array.new
nodes.each do |node|
case node['role']
when 'base-os'
if node['user_node_name'] =~ /^#{contrail_node_basename}-.*/
priv_ip << node['private_address']
end
end
end
-%>
[DEFAULT]
# analytics_data_ttl=48
cassandra_server_list=<%= priv_ip.map{ |ip| "#{ip}:9160" }.join(' ') %>
collectors=127.0.0.1:8086
hostip=$__contrail_host_ip__ # Resolved IP of `hostname`
# hostname= # Retrieved as `hostname`
http_server_port=8091
# log_category=
# log_disable=0
log_file=/var/log/contrail/contrail-query-engine.log
# log_files_count=10
# log_file_size=1048576 # 1MB
log_level=SYS_NOTICE
log_local=1
# test_mode=0
[DISCOVERY]
# port=5998
# server= # discovery_server IP address
[REDIS]
port=6379
server=127.0.0.1

View File

@@ -0,0 +1,32 @@
[DEFAULTS]
#api_server=127.0.0.1:8082
#collectors=127.0.0.1:8086
#fast_scan_frequency=60
#http_server_port=5920
log_local=1
log_level=SYS_NOTICE
log_file=/var/log/contrail/contrail-snmp-collector.log
zookeeper = <%= scope.lookupvar('contrail::address') %>:2181
#scan_frequency=600
#zookeeper=127.0.0.1:2181
[DISCOVERY]
disc_server_ip = <%= scope.lookupvar('contrail::contrail_private_vip') %>
disc_server_port = 5998
#disc_server_ip=127.0.0.1
#disc_server_port=5998
[KEYSTONE]
#keystone parameters come from contrail-keystone-auth.conf
#auth_host=127.0.0.1
#auth_protocol=http
#auth_port=35357
#admin_user=user1
#admin_password=password1
#admin_tenant_name=default-domain

View File

@@ -0,0 +1,14 @@
[DEFAULTS]
#analytics_api=127.0.0.1:8081
#collectors=127.0.0.1:8086
#http_server_port=5921
log_local=1
log_level=SYS_NOTICE
log_file=/var/log/contrail/contrail-topology.log
zookeeper = <%= scope.lookupvar('contrail::address') %>:2181
#scan_frequency=60
#zookeeper=127.0.0.1:2181