"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "devstack/plugin.sh" between
monasca-log-api-2.7.0.tar.gz and monasca-log-api-2.9.0.tar.gz

About: OpenStack Monasca Log API is a RESTful API server acting as gateway for logs collected from log-agents.
The "Stein" series (maintained release).

plugin.sh  (monasca-log-api-2.7.0):plugin.sh  (monasca-log-api-2.9.0)
skipping to change at line 36 skipping to change at line 36
# source lib/* # source lib/*
source ${MONASCA_LOG_API_DIR}/devstack/lib/util.sh source ${MONASCA_LOG_API_DIR}/devstack/lib/util.sh
source ${MONASCA_LOG_API_DIR}/devstack/lib/config.sh source ${MONASCA_LOG_API_DIR}/devstack/lib/config.sh
# source lib/* # source lib/*
# TOP_LEVEL functions called from devstack coordinator # TOP_LEVEL functions called from devstack coordinator
############################################################################### ###############################################################################
function pre_install { function pre_install {
install_elk install_elk
install_node_nvm install_nodejs
install_gate_config_holder install_gate_config_holder
} }
function install_monasca_log { function install_monasca_log {
build_kibana_plugin build_kibana_plugin
if is_service_enabled monasca-log-api; then if is_service_enabled monasca-log-api; then
# install_monasca-log-api is not called directly # install_monasca-log-api is not called directly
# stack_install_service calls it # stack_install_service calls it
if python3_enabled; then
enable_python3_package monasca-log-api
fi
stack_install_service monasca-log-api stack_install_service monasca-log-api
fi fi
install_log_agent install_log_agent
} }
function install_elk { function install_elk {
install_logstash install_logstash
install_elasticsearch install_elasticsearch
install_kibana install_kibana
} }
skipping to change at line 92 skipping to change at line 95
configure_monasca_log_metrics configure_monasca_log_metrics
configure_monasca_log_persister configure_monasca_log_persister
configure_monasca_log_agent configure_monasca_log_agent
} }
function init_monasca_log { function init_monasca_log {
enable_log_management enable_log_management
create_log_management_accounts create_log_management_accounts
} }
function init_monasca_grafana_dashboards {
if is_service_enabled horizon; then
echo_summary "Init Grafana dashboards"
sudo python "${PLUGIN_FILES}"/grafana/grafana.py "${PLUGIN_FILES}"/grafa
na/dashboards.d
fi
}
function init_agent {
echo_summary "Init Monasca agent"
sudo cp -f "${PLUGIN_FILES}"/monasca-agent/http_check.yaml /etc/monasca/agen
t/conf.d/http_check.yaml
sudo cp -f "${PLUGIN_FILES}"/monasca-agent/process.yaml /etc/monasca/agent/c
onf.d/process.yaml
sudo cp -f "${PLUGIN_FILES}"/monasca-agent/elastic.yaml /etc/monasca/agent/c
onf.d/elastic.yaml
sudo sed -i "s/{{IP}}/$(ip -o -4 addr list eth1 | awk '{print $4}' | cut -d/
-f1 | head -1)/" /etc/monasca/agent/conf.d/*.yaml
sudo sed -i "s/127\.0\.0\.1/$(hostname)/" /etc/monasca/agent/conf.d/*.yaml
sudo systemctl restart monasca-collector
}
function stop_monasca_log { function stop_monasca_log {
stop_process "monasca-log-agent" || true stop_process "monasca-log-agent" || true
stop_monasca_log_api stop_monasca_log_api
stop_process "monasca-log-metrics" || true stop_process "monasca-log-metrics" || true
stop_process "monasca-log-persister" || true stop_process "monasca-log-persister" || true
stop_process "monasca-log-transformer" || true stop_process "monasca-log-transformer" || true
stop_process "kibana" || true stop_process "kibana" || true
stop_process "elasticsearch" || true stop_process "elasticsearch" || true
} }
skipping to change at line 120 skipping to change at line 143
} }
function clean_monasca_log { function clean_monasca_log {
clean_monasca_log_agent clean_monasca_log_agent
clean_monasca_log_api clean_monasca_log_api
clean_monasca_log_persister clean_monasca_log_persister
clean_monasca_log_transformer clean_monasca_log_transformer
clean_kibana clean_kibana
clean_elasticsearch clean_elasticsearch
clean_logstash clean_logstash
clean_node_nvm clean_nodejs
clean_gate_config_holder clean_gate_config_holder
} }
############################################################################### ###############################################################################
function install_monasca-log-api { function install_monasca-log-api {
echo_summary "Installing monasca-log-api" echo_summary "Installing monasca-log-api"
git_clone $MONASCA_LOG_API_REPO $MONASCA_LOG_API_DIR $MONASCA_LOG_API_BRANCH git_clone $MONASCA_LOG_API_REPO $MONASCA_LOG_API_DIR $MONASCA_LOG_API_BRANCH
setup_develop $MONASCA_LOG_API_DIR setup_develop $MONASCA_LOG_API_DIR
skipping to change at line 180 skipping to change at line 203
# Put config files in ``$MONASCA_LOG_API_CONF_DIR`` for everyone to find # Put config files in ``$MONASCA_LOG_API_CONF_DIR`` for everyone to find
sudo install -d -o $STACK_USER $MONASCA_LOG_API_CONF_DIR sudo install -d -o $STACK_USER $MONASCA_LOG_API_CONF_DIR
sudo install -m 700 -d -o $STACK_USER $MONASCA_LOG_API_CACHE_DIR sudo install -m 700 -d -o $STACK_USER $MONASCA_LOG_API_CACHE_DIR
sudo install -d -o $STACK_USER $MONASCA_LOG_API_LOG_DIR sudo install -d -o $STACK_USER $MONASCA_LOG_API_LOG_DIR
# ensure fresh installation of configuration files # ensure fresh installation of configuration files
rm -rf $MONASCA_LOG_API_CONF $MONASCA_LOG_API_PASTE $MONASCA_LOG_API_LOGGING _CONF rm -rf $MONASCA_LOG_API_CONF $MONASCA_LOG_API_PASTE $MONASCA_LOG_API_LOGGING _CONF
$MONASCA_LOG_API_BIN_DIR/oslo-config-generator \ $MONASCA_LOG_API_BIN_DIR/oslo-config-generator \
--config-file $MONASCA_LOG_API_DIR/config-generator/monasca-log-api.conf \ --config-file $MONASCA_LOG_API_DIR/config-generator/monasca-log-api.conf \
--output-file /tmp/log-api.conf --output-file /tmp/monasca-log-api.conf
install -m 600 /tmp/log-api.conf $MONASCA_LOG_API_CONF && rm -rf /tmp/log-ap i.conf install -m 600 /tmp/monasca-log-api.conf $MONASCA_LOG_API_CONF && rm -rf /tm p/monasca-log-api.conf
install -m 600 $MONASCA_LOG_API_DIR/etc/monasca/log-api-paste.ini $MONASCA_L OG_API_PASTE install -m 600 $MONASCA_LOG_API_DIR/etc/monasca/log-api-paste.ini $MONASCA_L OG_API_PASTE
install -m 600 $MONASCA_LOG_API_DIR/etc/monasca/log-api-logging.conf $MONASC A_LOG_API_LOGGING_CONF install -m 600 $MONASCA_LOG_API_DIR/etc/monasca/log-api-logging.conf $MONASC A_LOG_API_LOGGING_CONF
# configure log-api.conf # configure monasca-log-api.conf
iniset "$MONASCA_LOG_API_CONF" DEFAULT log_config_append $MONASCA_LOG_API_LO GGING_CONF iniset "$MONASCA_LOG_API_CONF" DEFAULT log_config_append $MONASCA_LOG_API_LO GGING_CONF
iniset "$MONASCA_LOG_API_CONF" service region $REGION_NAME iniset "$MONASCA_LOG_API_CONF" service region $REGION_NAME
iniset "$MONASCA_LOG_API_CONF" log_publisher kafka_url $KAFKA_SERVICE_HOST:$ KAFKA_SERVICE_PORT iniset "$MONASCA_LOG_API_CONF" log_publisher kafka_url $KAFKA_SERVICE_HOST:$ KAFKA_SERVICE_PORT
iniset "$MONASCA_LOG_API_CONF" log_publisher topics log iniset "$MONASCA_LOG_API_CONF" log_publisher topics log
iniset "$MONASCA_LOG_API_CONF" kafka_healthcheck kafka_url $KAFKA_SERVICE_HO ST:$KAFKA_SERVICE_PORT iniset "$MONASCA_LOG_API_CONF" kafka_healthcheck kafka_url $KAFKA_SERVICE_HO ST:$KAFKA_SERVICE_PORT
iniset "$MONASCA_LOG_API_CONF" kafka_healthcheck kafka_topics log iniset "$MONASCA_LOG_API_CONF" kafka_healthcheck kafka_topics log
iniset "$MONASCA_LOG_API_CONF" roles_middleware path "/v2.0/log,/v3.0/logs" iniset "$MONASCA_LOG_API_CONF" roles_middleware path "/v2.0/log,/v3.0/logs"
skipping to change at line 379 skipping to change at line 402
sudo rm -rf $FILES/logstash-${LOGSTASH_VERSION}.tar.gz || true sudo rm -rf $FILES/logstash-${LOGSTASH_VERSION}.tar.gz || true
sudo rm -rf $DEST/logstash-${LOGSTASH_VERSION} || true sudo rm -rf $DEST/logstash-${LOGSTASH_VERSION} || true
fi fi
} }
function install_elasticsearch { function install_elasticsearch {
if is_service_enabled elasticsearch; then if is_service_enabled elasticsearch; then
echo_summary "Installing ElasticSearch ${ELASTICSEARCH_VERSION}" echo_summary "Installing ElasticSearch ${ELASTICSEARCH_VERSION}"
local es_tarball=elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz local es_tarball=elasticsearch-${ELASTICSEARCH_VERSION}.tar.gz
local es_url=http://download.elasticsearch.org/elasticsearch/elasticsear ch/${es_tarball} local es_url=https://download.elastic.co/elasticsearch/release/org/elast icsearch/distribution/tar/elasticsearch/${ELASTICSEARCH_VERSION}/${es_tarball}
local es_dest local es_dest
es_dest=`get_extra_file ${es_url}` es_dest=`get_extra_file ${es_url}`
tar xzf ${es_dest} -C $DEST tar xzf ${es_dest} -C $DEST
sudo chown -R $STACK_USER $DEST/elasticsearch-${ELASTICSEARCH_VERSION} sudo chown -R $STACK_USER $DEST/elasticsearch-${ELASTICSEARCH_VERSION}
ln -sf $DEST/elasticsearch-${ELASTICSEARCH_VERSION} $ELASTICSEARCH_DIR ln -sf $DEST/elasticsearch-${ELASTICSEARCH_VERSION} $ELASTICSEARCH_DIR
fi fi
} }
skipping to change at line 618 skipping to change at line 641
echo_summary "Starting monasca-log-metrics" echo_summary "Starting monasca-log-metrics"
local logstash="$LOGSTASH_DIR/bin/logstash" local logstash="$LOGSTASH_DIR/bin/logstash"
run_process "monasca-log-metrics" "$logstash -f $LOG_METRICS_DIR/log-met rics.conf" run_process "monasca-log-metrics" "$logstash -f $LOG_METRICS_DIR/log-met rics.conf"
fi fi
} }
function install_log_agent { function install_log_agent {
if is_service_enabled monasca-log-agent; then if is_service_enabled monasca-log-agent; then
echo_summary "Installing monasca-log-agent [monasca-output-plugin]" echo_summary "Installing monasca-log-agent [monasca-output-plugin]"
local monasca_log_agent_version=0.5.2 $LOGSTASH_DIR/bin/plugin install --version \
local ls_plugin_filename=logstash-output-monasca_log_api-${monasca_log_a "${LOGSTASH_OUTPUT_MONASCA_VERSION}" logstash-output-monasca_log_api
gent_version}.gem
$LOGSTASH_DIR/bin/plugin install "${PLUGIN_FILES}"/monasca-log-agent/${l
s_plugin_filename}
fi fi
} }
function configure_monasca_log_agent { function configure_monasca_log_agent {
if is_service_enabled monasca-log-agent; then if is_service_enabled monasca-log-agent; then
echo_summary "Configuring monasca-log-agent" echo_summary "Configuring monasca-log-agent"
sudo install -m 755 -d -o $STACK_USER $LOG_AGENT_DIR sudo install -m 755 -d -o $STACK_USER $LOG_AGENT_DIR
sudo cp -f "${PLUGIN_FILES}"/monasca-log-agent/agent.conf $LOG_AGENT_DIR /agent.conf sudo cp -f "${PLUGIN_FILES}"/monasca-log-agent/agent.conf $LOG_AGENT_DIR /agent.conf
skipping to change at line 660 skipping to change at line 681
} }
function start_monasca_log_agent { function start_monasca_log_agent {
if is_service_enabled monasca-log-agent; then if is_service_enabled monasca-log-agent; then
echo_summary "Starting monasca-log-agent" echo_summary "Starting monasca-log-agent"
local logstash="$LOGSTASH_DIR/bin/logstash" local logstash="$LOGSTASH_DIR/bin/logstash"
run_process "monasca-log-agent" "$logstash -f $LOG_AGENT_DIR/agent.conf" "root" "root" run_process "monasca-log-agent" "$logstash -f $LOG_AGENT_DIR/agent.conf" "root" "root"
fi fi
} }
function install_node_nvm { function install_nodejs {
set -i
if [[ ! -f "${HOME}/.nvm/nvm.sh" ]] && is_service_enabled kibana; then
# note(trebskit) we need node to build kibana plugin
# so if kibana is enabled in this environment, let's install node
echo_summary "Install Node ${NODE_JS_VERSION} with NVM ${NVM_VERSION}"
local nvmUrl=https://raw.githubusercontent.com/creationix/nvm/v${NVM_VER
SION}/install.sh
local nvmDest
nvmDest=`get_extra_file ${nvmUrl}`
bash ${nvmDest}
fi
if is_service_enabled kibana; then if is_service_enabled kibana; then
# refresh installation # refresh installation
apt_get install nodejs npm
( (
source "${HOME}"/.nvm/nvm.sh >> /dev/null; \
nvm install ${NODE_JS_VERSION}; \
nvm use ${NODE_JS_VERSION}; \
npm config set registry "http://registry.npmjs.org/"; \ npm config set registry "http://registry.npmjs.org/"; \
npm config set proxy "${HTTP_PROXY}"; \ npm config set proxy "${HTTP_PROXY}"; \
npm set strict-ssl false; npm set strict-ssl false;
) )
fi fi
set +i
} }
function clean_node_nvm { function clean_nodejs {
if [[ -f "${HOME}/.nvm/nvm.sh" ]] && is_service_enabled kibana; then if is_service_enabled kibana; then
echo_summary "Cleaning Node ${NODE_JS_VERSION} with NVM ${NVM_VERSION}" echo_summary "Cleaning Node.js"
sudo rm ${FILES}/nvm_install.sh apt_get purge nodejs npm
sudo rm -rf "${HOME}/.nvm/nvm.sh"
fi fi
} }
function clean_gate_config_holder { function clean_gate_config_holder {
sudo rm -rf $GATE_CONFIGURATION_DIR || true sudo rm -rf $GATE_CONFIGURATION_DIR || true
} }
function build_kibana_plugin { function build_kibana_plugin {
if is_service_enabled kibana; then if is_service_enabled kibana; then
echo "Building Kibana plugin" echo "Building Kibana plugin"
git_clone $MONASCA_KIBANA_PLUGIN_REPO $MONASCA_KIBANA_PLUGIN_DIR \ git_clone $MONASCA_KIBANA_PLUGIN_REPO $MONASCA_KIBANA_PLUGIN_DIR \
$MONASCA_KIBANA_PLUGIN_BRANCH $MONASCA_KIBANA_PLUGIN_BRANCH
pushd $MONASCA_KIBANA_PLUGIN_DIR pushd $MONASCA_KIBANA_PLUGIN_DIR
local monasca_kibana_plugin_version local monasca_kibana_plugin_version
monasca_kibana_plugin_version="$(python -c 'import json; \ monasca_kibana_plugin_version="$(python -c 'import json; \
obj = json.load(open("package.json")); print obj["version"]')" obj = json.load(open("package.json")); print obj["version"]')"
set -i npm install
(source "${HOME}"/.nvm/nvm.sh >> /dev/null; nvm use ${NODE_JS_VERSION}; npm run package
npm install)
(source "${HOME}"/.nvm/nvm.sh >> /dev/null; nvm use ${NODE_JS_VERSION};
npm run package)
set +i
local pkg=$MONASCA_KIBANA_PLUGIN_DIR/target/monasca-kibana-plugin-${mona sca_kibana_plugin_version}.tar.gz local pkg=$MONASCA_KIBANA_PLUGIN_DIR/target/monasca-kibana-plugin-${mona sca_kibana_plugin_version}.tar.gz
local easyPkg=$DEST/monasca-kibana-plugin.tar.gz local easyPkg=$DEST/monasca-kibana-plugin.tar.gz
ln -sf $pkg $easyPkg ln -sf $pkg $easyPkg
popd popd
fi fi
} }
skipping to change at line 785 skipping to change at line 788
fi fi
} }
function enable_log_management { function enable_log_management {
if is_service_enabled horizon && is_service_enabled kibana; then if is_service_enabled horizon && is_service_enabled kibana; then
echo_summary "Configure Horizon with Kibana access" echo_summary "Configure Horizon with Kibana access"
local localSettings=${DEST}/horizon/monitoring/config/local_settings.py local localSettings=${DEST}/horizon/monitoring/config/local_settings.py
sudo sed -e " sudo sed -e "
s|ENABLE_KIBANA_BUTTON = getattr(settings, 'ENABLE_KIBANA_BUTTON', F alse)|ENABLE_KIBANA_BUTTON = getattr(settings, 'ENABLE_KIBANA_BUTTON', True)|g;
s|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://192.168.10. 4:5601/')|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://${KIBANA_SERVIC E_HOST}:${KIBANA_SERVICE_PORT}/')|g; s|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://192.168.10. 4:5601/')|KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://${KIBANA_SERVIC E_HOST}:${KIBANA_SERVICE_PORT}/')|g;
" -i ${localSettings} " -i ${localSettings}
if is_service_enabled monasca-log-api; then
sudo sed -e "
s|'ENABLE_LOG_MANAGEMENT_BUTTON', False|'ENABLE_LOG_MANAGEMENT_B
UTTON', True|g;
" -i ${localSettings}
fi
restart_apache_server restart_apache_server
fi fi
} }
# check for service enabled # check for service enabled
if is_service_enabled monasca-log; then if is_service_enabled monasca-log; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services # Set up system services
echo_summary "Configuring Monasca Log Management system services" echo_summary "Configuring Monasca Log Management system services"
skipping to change at line 815 skipping to change at line 823
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured # Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring Monasca Log Management" echo_summary "Configuring Monasca Log Management"
configure_monasca_log configure_monasca_log
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the Monasca service # Initialize and start the Monasca service
echo_summary "Initializing Monasca Log Management" echo_summary "Initializing Monasca Log Management"
init_monasca_log init_monasca_log
init_monasca_grafana_dashboards
if is_service_enabled monasca-agent; then
init_agent
fi
start_monasca_log start_monasca_log
fi fi
if [[ "$1" == "unstack" ]]; then if [[ "$1" == "unstack" ]]; then
# Shut down Monasca services # Shut down Monasca services
echo_summary "Unstacking Monasca Log Management" echo_summary "Unstacking Monasca Log Management"
stop_monasca_log stop_monasca_log
delete_kafka_topics delete_kafka_topics
fi fi
 End of changes. 18 change blocks. 
42 lines changed or deleted 55 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)