Monasca DevStack integration

Add the following Monasca components:

    - monasca-persister (java)
    - monasca-notification
    - storm
    - monasca-thresh
    - monasca-keystone-credentials
    - monasca-agent
    - monasca-smoke-test

Change-Id: Ic6410895c36e70e9eea208d8868ead743132d331
This commit is contained in:
Deklan Dieterly 2015-09-29 10:52:29 -06:00
parent a3906b5478
commit a04606b795
20 changed files with 1689 additions and 24 deletions

34
devstack/README.txt Normal file
View File

@ -0,0 +1,34 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
The Monasca DevStack plugin currently only works on Ubuntu 14.04 (Trusty).
More Linux Distributions will be supported as soon as is possible.
Add the following to the DevStack local.conf
[[local|localrc]]
ADMIN_PASSWORD=password
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=$ADMIN_PASSWORD
LOGFILE=$DEST/logs/stack.sh.log
LOGDIR=$DEST/logs
LOG_COLOR=False
enable_plugin monasca git://git.openstack.org/stackforge/monasca-api

View File

@ -32,4 +32,4 @@ pre-start script
end script
# Rather than using setuid/setgid sudo is used because the pre-start task must run as root
exec sudo -Hu kafka -g kafka KAFKA_HEAP_OPTS="-Xmx256m" /opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties
exec sudo -Hu kafka -g kafka KAFKA_HEAP_OPTS="-Xmx128m" /opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties

View File

@ -0,0 +1,167 @@
# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright 2015 FUJITSU LIMITED
from __future__ import print_function
from keystoneclient.v2_0 import client
import sys
def get_token(url, cacert, username, password, tenant_name):
if not username or not password:
print('If token is not given, keystone_admin and keystone_admin_password must be given', file=sys.stderr)
return False
if not tenant_name:
print('If token is not given, keystone_admin_project must be given', file=sys.stderr)
return False
kwargs = {
'username': username,
'password': password,
'tenant_name': tenant_name,
'auth_url': url,
'cacert': cacert
}
key = client.Client(**kwargs)
token = key.auth_token
return token
def get_tenant(key, tenant_name):
"""Get the tenant by name"""
for tenant in key.tenants.list():
if tenant.name == tenant_name:
return tenant
return None
def add_tenants(key, tenant_names):
"""Add the given tenant_names if they don't already exist"""
for tenant_name in tenant_names:
if not get_tenant(key, tenant_name):
key.tenants.create(tenant_name=tenant_name, enabled=True)
return True
def get_user(key, user_name):
for user in key.users.list():
if user.name == user_name:
return user
return None
def get_role(key, role_name):
for role in key.roles.list():
if role.name == role_name:
return role
return None
def add_users(key, users):
"""Add the given users if they don't already exist"""
for user in users:
if not get_user(key, user['username']):
tenant_name = user['project']
tenant = get_tenant(key, tenant_name)
password = user['password']
if 'email' in user:
email = user['email']
else:
email = None
user = key.users.create(name=user['username'], password=password,
email=email, tenant_id=tenant.id)
return True
def add_user_roles(key, users):
"""Add the roles for the users if they don't already have them"""
for user in users:
if not 'role' in user:
continue;
role_name = user['role']
keystone_user = get_user(key, user['username'])
tenant = get_tenant(key, user['project'])
existing = None
for role in key.roles.roles_for_user(keystone_user, tenant):
if role.name == role_name:
existing = role
break
if existing:
continue
role = get_role(key, role_name)
if not role:
role = key.roles.create(role_name)
key.roles.add_user_role(keystone_user, role, tenant)
return True
def add_service_endpoint(key, name, description, type, url, region):
"""Add the Monasca service to the catalog with the specified endpoint, if it doesn't yet exist."""
service_names = { service.name: service.id for service in key.services.list() }
if name in service_names.keys():
service_id = service_names[name]
else:
service=key.services.create(name=name, service_type=type, description=description)
service_id = service.id
for endpoint in key.endpoints.list():
if endpoint.service_id == service_id:
if endpoint.publicurl == url and endpoint.adminurl == url and endpoint.internalurl == url:
return True
else:
key.endpoints.delete(endpoint.id)
key.endpoints.create(region=region, service_id=service_id, publicurl=url, adminurl=url, internalurl=url)
return True
def add_monasca_service():
return True
def main():
""" Get token if needed and then call methods to add tenants, users and roles """
users = [{'username': 'mini-mon', 'project': 'mini-mon', 'password': 'password', 'role': 'monasca-user'}, {'username': 'monasca-agent', 'project': 'mini-mon', 'password': 'password', 'role': 'monasca-agent'}]
url = 'http://127.0.0.1:35357/v2.0'
token = 'password'
cacert = None
if not token:
username = None
password = None
tenant_name = None
token = get_token(url, cacert, username, password, tenant_name)
key = client.Client(token=token, endpoint=url, cacert=cacert)
tenants = []
for user in users:
if 'project' in user and user['project'] not in tenants:
tenants.append(user['project'])
if not add_tenants(key, tenants):
return 1
if not add_users(key, users):
return 1
if not add_user_roles(key, users):
return 1
if not add_service_endpoint(key, 'monasca', 'Monasca monitoring service', 'monitoring', 'http://127.0.0.1:8070/v2.0', 'RegionOne'):
return 1
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,8 @@
init_config:
ping_timeout: 1
ssh_port: 22
ssh_timeout: 0.5
instances:
- alive_test: ssh
host_name: 127.0.0.1
name: 127.0.0.1

View File

@ -0,0 +1,13 @@
#!/bin/sh
'/opt/monasca/bin/monasca-setup' \
-u 'monasca-agent' \
-p 'password' \
-s 'monitoring' \
--keystone_url 'http://127.0.0.1:35357/v3' \
--project_name 'mini-mon' \
--monasca_url 'http://127.0.0.1:8070/v2.0' \
\
--check_frequency '15' \
\
--log_level 'WARN' \
--overwrite

View File

@ -100,7 +100,7 @@ middleware:
adminPassword: ""
adminProjectId:
adminProjectName:
adminToken: "ADMIN"
adminToken: "password"
timeToCacheToken: 600
maxTokenCacheSize: 1048576

View File

@ -25,4 +25,4 @@ respawn
setgid monasca
setuid mon-api
exec /usr/bin/java -Dfile.encoding=UTF-8 -Xmx1g -cp /opt/monasca/monasca-api.jar monasca.api.MonApiApplication server /etc/monasca/api-config.yml
exec /usr/bin/java -Dfile.encoding=UTF-8 -Xmx128m -cp /opt/monasca/monasca-api.jar monasca.api.MonApiApplication server /etc/monasca/api-config.yml

View File

@ -0,0 +1,31 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
# Startup script for the monasca_notification
description "Monasca Notification daemon"
start on runlevel [2345]
console log
respawn
kill timeout 240
respawn limit 25 5
setgid monasca
setuid mon-notification
exec /opt/monasca/bin/monasca-notification

View File

@ -0,0 +1,97 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
kafka:
url: "127.0.0.1:9092"
group: "monasca-notification"
alarm_topic: "alarm-state-transitions"
notification_topic: "alarm-notifications"
notification_retry_topic: "retry-notifications"
max_offset_lag: 600 # In seconds, undefined for none
mysql:
host: "127.0.0.1"
user: "notification"
passwd: "password"
db: "mon"
notification_types:
email:
server: "localhost"
port: 25
user: ""
password: ""
timeout: 15
from_addr: "hpcs.mon@hp.com"
webhook:
timeout: 5
pagerduty:
timeout: 5
url: "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
processors:
alarm:
number: 2
ttl: 14400 # In seconds, undefined for none. Alarms older than this are not processed
notification:
number: 2
retry:
interval: 30
max_attempts: 5
queues:
alarms_size: 256
finished_size: 256
notifications_size: 256
sent_notifications_size: 50 # limiting this size reduces potential # of re-sent notifications after a failure
zookeeper:
url: "127.0.0.1:2181"
notification_path: "/notification/alarms"
notification_retry_path: "/notification/retry"
logging: # Used in logging.dictConfig
version: 1
disable_existing_loggers: False
formatters:
default:
format: "%(asctime)s %(levelname)s %(name)s %(message)s"
handlers:
console:
class: logging.StreamHandler
formatter: default
file:
class: logging.handlers.RotatingFileHandler
filename: "/var/log/monasca/notification/notification.log"
formatter: default
maxBytes: 10485760 # Rotate at file size ~10MB
backupCount: 5 # Keep 5 older logs around
loggers:
kazoo:
level: WARN
kafka:
level: WARN
statsd:
level: WARN
root:
handlers:
- file
level: WARN

View File

@ -0,0 +1,28 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
# Startup script for the monasca-persister
description "Monasca Persister java app"
start on runlevel [2345]
console log
respawn
setgid monasca
setuid mon-persister
exec /usr/bin/java -Dfile.encoding=UTF-8 -Xmx128m -cp /opt/monasca/monasca-persister.jar monasca.persister.PersisterApplication server /etc/monasca/persister-config.yml

View File

@ -0,0 +1,135 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
name: monasca-persister
alarmHistoryConfiguration:
batchSize: 100
numThreads: 1
maxBatchTime: 15
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: alarm-state-transitions
groupId: 1_alarm-state-transitions
consumerId: "mini-mon"
clientId : 1
metricConfiguration:
batchSize: 100
numThreads: 1
maxBatchTime: 15
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: metrics
groupId: 1_metrics
consumerId: "mini-mon"
clientId : 1
#Kafka settings.
kafkaConfig:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
zookeeperConnect: "127.0.0.1:2181"
socketTimeoutMs: 30000
socketReceiveBufferBytes : 65536
fetchMessageMaxBytes: 1048576
queuedMaxMessageChunks: 10
rebalanceMaxRetries: 4
fetchMinBytes: 1
fetchWaitMaxMs: 100
rebalanceBackoffMs: 2000
refreshLeaderBackoffMs: 200
autoOffsetReset: largest
consumerTimeoutMs: 1000
zookeeperSessionTimeoutMs : 60000
zookeeperConnectionTimeoutMs : 60000
zookeeperSyncTimeMs: 2000
verticaMetricRepoConfig:
maxCacheSize: 2000000
databaseConfiguration:
# vertica | influxdb
databaseType: influxdb
# Uncomment if databaseType is influxdb
influxDbConfiguration:
# Retention policy may be left blank to indicate default policy.
retentionPolicy:
maxHttpConnections: 100
gzip: true
name: "mon"
url: "http://127.0.0.1:8086"
user: "mon_persister"
password: "password"
# Uncomment if databaseType is vertica
dataSourceFactory:
driverClass: com.vertica.jdbc.Driver
url: "jdbc:vertica://localhost:5433/mon"
user: "mon_persister"
password: "password"
properties:
ssl: false
# the maximum amount of time to wait on an empty pool before throwing an exception
maxWaitForConnection: 1s
# the SQL query to run when validating a connection's liveness
validationQuery: "/* MyService Health Check */ SELECT 1"
# the minimum number of connections to keep open
minSize: 8
# the maximum number of connections to keep open
maxSize: 41
# whether or not idle connections should be validated
checkConnectionWhileIdle: false
# the maximum lifetime of an idle connection
maxConnectionAge: 1 minute
metrics:
frequency: 1 second
# Logging settings.
logging:
# The default level of all loggers. Can be OFF, ERROR, WARN, INFO,
# DEBUG, TRACE, or ALL.
level: WARN
# Logger-specific levels.
loggers:
# Sets the level for 'com.example.app' to DEBUG.
com.example.app: DEBUG
# com.hpcloud: debug
# com.hpcloud.mon.persister.repository: DEBUG
appenders:
- type: file
threshold: INFO
archive: true
currentLogFilename: "/var/log/monasca/persister/monasca-persister.log"
archivedLogFilenamePattern: "/var/log/monasca/persister/monasca-persister.log-%d.log.gz"
archivedFileCount: 5
# The timezone used to format dates. HINT: USE THE DEFAULT, UTC.
timeZone: UTC
server:
applicationConnectors:
- type: http
port: 8090
adminConnectors:
- type: http
port: 8091

View File

@ -0,0 +1,76 @@
# -*- encoding: utf-8 -*-
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
"""configurations for smoke2 test"""
test_config = {
'default': { # the default configuration,
# simple test of each component of monasca-vagrant
'kafka': {
'topics': [
'metrics', 'events', 'raw-events', 'transformed-events',
'stream-definitions', 'transform-definitions',
'alarm-state-transitions', 'alarm-notifications',
'retry-notifications'
]
},
'mysql_schema': [
'alarm', 'alarm_action', 'alarm_definition', 'alarm_metric',
'metric_definition', 'metric_definition_dimensions',
'metric_dimension', 'notification_method', 'schema_migrations',
'stream_actions', 'stream_definition', 'sub_alarm',
'sub_alarm_definition', 'sub_alarm_definition_dimension',
'event_transform', 'alarm_state', 'alarm_definition_severity',
'notification_method_type', 'stream_actions_action_type'
],
'arg_defaults': {
'dbtype': "influxdb",
'kafka': "127.0.0.1:9092",
'zoo': "127.0.0.1:2181",
'mysql': "127.0.0.1",
'monapi': "127.0.0.1",
},
'check': {
'expected_processes': [
'apache-storm', 'monasca-api', 'monasca-statsd',
'monasca-collector', 'monasca-forwarder',
'monasca-notification', 'monasca-persister',
]
},
},
'keystone': {
'user': "mini-mon",
'pass': "password",
'host': "127.0.0.1"
},
'storm': "127.0.0.1",
'mysql': {
'user': "monapi",
'pass': "password"
},
'influx': {
'user': "mon_api",
'pass': "password",
'node': "http://127.0.0.1:8086"
},
'help': {
'test': 'wiki link for help with specific process'
}
}

View File

@ -0,0 +1,67 @@
#!/bin/bash
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
### BEGIN INIT INFO
# Provides: monasca-thresh
# Required-Start: $nimbus
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Monitoring threshold engine running under storm
# Description:
### END INIT INFO
case "$1" in
start)
$0 status
if [ $? -ne 0 ]; then
sudo -Hu mon-thresh /opt/storm/current/bin/storm jar /opt/monasca/monasca-thresh.jar monasca.thresh.ThresholdingEngine /etc/monasca/thresh-config.yml thresh-cluster
exit $?
else
echo "monasca-thresh is already running"
exit 0
fi
;;
stop)
# On system shutdown storm is being shutdown also and this will hang so skip shutting down thresh in that case
if [ -e '/sbin/runlevel' ]; then # upstart/sysV case
if [ $(runlevel | cut -d\ -f 2) == 0 ]; then
exit 0
fi
else # systemd case
systemctl list-units --type=target |grep shutdown.target
if [ $? -eq 0 ]; then
exit 0
fi
fi
sudo -Hu mon-thresh /opt/storm/current/bin/storm kill thresh-cluster
# The above command returns but actually takes awhile loop watching status
while true; do
sudo -Hu mon-thresh /opt/storm/current/bin/storm list |grep thresh-cluster
if [ $? -ne 0 ]; then break; fi
sleep 1
done
;;
status)
sudo -Hu mon-thresh /opt/storm/current/bin/storm list |grep thresh-cluster
;;
restart)
$0 stop
$0 start
;;
esac

View File

@ -0,0 +1,128 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
metricSpoutThreads: 2
metricSpoutTasks: 2
statsdConfig:
host: "127.0.0.1"
port: 8125
prefix: monasca.storm.
dimensions: !!map
service : monitoring
component : storm
metricSpoutConfig:
kafkaConsumerConfiguration:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: "metrics"
numThreads: 1
groupId: "thresh-metric"
zookeeperConnect: "127.0.0.1:2181"
consumerId: 1
socketTimeoutMs: 30000
socketReceiveBufferBytes : 65536
fetchMessageMaxBytes: 1048576
autoCommitEnable: true
autoCommitIntervalMs: 60000
queuedMaxMessageChunks: 10
rebalanceMaxRetries: 4
fetchMinBytes: 1
fetchWaitMaxMs: 100
rebalanceBackoffMs: 2000
refreshLeaderBackoffMs: 200
autoOffsetReset: largest
consumerTimeoutMs: -1
clientId : 1
zookeeperSessionTimeoutMs : 60000
zookeeperConnectionTimeoutMs : 60000
zookeeperSyncTimeMs: 2000
eventSpoutConfig:
kafkaConsumerConfiguration:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: "events"
numThreads: 1
groupId: "thresh-event"
zookeeperConnect: "127.0.0.1:2181"
consumerId: 1
socketTimeoutMs: 30000
socketReceiveBufferBytes : 65536
fetchMessageMaxBytes: 1048576
autoCommitEnable: true
autoCommitIntervalMs: 60000
queuedMaxMessageChunks: 10
rebalanceMaxRetries: 4
fetchMinBytes: 1
fetchWaitMaxMs: 100
rebalanceBackoffMs: 2000
refreshLeaderBackoffMs: 200
autoOffsetReset: largest
consumerTimeoutMs: -1
clientId : 1
zookeeperSessionTimeoutMs : 60000
zookeeperConnectionTimeoutMs : 60000
zookeeperSyncTimeMs: 2000
kafkaProducerConfig:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: "alarm-state-transitions"
metadataBrokerList: "127.0.0.1:9092"
serializerClass: kafka.serializer.StringEncoder
partitionerClass:
requestRequiredAcks: 1
requestTimeoutMs: 10000
producerType: sync
keySerializerClass:
compressionCodec: none
compressedTopics:
messageSendMaxRetries: 3
retryBackoffMs: 100
topicMetadataRefreshIntervalMs: 600000
queueBufferingMaxMs: 5000
queueBufferingMaxMessages: 10000
queueEnqueueTimeoutMs: -1
batchNumMessages: 200
sendBufferBytes: 102400
clientId : Threshold_Engine
sporadicMetricNamespaces:
- foo
database:
driverClass: com.mysql.jdbc.Driver
url: "jdbc:mysql://127.0.0.1/mon?useSSL=true"
user: "thresh"
password: "password"
properties:
ssl: false
# the maximum amount of time to wait on an empty pool before throwing an exception
maxWaitForConnection: 1s
# the SQL query to run when validating a connection's liveness
validationQuery: "/* MyService Health Check */ SELECT 1"
# the minimum number of connections to keep open
minSize: 8
# the maximum number of connections to keep open
maxSize: 41

View File

@ -0,0 +1,174 @@
<?xml version="1.0"?>
<!--
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.
-->
<configuration scan="true" scanPeriod="60 seconds">
<appender name="A1" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/${logfile.name}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/${logfile.name}.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>100MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n</pattern>
</encoder>
</appender>
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/access.log.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>100MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n</pattern>
</encoder>
</appender>
<appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/metrics.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/metrics.log.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>2MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d %-8r %m%n</pattern>
</encoder>
</appender>
<root level="WARN">
<appender-ref ref="A1"/>
</root>
<logger name="backtype.storm.security.auth.authorizer" additivity="false">
<level value="INFO" />
<appender-ref ref="ACCESS" />
</logger>
<logger name="backtype.storm.metric.LoggingMetricsConsumer" additivity="false" >
<level value="INFO"/>
<appender-ref ref="METRICS"/>
</logger>
</configuration>
vagrant@mini-mon:/opt/storm/current/logback$
vagrant@mini-mon:/opt/storm/current/logback$ ls
cluster.xml
vagrant@mini-mon:/opt/storm/current/logback$ cat *
<?xml version="1.0"?>
<!--
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.
-->
<configuration scan="true" scanPeriod="60 seconds">
<appender name="A1" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/${logfile.name}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/${logfile.name}.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>100MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n</pattern>
</encoder>
</appender>
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/access.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/access.log.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>100MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n</pattern>
</encoder>
</appender>
<appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${storm.home}/logs/metrics.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${storm.home}/logs/metrics.log.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>2MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d %-8r %m%n</pattern>
</encoder>
</appender>
<root level="WARN">
<appender-ref ref="A1"/>
</root>
<logger name="backtype.storm.security.auth.authorizer" additivity="false">
<level value="INFO" />
<appender-ref ref="ACCESS" />
</logger>
<logger name="backtype.storm.metric.LoggingMetricsConsumer" additivity="false" >
<level value="INFO"/>
<appender-ref ref="METRICS"/>
</logger>
</configuration>

View File

@ -0,0 +1,31 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
# Startup script for Storm Nimbus
description "Storm Nimbus daemon"
start on runlevel [2345]
console log
respawn
kill timeout 240
respawn limit 25 5
setgid storm
setuid storm
chdir /opt/storm/current
exec /opt/storm/current/bin/storm nimbus

View File

@ -0,0 +1,31 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
# Startup script for Storm Supervisor
description "Storm Supervisor daemon"
start on runlevel [2345]
console log
respawn
kill timeout 240
respawn limit 25 5
setgid storm
setuid storm
chdir /opt/storm/current
exec /opt/storm/current/bin/storm supervisor

View File

@ -0,0 +1,59 @@
#
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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.
#
### base
java.library.path: "/usr/local/lib:/opt/local/lib:/usr/lib"
storm.local.dir: "/var/storm"
### zookeeper.*
storm.zookeeper.servers:
- "127.0.0.1"
storm.zookeeper.port: 2181
storm.zookeeper.retry.interval: 5000
storm.zookeeper.retry.times: 60
storm.zookeeper.root: /storm
storm.zookeeper.session.timeout: 3000
### supervisor.* configs are for node supervisors
supervisor.slots.ports:
- 6701
- 6702
supervisor.childopts: -Xmx256m
### worker.* configs are for task workers
worker.childopts: -Xmx1280m -XX:+UseConcMarkSweepGC -Dcom.sun.management.jmxremote
### nimbus.* configs are for the master
nimbus.host: "127.0.0.1"
nimbus.thrift.port: 6627
nimbus.childopts: -Xmx256m
### ui.* configs are for the master
ui.host: 127.0.0.1
ui.port: 8088
ui.childopts: -Xmx768m
### drpc.* configs
### transactional.* configs
transactional.zookeeper.servers:
- "127.0.0.1"
transactional.zookeeper.port: 2181
transactional.zookeeper.root: /storm-transactional
### topology.* configs are for specific executing storms
topology.acker.executors: 1
topology.debug: False

615
devstack/plugin.sh Normal file → Executable file
View File

@ -40,6 +40,8 @@
XTRACE=$(set +o | grep xtrace)
set -o xtrace
ERREXIT=$(set +o | grep errexit)
set -o errexit
function pre_install_monasca {
:
@ -67,6 +69,14 @@ function install_monasca {
install_monasca_api
install_monasca_persister
install_monasca_notification
install_storm
install_monasca_thresh
}
function post_config_monasca {
@ -74,24 +84,62 @@ function post_config_monasca {
}
function extra_monasca {
:
install_keystone
install_monasca_agent
install_monasca_default_alarms
install_monasca_smoke_test
}
function unstack_monasca {
sudo stop monasca-api
sudo stop kafka
sudo service monasca-agent stop || true
sudo stop zookeeper
sudo service monasca-thresh stop || true
sudo /etc/init.d/influxdb stop
sudo stop storm-supervisor || true
sudo stop storm-nimbus || true
sudo stop monasca-notification || true
sudo stop monasca-persister || true
sudo stop monasca-api || true
sudo stop kafka || true
sudo stop zookeeper || true
sudo /etc/init.d/influxdb stop || true
}
function clean_monasca {
set +o errexit
unstack_monasca
clean_monasca_smoke_test
clean_monasca_default_alarms
clean_monasca_agent
clean_keystone
clean_monasca_thresh
clean_storm
clean_monasca_notification
clean_monasca_persister
clean_monasca_api
clean_monasca_common
@ -108,13 +156,22 @@ function clean_monasca {
clean_zookeeper
clean_storm
clean_openjdk_7_jdk
sudo userdel monasca
sudo rm -rf /opt/monasca
#Restore errexit
set -o errexit
}
function install_zookeeper {
echo_summary "Install Monasca Zookeeper"
sudo apt-get -y install zookeeperd
sudo cp /opt/stack/monasca/devstack/files/zookeeper/zoo.cfg /etc/zookeeper/conf/zoo.cfg
@ -129,12 +186,14 @@ function install_zookeeper {
sudo cp /opt/stack/monasca/devstack/files/zookeeper/log4j.properties /etc/zookeeper/conf/log4j.properties
sudo restart zookeeper
sudo start zookeeper || sudo restart zookeeper
}
function clean_zookeeper {
echo_summary "Clean Monasca Zookeeper"
sudo apt-get -y purge zookeeperd
sudo apt-get -y purge zookeeper
@ -149,11 +208,13 @@ function clean_zookeeper {
function install_kafka {
echo_summary "Install Monasca Kafka"
sudo curl http://apache.mirrors.tds.net/kafka/0.8.1.1/kafka_2.9.2-0.8.1.1.tgz -o /root/kafka_2.9.2-0.8.1.1.tgz
sudo groupadd --system kafka
sudo groupadd --system kafka || true
sudo useradd --system -g kafka kafka
sudo useradd --system -g kafka kafka || true
sudo tar -xzf /root/kafka_2.9.2-0.8.1.1.tgz -C /opt
@ -195,19 +256,21 @@ function install_kafka {
sudo chmod 644 /etc/kafka/server.properties
sudo start kafka
sudo start kafka || sudo restart kafka
}
function clean_kafka {
echo_summary "Clean Monasca Kafka"
sudo rm -rf /var/kafka
sudo rm -rf /var/log/kafka
sudo rm -rf /etc/kafka
sudo rm -f /opt/kafka
sudo rm -rf /opt/kafka
sudo rm -rf /etc/init/kafka.conf
@ -223,6 +286,8 @@ function clean_kafka {
function install_influxdb {
echo_summary "Install Monasca Influxdb"
sudo mkdir -p /opt/monasca_download_dir
sudo curl http://s3.amazonaws.com/influxdb/influxdb_0.9.1_amd64.deb -o /opt/monasca_download_dir/influxdb_0.9.1_amd64.deb
@ -233,16 +298,18 @@ function install_influxdb {
sudo cp -f /opt/stack/monasca/devstack/files/influxdb/influxdb /etc/default/influxdb
sudo /etc/init.d/influxdb start
sudo /etc/init.d/influxdb start || sudo /etc/init.d/influxdb restart
echo "sleep for 5 seconds to let influxdb elect a leader"
echo "Sleep for 60 seconds to let Influxdb elect a leader and start listening for connections"
sleep 5s
sleep 60s
}
function clean_influxdb {
echo_summary "Clean Monasca Influxdb"
sudo rm -f /etc/default/influxdb
sudo rm -f /etc/opt/influxdb/influxdb.conf
@ -260,6 +327,8 @@ function clean_influxdb {
function install_cli_creds {
echo_summary "Install Monasca CLI Creds"
sudo cp -f /opt/stack/monasca/devstack/files/env.sh /etc/profile.d/monasca_cli.sh
sudo chown root:root /etc/profile.d/monasca_cli.sh
@ -270,12 +339,16 @@ function install_cli_creds {
function clean_cli_creds {
echo_summary "Clean Monasca CLI Creds"
sudo rm -f /etc/profile.d/monasca_cli.sh
}
function install_schema {
echo_summary "Install Monasca Schema"
sudo mkdir -p /opt/monasca/sqls
sudo chmod 0755 /opt/monasca/sqls
@ -324,6 +397,8 @@ function install_schema {
function clean_schema {
echo_summary "Clean Monasca Schema"
sudo echo "drop database winchester;" | mysql -uroot -ppassword
sudo echo "drop database mon;" | mysql -uroot -ppassword
@ -340,12 +415,16 @@ function clean_schema {
function install_openjdk_7_jdk {
echo_summary "Install Monasca openjdk_7_jdk"
sudo apt-get -y install openjdk-7-jdk
}
function clean_openjdk_7_jdk {
echo_summary "Clean Monasca openjdk_7_jdk"
sudo apt-get -y purge openjdk-7-jdk
sudo apt-get -y autoremove
@ -354,24 +433,36 @@ function clean_openjdk_7_jdk {
function install_maven {
echo_summary "Install Monasca Maven"
sudo apt-get -y install maven
}
function clean_maven {
echo_summary "Clean Monasca Maven"
sudo apt-get -y purge maven
}
function install_git {
echo_summary "Install git"
sudo apt-get -y install git
}
function install_monasca_common {
sudo git clone https://github.com/stackforge/monasca-common.git /opt/stack/monasca-common
echo_summary "Install Monasca monasca_common"
if [[ ! -d /opt/stack/monasca-common ]]; then
sudo git clone https://github.com/stackforge/monasca-common.git /opt/stack/monasca-common
fi
(cd /opt/stack/monasca-common ; sudo mvn clean install -DskipTests)
@ -379,24 +470,32 @@ function install_monasca_common {
function clean_monasca_common {
echo_summary "Clean Monasca monasca_common"
(cd /opt/stack/monasca-common ; sudo mvn clean)
}
function install_monasca_api {
echo_summary "Install Monasca monasca_api"
sudo mkdir -p /opt/monasca
(cd /opt/stack/monasca/java ; sudo mvn clean package -DskipTests)
sudo cp -f /opt/stack/monasca/java/target/monasca-api-1.1.0-SNAPSHOT-shaded.jar /opt/monasca/monasca-api.jar
sudo groupadd --system monasca
sudo groupadd --system monasca || true
sudo useradd --system -g monasca mon-api
sudo useradd --system -g monasca mon-api || true
sudo cp -f /opt/stack/monasca/devstack/files/monasca-api/monasca-api.conf /etc/init/monasca-api.conf
sudo chown root:root /etc/init/monasca-api.conf
sudo chmod 0744 /etc/init/monasca-api.conf
sudo mkdir -p /var/log/monasca
sudo chown root:monasca /var/log/monasca
@ -413,14 +512,22 @@ function install_monasca_api {
sudo chown root:monasca /etc/monasca
sudo chmod 0775 /etc/monasca
sudo cp -f /opt/stack/monasca/devstack/files/monasca-api/api-config.yml /etc/monasca/api-config.yml
sudo start monasca-api
sudo chown mon-api:root /etc/monasca/api-config.yml
sudo chmod 0640 /etc/monasca/api-config.yml
sudo start monasca-api || sudo restart monasca-api
}
function clean_monasca_api {
echo_summary "Clean Monasca monasca_api"
(cd /opt/stack/monasca ; sudo mvn clean)
sudo rm /etc/monasca/api-config.yml
@ -430,27 +537,492 @@ function clean_monasca_api {
sudo rm /etc/init/monasca-api.conf
sudo rm /opt/monasca/monasca-api.jar
sudo userdel mon-api
}
function install_monasca_persister {
:
echo_summary "Install Monasca monasca_persister"
sudo mkdir -p /opt/monasca
if [[ ! -d /opt/stack/monasca-persister ]]; then
sudo git clone https://github.com/stackforge/monasca-persister /opt/stack/monasca-persister
fi
(cd /opt/stack/monasca-persister/java ; sudo mvn clean package -DskipTests)
sudo cp -f /opt/stack/monasca-persister/java/target/monasca-persister-1.1.0-SNAPSHOT-shaded.jar /opt/monasca/monasca-persister.jar
sudo groupadd --system monasca || true
sudo useradd --system -g monasca mon-persister || true
sudo mkdir -p /var/log/monasca
sudo chown root:monasca /var/log/monasca
sudo chmod 0755 /var/log/monasca
sudo mkdir -p /var/log/monasca/persister
sudo chown root:monasca /var/log/monasca/persister
sudo chmod 0755 /var/log/monasca/persister
sudo mkdir -p /etc/monasca
sudo chown root:monasca /etc/monasca
sudo cp -f /opt/stack/monasca/devstack/files/monasca-persister/persister-config.yml /etc/monasca/persister-config.yml
sudo chown mon-persister:monasca /etc/monasca/persister-config.yml
sudo chmod 0640 /etc/monasca/persister-config.yml
sudo cp -f /opt/stack/monasca/devstack/files/monasca-persister/monasca-persister.conf /etc/init/monasca-persister.conf
sudo chown root:root /etc/init/monasca-persister.conf
sudo chmod 0744 /etc/init/monasca-persister.conf
sudo start monasca-persister || sudo restart monasca-persister
}
function clean_monasca_persister {
echo_summary "Clean Monasca monasca_persister"
(cd /opt/stack/monasca-persister ; sudo mvn clean)
sudo rm /etc/init/monasca-persister.conf
sudo rm /etc/monasca/persister-config.yml
sudo rm -rf /var/log/monasca/persister
sudo rm /opt/monasca/monasca-persister.jar
sudo userdel mon-persister
}
function install_monasca_notification {
echo_summary "Install Monasca monasca_notification"
sudo apt-get -y install python-dev
sudo apt-get -y install build-essential
sudo apt-get -y install python-mysqldb
sudo apt-get -y install libmysqlclient-dev
(cd /opt/monasca ; sudo virtualenv .)
if [[ ! -d /opt/stack/monasca-notification ]]; then
sudo git clone https://github.com/stackforge/monasca-notification /opt/stack/monasca-notification
fi
(cd /opt/stack/monasca-notification ; sudo python setup.py sdist)
(cd /opt/monasca ; sudo -H ./bin/pip install --pre --allow-all-external --allow-unverified simport /opt/stack/monasca-notification/dist/monasca-notification-1.2.8.dev4.tar.gz)
sudo groupadd --system monasca || true
sudo useradd --system -g monasca mon-notification || true
sudo mkdir -p /var/log/monasca/notification
sudo chown root:monasca /var/log/monasca/notification
sudo chmod 0775 /var/log/monasca/notification
sudo mkdir -p /etc/monasca
sudo chown root:monasca /etc/monasca
sudo chmod 0775 /etc/monasca
sudo cp -f /opt/stack/monasca/devstack/files/monasca-notification/notification.yaml /etc/monasca/notification.yaml
sudo chown mon-notification:monasca /etc/monasca/notification.yaml
sudo chmod 0660 /etc/monasca/notification.yaml
sudo cp -f /opt/stack/monasca/devstack/files/monasca-notification/monasca-notification.conf /etc/init/monasca-notification.conf
sudo chown root:root /etc/init/monasca-notification.conf
sudo chmod 0744 /etc/init/monasca-notification.conf
sudo debconf-set-selections <<< "postfix postfix/mailname string localhost"
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local only'"
sudo apt-get -y install mailutils
sudo start monasca-notification || sudo restart monasca-notification
}
function clean_monasca_notification {
echo_summary "Clean Monasca monasca_notification"
sudo rm /etc/init/monasca-notification.conf
sudo rm /etc/monasca/notification.yaml
sudo rm -rf /var/log/monasca/notification
sudo userdel mon-notification
sudo rm -rf /opt/monasca/monasca-notification
sudo apt-get -y purge libmysqlclient-dev
sudo apt-get -y purge python-mysqldb
sudo apt-get -y purge build-essential
sudo apt-get -y purge python-dev
sudo apt-get -y purge mailutils
}
function install_storm {
echo_summary "Install Monasca Storm"
sudo curl http://apache.mirrors.tds.net/storm/apache-storm-0.9.5/apache-storm-0.9.5.tar.gz -o /root/apache-storm-0.9.5.tar.gz
sudo groupadd --system storm || true
sudo useradd --system -g storm storm || true
sudo mkdir -p /opt/storm
sudo chown storm:storm /opt/storm
sudo chmod 0755 /opt/storm
sudo tar -xzf /root/apache-storm-0.9.5.tar.gz -C /opt/storm
sudo ln -s /opt/storm/apache-storm-0.9.5 /opt/storm/current
sudo mkdir /var/storm
sudo chown storm:storm /var/storm
sudo chmod 0775 /var/storm
sudo mkdir /var/log/storm
sudo chown storm:storm /var/log/storm
sudo chmod 0775 /var/log/storm
sudo ln -s /var/log/storm /opt/storm/current/logs
sudo cp -f /opt/stack/monasca/devstack/files/storm/cluster.xml /opt/storm/current/logback/cluster.xml
sudo chown storm:storm /opt/storm/current/logback/cluster.xml
sudo chmod 0644 /opt/storm/current/logback/cluster.xml
sudo cp -f /opt/stack/monasca/devstack/files/storm/storm.yaml /opt/storm/apache-storm-0.9.5/conf/storm.yaml
sudo chown storm:storm /opt/storm/apache-storm-0.9.5/conf/storm.yaml
sudo chmod 0644 /opt/storm/apache-storm-0.9.5/conf/storm.yaml
sudo cp -f /opt/stack/monasca/devstack/files/storm/storm-nimbus.conf /etc/init/storm-nimbus.conf
sudo chown root:root /etc/init/storm-nimbus.conf
sudo chmod 0644 /etc/init/storm-nimbus.conf
sudo cp -f /opt/stack/monasca/devstack/files/storm/storm-supervisor.conf /etc/init/storm-supervisor.conf
sudo chown root:root /etc/init/storm-supervisor.conf
sudo chmod 0644 /etc/init/storm-supervisor.conf
sudo start storm-nimbus || sudo restart storm-nimbus
sudo start storm-supervisor || sudo restart storm-supervisor
}
function clean_storm {
echo_summary "Clean Monasca Storm"
sudo rm /etc/init/storm-supervisor.conf
sudo rm /etc/init/storm-nimbus.conf
sudo rm /opt/storm/apache-storm-0.9.5/conf/storm.yaml
sudo rm /opt/storm/current/logback/cluster.xml
sudo unlink /opt/storm/current/logs
sudo rm -rf /var/storm
sudo rm -rf /var/log/storm
sudo userdel storm || true
sudo groupdel storm || true
sudo unlink /opt/storm/current
sudo rm -rf /opt/storm
sudo rm /root/apache-storm-0.9.5.tar.gz
}
function install_monasca_thresh {
echo_summary "Install Monasca monasca_thresh"
if [[ ! -d /opt/stack/monasca-thresh ]]; then
sudo git clone https://github.com/stackforge/monasca-thresh.git /opt/stack/monasca-thresh
fi
(cd /opt/stack/monasca-thresh/thresh ; sudo mvn clean package -DskipTests)
sudo cp -f /opt/stack/monasca-thresh/thresh/target/monasca-thresh-1.1.0-SNAPSHOT-shaded.jar /opt/monasca/monasca-thresh.jar
sudo groupadd --system monasca || true
sudo useradd --system -g monasca mon-thresh
sudo mkdir -p /etc/monasca
sudo chown root:monasca /etc/monasca
sudo chmod 0775 /etc/monasca
sudo cp -f /opt/stack/monasca/devstack/files/monasca-thresh/thresh-config.yml /etc/monasca/thresh-config.yml
sudo chown root:monasca /etc/monasca/thresh-config.yml
sudo chmod 0640 /etc/monasca/thresh-config.yml
sudo cp -f /opt/stack/monasca/devstack/files/monasca-thresh/monasca-thresh /etc/init.d/monasca-thresh
sudo chown root:root /etc/init.d/monasca-thresh
sudo chmod 0744 /etc/init.d/monasca-thresh
sudo service monasca-thresh start || sudo service monasca-thresh restart
}
function clean_monasca_thresh {
echo_summary "Clean Monasca monasca_thresh"
(cd /opt/stack/monasca-thresh/thresh ; sudo mvn clean)
sudo rm /etc/init.d/monasca-thresh
sudo rm /etc/monasca/thresh-config.yml
sudo userdel mon-thresh || true
sudo rm /opt/monasca/monasca-thresh.jar
}
function install_keystone {
echo_summary "Install Monasca Keystone Client"
sudo mkdir -p /opt/monasca
sudo apt-get -y install python-dev
if [[ ! -d /opt/stack/python-keystoneclient ]]; then
sudo git clone https://github.com/openstack/python-keystoneclient /opt/stack/python-keystoneclient
fi
(cd /opt/stack/python-keystoneclient ; sudo python setup.py sdist)
(cd /opt/monasca ; sudo -H ./bin/pip install --pre --allow-all-external --allow-unverified simport /opt/stack/python-keystoneclient/dist/python-keystoneclient-1.7.2.dev14.tar.gz)
sudo cp -f /opt/stack/monasca/devstack/files/keystone/create_monasca_service.py /usr/local/bin/create_monasca_service.py
sudo chmod 0700 /usr/local/bin/create_monasca_service.py
sudo /opt/monasca/bin/python /usr/local/bin/create_monasca_service.py
}
function clean_keystone {
echo_summary "Clean Monasca Keystone Client"
sudo rm /usr/local/bin/create_monasca_service.py
sudo apt-get -y purge python-dev
}
function install_monasca_agent {
echo_summary "Install Monasca monasca_agent"
sudo apt-get -y install python-dev
sudo apt-get -y install python-yaml
sudo apt-get -y install build-essential
sudo apt-get -y install libxml2-dev
sudo apt-get -y install libxslt1-dev
if [[ ! -d /opt/stack/monasca-agent ]]; then
sudo git clone https://github.com/stackforge/monasca-agent /opt/stack/monasca-agent
fi
(cd /opt/stack/monasca-agent ; sudo python setup.py sdist)
(cd /opt/monasca ; sudo -H ./bin/pip install --pre --allow-all-external --allow-unverified simport /opt/stack/monasca-agent/dist/monasca-agent-1.1.17.dev5.tar.gz)
sudo mkdir -p /etc/monasca/agent/conf.d
sudo chown root:root /etc/monasca/agent/conf.d
sudo chmod 0755 /etc/monasca/agent/conf.d
sudo mkdir -p /usr/lib/monasca/agent/custom_checks.d
sudo chown root:root /usr/lib/monasca/agent/custom_checks.d
sudo chmod 0755 /usr/lib/monasca/agent/custom_checks.d
sudo mkdir -p /usr/lib/monasca/agent/custom_detect.d
sudo chown root:root /usr/lib/monasca/agent/custom_detect.d
sudo chmod 0755 /usr/lib/monasca/agent/custom_detect.d
sudo cp -f /opt/stack/monasca/devstack/files/monasca-agent/host_alive.yaml /etc/monasca/agent/conf.d/host_alive.yaml
sudo cp -f /opt/stack/monasca/devstack/files/monasca-agent/monasca-reconfigure /usr/local/bin/monasca-reconfigure
sudo chown root:root /usr/local/bin/monasca-reconfigure
sudo chmod 0750 /usr/local/bin/monasca-reconfigure
sudo /usr/local/bin/monasca-reconfigure
sudo service monasca-agent start || sudo service monasca-agent restart
}
function clean_monasca_agent {
echo_summary "Clean Monasca monasca_agent"
sudo rm /etc/init.d/monasca-agent
sudo rm /usr/local/bin/monasca-reconfigure
sudo rm /etc/monasca/agent/conf.d/host_alive.yaml
sudo chown root:root /etc/monasca/agent/conf.d/host_alive.yaml
chmod 0644 /etc/monasca/agent/conf.d/host_alive.yaml
sudo rm -rf /usr/lib/monasca/agent/custom_detect.d
sudo rm -rf /usr/lib/monasca/agent/custom_checks.d
sudo rm -rf /etc/monasca/agent/conf.d
sudo apt-get -y purge libxslt1-dev
sudo apt-get -y purge libxml2-dev
sudo apt-get -y purge build-essential
sudo apt-get -y purge python-yaml
sudo apt-get -y purge python-dev
}
function install_monasca_smoke_test {
echo_summary "Install Monasca Smoke Test"
(cd /opt/monasca ; sudo -H ./bin/pip install mySQL-python)
sudo curl -L https://api.github.com/repos/hpcloud-mon/monasca-ci/tarball/master -o /opt/monasca/monasca-ci.tar.gz
sudo tar -xzf /opt/monasca/monasca-ci.tar.gz -C /opt/monasca
sudo sed -i s/192\.168\.10\.4/127\.0\.0\.1/g /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/utils.py
sudo sed -i s/192\.168\.10\.5/127\.0\.0\.1/g /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/utils.py
sudo sed -i "s/'hostname', '-f'/'hostname'/g" /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke_configs.py
(cd /opt/monasca ; sudo -H ./bin/pip install influxdb)
sudo cp -f /opt/stack/monasca/devstack/files/monasca-smoke-test/smoke2_configs.py /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke2_configs.py
sudo /opt/monasca/bin/python /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke2.py || true
OS_USERNAME=test OS_PASSWORD=password OS_PROJECT_NAME=test OS_AUTH_URL=http://127.0.0.1:35357/v3 bash -c 'sudo /opt/monasca/bin/python /opt/monasca/hpcloud-mon-monasca-ci-7a45d29/tests/smoke/smoke.py' || true
}
function clean_monasca_smoke_test {
echo_summary "Clean Monasca Smoke Test"
sudo rm /opt/monasca/monasca-ci.tar.gz
sudo rm -rf /opt/monasca/hpcloud-mon-monasca-ci-7a45d29
}
function install_monasca_default_alarms {
:
}
function clean_monasca_default_alarms {
:
}
# Allows this script to be called directly outside of
# the devstack infrastructure code. Uncomment to use.
#if [[ $(type -t) != 'function' ]]; then
#if [[ $(type -t is_service_enabled) != 'function' ]]; then
#
# function is_service_enabled {
#
# return 0;
# return 0
#
# }
#fi
#if [[ $(type -t echo_summary) != 'function' ]]; then
#
# function echo_summary {
#
# echo "$*"
#
# }
#
#fi
# check for service enabled
if is_service_enabled monasca; then
@ -492,5 +1064,8 @@ if is_service_enabled monasca; then
fi
fi
#Restore errexit
$ERREXIT
# Restore xtrace
$XTRACE

View File

@ -15,7 +15,18 @@
# limitations under the License.
#
# Turn on all the Monasca services by default
The following two variables allow switching between java and python for the implementations
of the Monasca API and the Monasca Persister.
MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-java}
#MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-python}
MONASCA_PERSISTER_IMPLEMENTAION_LANG=${MONASCA_PERSISTER_IMPLEMENTAION_LANG:-java}
#MONASCA_PERSISTER_IMPLEMENTAION_LANG=${MONASCA_PERSISTER_IMPLEMENTAION_LANG:-python}
# Turn on all the Monasca services by default. Currently enabling specific services
# has no effect. All services are enabled by default. There is currently no mechanism
implemented to turn off specific Monasca services.
#
# Monasca top level service that enables all other services