contrail 3.0 updates for analytics configs
Change-Id: If0dba604fbf9155e3da9e9fc8e99349aca897645
diff --git a/opencontrail/database.sls b/opencontrail/database.sls
index 5426ac1..dc2e479 100644
--- a/opencontrail/database.sls
+++ b/opencontrail/database.sls
@@ -82,6 +82,19 @@
file.managed:
- contents: '{{ database.id }}'
+{% if database.version == 3.0 %}
+
+/usr/share/kafka/config/server.properties:
+ file.managed:
+ - source: salt://opencontrail/files/{{ database.version }}/server.properties
+ - template: jinja
+ - require:
+ - pkg: opencontrail_database_packages
+ - require_in:
+ - service: opencontrail_database_services
+
+{% endif %}
+
opencontrail_database_services:
service.running:
- enable: true
diff --git a/opencontrail/files/3.0/contrail-alarm-gen.conf b/opencontrail/files/3.0/contrail-alarm-gen.conf
index 0a754e3..07dec5a 100644
--- a/opencontrail/files/3.0/contrail-alarm-gen.conf
+++ b/opencontrail/files/3.0/contrail-alarm-gen.conf
@@ -1,18 +1,18 @@
{%- from "opencontrail/map.jinja" import collector with context %}
[DEFAULTS]
-#host_ip = 127.0.0.1
+host_ip = {{ collector.bind.address }}
#collectors = 127.0.0.1:8086
#http_server_port = 5995
log_local = 1
log_level = SYS_NOTICE
#log_category =
log_file = /var/log/contrail/contrail-alarm-gen.log
-#kafka_broker_list = xx.xx.xx.xx:9092
-#zk_list = xx.xx.xx.xx:2181
+kafka_broker_list = {% for member in collector.database.members %}{{ member.host }}:9092 {% endfor %}
+zk_list = {% for member in collector.database.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}
[DISCOVERY]
-#disc_server_ip =
-#disc_server_port = 5998
+disc_server_ip = {{ collector.discovery.host }}
+disc_server_port = 5998
[REDIS]
#redis_server_port=6379
diff --git a/opencontrail/files/3.0/contrail-collector.conf b/opencontrail/files/3.0/contrail-collector.conf
index 6437f20..4523cc1 100644
--- a/opencontrail/files/3.0/contrail-collector.conf
+++ b/opencontrail/files/3.0/contrail-collector.conf
@@ -13,31 +13,35 @@
# 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={{ collector.data_ttl }}
- analytics_config_audit_ttl={{ collector.data_ttl }}
- analytics_statistics_ttl={{ collector.data_ttl }}
- analytics_flow_ttl={{ collector.data_ttl }}
+analytics_data_ttl={{ collector.data_ttl }}
+analytics_config_audit_ttl={{ collector.data_ttl }}
+analytics_statistics_ttl={{ collector.data_ttl }}
+analytics_flow_ttl={{ collector.data_ttl }}
- cassandra_server_list={% for member in collector.database.members %}{{ member.host }}:{{ member.port }} {% endfor %}
+cassandra_server_list={% for member in collector.database.members %}{{ member.host }}:9042 {% endfor %}
# IP address and port to be used to connect to kafka.
# Multiple IP:port strings separated by space can be provided
- kafka_broker_list=
+kafka_broker_list={% for member in collector.database.members %}{{ member.host }}:9092 {% endfor %}
+
+# IP address and port to be used to connect to zookeeper.
+# Multiple IP:port are specified as single string separated by comma
+zookeeper_server_list={% for member in collector.database.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}
# dup=0
- hostip={{ collector.bind.address }} # Resolved IP of `hostname`
+hostip={{ collector.bind.address }} # Resolved IP of `hostname`
# hostname= # Retrieved as `hostname`
- http_server_port=8089
+http_server_port=8089
# log_category=
# log_disable=0
- log_file=/var/log/contrail/contrail-collector.log
+log_file=/var/log/contrail/contrail-collector.log
# log_files_count=10
# log_file_size=1048576 # 1MB
- log_level=SYS_NOTICE
- log_local=1
+log_level=SYS_NOTICE
+log_local=1
# TCP and UDP ports to listen on for receiving syslog messages. -1 to disable.
- syslog_port=-1
+syslog_port=-1
# UDP port to listen on for receiving sFlow messages. -1 to disable.
# sflow_port=6343
@@ -48,7 +52,7 @@
# test_mode=0
[COLLECTOR]
- port=8086
+port=8086
# server= 0.0.0.0
# UDP port to listen on for receiving Google Protocol Buffer messages
@@ -56,9 +60,9 @@
[DISCOVERY]
# port=5998
- server={{ collector.discovery.host }} # discovery_server IP address
+server={{ collector.discovery.host }} # discovery_server IP address
[REDIS]
- port=6379
- server=127.0.0.1
+port=6379
+server=127.0.0.1
diff --git a/opencontrail/files/3.0/contrail-query-engine.conf b/opencontrail/files/3.0/contrail-query-engine.conf
index 724685e..fc0e87f 100644
--- a/opencontrail/files/3.0/contrail-query-engine.conf
+++ b/opencontrail/files/3.0/contrail-query-engine.conf
@@ -7,25 +7,25 @@
[DEFAULT]
# analytics_data_ttl=48
- cassandra_server_list={% for member in collector.database.members %}{{ member.host }}:{{ member.port }} {% endfor %}
- collectors=127.0.0.1:8086
- hostip=$__contrail_host_ip__ # Resolved IP of `hostname`
+cassandra_server_list={% for member in collector.database.members %}{{ member.host }}:{{ member.port }} {% endfor %}
+#collectors=127.0.0.1:8086
+hostip={{ collector.bind.address }}
# hostname= # Retrieved as `hostname`
- http_server_port=8091
+http_server_port=8091
# log_category=
# log_disable=0
- log_file=/var/log/contrail/contrail-query-engine.log
+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
+log_level=SYS_NOTICE
+log_local=1
# test_mode=0
[DISCOVERY]
-# port=5998
-# server= # discovery_server IP address
+server = {{ collector.discovery.host }}
+port = 5998
[REDIS]
- port=6379
- server=127.0.0.1
+port=6379
+server=127.0.0.1
diff --git a/opencontrail/files/3.0/server.properties b/opencontrail/files/3.0/server.properties
new file mode 100644
index 0000000..5cdaee6
--- /dev/null
+++ b/opencontrail/files/3.0/server.properties
@@ -0,0 +1,122 @@
+{%- from "opencontrail/map.jinja" import database with context %}
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+# see kafka.server.KafkaConfig for additional details and defaults
+
+############################# Server Basics #############################
+
+# The id of the broker. This must be set to a unique integer for each broker.
+broker.id={{ database.id }}
+
+############################# Socket Server Settings #############################
+
+#listeners=PLAINTEXT://:9092
+
+# The port the socket server listens on
+port=9092
+
+# Hostname the broker will bind to. If not set, the server will bind to all interfaces
+#host.name=localhost
+
+# Hostname the broker will advertise to producers and consumers. If not set, it uses the
+# value for "host.name" if configured. Otherwise, it will use the value returned from
+# java.net.InetAddress.getCanonicalHostName().
+advertised.host.name={{ database.bind.host }}
+
+# The port to publish to ZooKeeper for clients to use. If this is not set,
+# it will publish the same port that the broker binds to.
+#advertised.port=<port accessible by clients>
+
+# The number of threads handling network requests
+num.network.threads=3
+
+# The number of threads doing disk I/O
+num.io.threads=8
+
+# The send buffer (SO_SNDBUF) used by the socket server
+socket.send.buffer.bytes=102400
+
+# The receive buffer (SO_RCVBUF) used by the socket server
+socket.receive.buffer.bytes=102400
+
+# The maximum size of a request that the socket server will accept (protection against OOM)
+socket.request.max.bytes=104857600
+
+
+############################# Log Basics #############################
+
+# A comma seperated list of directories under which to store log files
+log.dirs=/tmp/kafka-logs
+
+# The default number of log partitions per topic. More partitions allow greater
+# parallelism for consumption, but this will also result in more files across
+# the brokers.
+num.partitions=1
+
+# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
+# This value is recommended to be increased for installations with data dirs located in RAID array.
+num.recovery.threads.per.data.dir=1
+
+############################# Log Flush Policy #############################
+
+# Messages are immediately written to the filesystem but by default we only fsync() to sync
+# the OS cache lazily. The following configurations control the flush of data to disk.
+# There are a few important trade-offs here:
+# 1. Durability: Unflushed data may be lost if you are not using replication.
+# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
+# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks.
+# The settings below allow one to configure the flush policy to flush data after a period of time or
+# every N messages (or both). This can be done globally and overridden on a per-topic basis.
+
+# The number of messages to accept before forcing a flush of data to disk
+#log.flush.interval.messages=10000
+
+# The maximum amount of time a message can sit in a log before we force a flush
+#log.flush.interval.ms=1000
+
+############################# Log Retention Policy #############################
+
+# The following configurations control the disposal of log segments. The policy can
+# be set to delete segments after a period of time, or after a given size has accumulated.
+# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
+# from the end of the log.
+
+# The minimum age of a log file to be eligible for deletion
+log.retention.hours=168
+
+# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
+# segments don't drop below log.retention.bytes.
+#log.retention.bytes=1073741824
+
+# The maximum size of a log segment file. When this size is reached a new log segment will be created.
+log.segment.bytes=1073741824
+
+# The interval at which log segments are checked to see if they can be deleted according
+# to the retention policies
+log.retention.check.interval.ms=300000
+
+############################# Zookeeper #############################
+
+# Zookeeper connection string (see zookeeper docs for details).
+# This is a comma separated host:port pairs, each corresponding to a zk
+# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
+# You can also append an optional chroot string to the urls to specify the
+# root directory for all kafka znodes.
+#zookeeper.connect=10.0.102.211:2181
+zookeeper.connect={% for member in database.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}
+
+# Timeout in ms for connecting to zookeeper
+log.cleanup.policy=compact
+delete.topic.enable=true
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index babd74c..0f3a3e6 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -37,11 +37,11 @@
{% set config = salt['grains.filter_by']({
'Debian': {
'pkgs': ['contrail-config-openstack','ifmap-server'],
- 'services': ['zookeeper', 'supervisor-config']
+ 'services': ['supervisor-config']
},
'RedHat': {
'pkgs': ['contrail-openstack-config'],
- 'services': ['zookeeper', 'supervisor-config']
+ 'services': ['supervisor-config']
},
}, merge=salt['pillar.get']('opencontrail:config')) %}