Merge "Use monasca-notification.conf during devstack runs"
This commit is contained in:
commit
85244866b8
|
@ -49,9 +49,11 @@
|
|||
monasca-api: https://opendev.org/openstack/monasca-api
|
||||
zuul_copy_output:
|
||||
/var/log/kafka: logs
|
||||
/var/log/monasca/notification: logs
|
||||
/etc/kafka/server.properties: logs
|
||||
/etc/kafka/producer.properties: logs
|
||||
/etc/kafka/consumer.properties: logs
|
||||
/etc/monasca/monasca-notification.conf: logs
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^.*\.md$
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
#
|
||||
# (C) Copyright 2015,2016 Hewlett Packard Enterprise Development Company LP
|
||||
# Copyright 2017 Fujitsu LIMITED
|
||||
#
|
||||
# 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: "%KAFKA_HOST%:9092"
|
||||
group: "monasca-notification"
|
||||
alarm_topic: "alarm-state-transitions"
|
||||
notification_topic: "alarm-notifications"
|
||||
notification_retry_topic: "retry-notifications"
|
||||
periodic:
|
||||
60: 60-seconds-notifications
|
||||
max_offset_lag: 600 # In seconds, undefined for none
|
||||
|
||||
database:
|
||||
# repo_driver: monasca_notification.common.repositories.postgres.pgsql_repo:PostgresqlRepo
|
||||
# repo_driver: monasca_notification.common.repositories.orm.orm_repo:OrmRepo
|
||||
# repo_driver: monasca_notification.common.repositories.mysql.mysql_repo:MysqlRepo
|
||||
repo_driver: %MONASCA_NOTIFICATION_DATABASE_DRIVER%
|
||||
orm:
|
||||
url: %MONASCA_NOTIFICATION_DATABASE_ENGINE%://%DATABASE_USER%:%DATABASE_PASSWORD%@%DATABASE_HOST%:%DATABASE_PORT%/mon
|
||||
|
||||
mysql:
|
||||
host: %DATABASE_HOST%
|
||||
user: %DATABASE_USER%
|
||||
passwd: %DATABASE_PASSWORD%
|
||||
db: mon
|
||||
|
||||
postgresql:
|
||||
host: %DATABASE_HOST%
|
||||
port: %DATABASE_PORT%
|
||||
user: %DATABASE_USER%
|
||||
password: %DATABASE_PASSWORD%
|
||||
database: mon
|
||||
|
||||
notification_types:
|
||||
plugins:
|
||||
- monasca_notification.plugins.email_notifier:EmailNotifier
|
||||
- monasca_notification.plugins.webhook_notifier:WebhookNotifier
|
||||
- monasca_notification.plugins.pagerduty_notifier:PagerdutyNotifier
|
||||
|
||||
email:
|
||||
server: "localhost"
|
||||
port: 25
|
||||
user: ""
|
||||
password: ""
|
||||
timeout: 15
|
||||
from_addr: "hpcs.mon@hp.com"
|
||||
grafana_url: "%GRAFANA_URL%"
|
||||
|
||||
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"
|
||||
periodic_path:
|
||||
60: /notification/60_seconds
|
||||
|
||||
logging: # Used in logging.dictConfig
|
||||
# This sets logging.raiseExcetpions. It is recommended to leave this set to False.
|
||||
# See https://docs.python.org/2/howto/logging.html#exceptions-raised-during-logging
|
||||
raise_exceptions: False
|
||||
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: "%MONASCA_NOTIFICATION_LOG_DIR%/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
|
||||
statsd:
|
||||
host: 'localhost'
|
||||
port: %MONASCA_STATSD_PORT%
|
||||
|
||||
keystone:
|
||||
auth_required: False
|
||||
auth_url: '%KEYSTONE_URL%'
|
||||
username: 'admin'
|
||||
password: 'password'
|
||||
project_name: 'admin'
|
||||
user_domain_name: 'default'
|
||||
project_domain_name: 'default'
|
||||
auth_type: 'password'
|
|
@ -19,7 +19,7 @@ set +o xtrace
|
|||
|
||||
MONASCA_NOTIFICATION_CONF_DIR=${MONASCA_NOTIFICATION_CONF_DIR:-/etc/monasca}
|
||||
MONASCA_NOTIFICATION_LOG_DIR=${MONASCA_NOTIFICATION_LOG_DIR:-/var/log/monasca/notification}
|
||||
MONASCA_NOTIFICATION_CONF=${MONASCA_NOTIFICATION_CONF:-$MONASCA_NOTIFICATION_CONF_DIR/notification.yaml}
|
||||
MONASCA_NOTIFICATION_CONF=${MONASCA_NOTIFICATION_CONF:-$MONASCA_NOTIFICATION_CONF_DIR/monasca-notification.conf}
|
||||
MONASCA_NOTIFICATION_GATE_CFG_LINK=/etc/monasca-notification
|
||||
|
||||
if [[ ${USE_VENV} = True ]]; then
|
||||
|
@ -75,8 +75,6 @@ configure_monasca-notification() {
|
|||
sudo install -d -o $STACK_USER ${MONASCA_NOTIFICATION_CONF_DIR}
|
||||
sudo install -d -o $STACK_USER ${MONASCA_NOTIFICATION_LOG_DIR}
|
||||
|
||||
install -m 600 ${MONASCA_API_DIR}/devstack/files/monasca-notification/notification.yaml ${MONASCA_NOTIFICATION_CONF}
|
||||
|
||||
local dbDriver
|
||||
local dbEngine
|
||||
local dbPort
|
||||
|
@ -93,19 +91,25 @@ configure_monasca-notification() {
|
|||
dbDriver="monasca_notification.common.repositories.orm.orm_repo:OrmRepo"
|
||||
fi
|
||||
|
||||
sudo sed -e "
|
||||
s|%DATABASE_HOST%|${DATABASE_HOST}|g;
|
||||
s|%DATABASE_PORT%|$dbPort|g;
|
||||
s|%DATABASE_PASSWORD%|${DATABASE_PASSWORD}|g;
|
||||
s|%DATABASE_USER%|${DATABASE_USER}|g;
|
||||
s|%MONASCA_NOTIFICATION_DATABASE_DRIVER%|$dbDriver|g;
|
||||
s|%MONASCA_NOTIFICATION_DATABASE_ENGINE%|$dbEngine|g;
|
||||
s|%KAFKA_HOST%|${SERVICE_HOST}|g;
|
||||
s|%MONASCA_STATSD_PORT%|${MONASCA_STATSD_PORT}|g;
|
||||
s|%MONASCA_NOTIFICATION_LOG_DIR%|${MONASCA_NOTIFICATION_LOG_DIR}|g;
|
||||
s|%GRAFANA_URL%|http:\/\/${SERVICE_HOST}:3000|g;
|
||||
s|%KEYSTONE_URL%|http:\/\/${SERVICE_HOST}\/identity\/v3|g;
|
||||
" -i ${MONASCA_NOTIFICATION_CONF}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" kafka url ${DATABASE_HOST}:9092
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" database repo_driver ${dbDriver}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" email_notifier grafana_url ${SERVICE_HOST}:3000
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" keystone auth_url ${SERVICE_HOST}/identity/v3
|
||||
if is_service_enabled postgresql; then
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" postgresql host ${DATABASE_HOST}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" postgresql port ${dbPort}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" postgresql user ${DATABASE_USER}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" postgresql passwd ${DATABASE_PASSWORD}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" postgresql db mon
|
||||
else
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" mysql host ${DATABASE_HOST}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" mysql user ${DATABASE_USER}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" mysql passwd ${DATABASE_PASSWORD}
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" mysql db mon
|
||||
fi
|
||||
if [[ ${MONASCA_DATABASE_USE_ORM} == "True" ]]; then
|
||||
iniset "${MONASCA_NOTIFICATION_CONF}" orm url ${dbEngine}://${DATABASE_USER}:${DATABASE_PASSWORD}%${DATABASE_HOST}:${dbPort}/mon
|
||||
fi
|
||||
|
||||
sudo install -d -o ${STACK_USER} ${MONASCA_NOTIFICATION_GATE_CFG_LINK}
|
||||
ln -sf ${MONASCA_NOTIFICATION_CONF} ${MONASCA_NOTIFICATION_GATE_CFG_LINK}
|
||||
|
@ -118,7 +122,7 @@ configure_monasca-notification() {
|
|||
start_monasca-notification(){
|
||||
if is_monasca_notification_enabled; then
|
||||
echo_summary "Starting monasca-notification"
|
||||
run_process "monasca-notification" "$MONASCA_NOTIFICATION_BIN_DIR/monasca-notification $MONASCA_NOTIFICATION_CONF"
|
||||
run_process "monasca-notification" "$MONASCA_NOTIFICATION_BIN_DIR/monasca-notification"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue