Add metrics configuration

This commit is contained in:
Semen Bezrukov 2020-07-21 21:01:46 +03:00
parent c2bcd00322
commit 7dd4e19a83
2 changed files with 26 additions and 0 deletions

7
config/statsd/config.js Normal file
View file

@ -0,0 +1,7 @@
{
"graphiteHost": "127.0.0.1",
"graphitePort": 2003,
"port": 8125,
"flushInterval": 3000,
"backends": [ "./backends/graphite.js" ]
}

View file

@ -78,6 +78,11 @@ read_setting(){
deprecated_var AMQP_SERVER_URL AMQP_URI
deprecated_var AMQP_SERVER_TYPE AMQP_TYPE
METRICS_ENABLED="${METRICS_ENABLED:-$(${JSON} statsd.useMetrics)}"
METRICS_HOST="${METRICS_HOST:-$(${JSON} statsd.host)}"
METRICS_PORT="${METRICS_PORT:-$(${JSON} statsd.port)}"
METRICS_PREFIX="${METRICS_PREFIX:-$(${JSON} statsd.prefix)}"
DB_HOST=${DB_HOST:-${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}}
case $DB_TYPE in
"postgres")
@ -179,6 +184,16 @@ waiting_for_redis(){
waiting_for_datacontainer(){
waiting_for_connection ${ONLYOFFICE_DATA_CONTAINER_HOST} ${ONLYOFFICE_DATA_CONTAINER_PORT}
}
update_statsd_settings(){
cp ${SYSCONF_TEMPLATES_DIR}/statsd/config.js ${APP_DIR}/server/Metrics/config/config.js
${JSON} -I -e "this.statsd.useMetrics = '${METRICS_ENABLED}'"
${JSON} -I -e "this.statsd.host = '${METRICS_HOST}'"
${JSON} -I -e "this.statsd.port = '${METRICS_PORT}'"
${JSON} -I -e "this.statsd.prefix = '${METRICS_PREFIX}'"
}
update_db_settings(){
${JSON} -I -e "this.services.CoAuthoring.sql.type = '${DB_TYPE}'"
${JSON} -I -e "this.services.CoAuthoring.sql.dbHost = '${DB_HOST}'"
@ -420,6 +435,10 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
read_setting
if [ $METRICS_ENABLED = "true" ]; then
update_statsd_settings
fi
update_welcome_page
update_log_settings