From 2fb3ed8e808b53847669c6bdc8f7180abc47792e Mon Sep 17 00:00:00 2001 From: Dmitry Kochetov Date: Thu, 16 Jan 2025 16:49:15 +0300 Subject: [PATCH] Changed output of error messages for analysis --- install.sh | 6 ++---- mysqlconfigurer.sh | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 6d30795..fdfdab4 100644 --- a/install.sh +++ b/install.sh @@ -414,9 +414,8 @@ else printf "\033[32m\n Created new user \`${RELEEM_MYSQL_LOGIN}\`\033[0m\n" FLAG_SUCCESS=1 else - printf "\033[31m\n MySQL connection failed with user root with error:\033[0m\n" + printf "\033[31m\n%s\n%s\033[0m\n" "MySQL connection failed with user root with error." "Check that the password is correct, the execution of the command \`${mysqladmincmd} ${root_connection_string} --user=root --password= ping\` and reinstall the agent." $mysqladmincmd ${root_connection_string} --user=root --password=${RELEEM_MYSQL_ROOT_PASSWORD} ping || true - printf "\033[31m\n%s\033[0m\n" "Check that the password is correct, the execution of the command \`${mysqladmincmd} ${root_connection_string} --user=root --password= ping\` and reinstall the agent." on_error exit 1 fi @@ -432,9 +431,8 @@ if [ "$FLAG_SUCCESS" == "1" ]; then MYSQL_LOGIN=$RELEEM_MYSQL_LOGIN MYSQL_PASSWORD=$RELEEM_MYSQL_PASSWORD else - printf "\033[31m\n Connect to mysql failed with user \`${RELEEM_MYSQL_LOGIN}\` with error:\033[0m\n" + printf "\033[31m\n%s\n%s\033[0m\n" "Connect to mysql failed with user \`${RELEEM_MYSQL_LOGIN}\` with error." "Check that the user and password is correct, the execution of the command \`${mysqladmin} ${connection_string} --user=${RELEEM_MYSQL_LOGIN} --password=${RELEEM_MYSQL_PASSWORD} ping\` and reinstall the agent." $mysqladmincmd ${connection_string} --user=${RELEEM_MYSQL_LOGIN} --password=${RELEEM_MYSQL_PASSWORD} ping || true - printf "\033[31m\n%s\033[0m\n" "Check that the user and password is correct, the execution of the command \`${mysqladmin} ${connection_string} --user=${RELEEM_MYSQL_LOGIN} --password=${RELEEM_MYSQL_PASSWORD} ping\` and reinstall the agent." on_error exit 1 fi diff --git a/mysqlconfigurer.sh b/mysqlconfigurer.sh index 9d26f6e..e660638 100644 --- a/mysqlconfigurer.sh +++ b/mysqlconfigurer.sh @@ -214,8 +214,7 @@ function releem_ps_mysql() { fi chmod 644 $RELEEM_MYSQL_CONFIG_DIR/collect_metrics.cnf else - printf "\033[31m\n MySQL configuration directory is not found.\033[0m" - printf "\033[31m\n Try to reinstall Releem Agent.\033[0m" + printf "\033[31m\n MySQL configuration directory is not found.\n Try to reinstall Releem Agent.\033[0m" exit 3; fi if [ "$FLAG_CONFIGURE" -eq 1 ]; then @@ -236,8 +235,7 @@ function releem_ps_mysql() { FLAG_RESTART_SERVICE=0 fi if [ "$FLAG_RESTART_SERVICE" -eq 0 ]; then - printf "\033[31m\n * For appling change in configuration mysql need restart service.\n\033[0m" - printf "\033[31m Run the command \`bash /opt/releem/mysqlconfigurer.sh -p\` when it is possible to restart the service.\033[0m\n" + printf "\033[31m\n * For appling change in configuration mysql need restart service.\n Run the command \`bash /opt/releem/mysqlconfigurer.sh -p\` when it is possible to restart the service.\033[0m\n" exit 0 fi #echo "-------Test config-------" @@ -249,8 +247,7 @@ function releem_ps_mysql() { #if [[ $($mysqladmincmd ${connection_string} --user=${MYSQL_LOGIN} --password=${MYSQL_PASSWORD} ping 2>/dev/null || true) == "mysqld is alive" ]]; if [ $RESTART_CODE -eq 0 ]; then - printf "\033[32m\n The MySQL service restarted successfully!\033[0m\n" - printf "\033[32m\n Performance schema and Slow Log are enabled.\033[0m\n" + printf "\033[32m\n The MySQL service restarted successfully!\n Performance schema and Slow Log are enabled.\033[0m\n" elif [ $RESTART_CODE -eq 6 ]; then printf "\033[31m\n The MySQL service failed to restart in 1200 seconds! Check the MySQL error log!\033[0m\n"