Skip to content

Commit

Permalink
Changed output of error messages for analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
kochetovd committed Jan 16, 2025
1 parent 89fbde7 commit 2fb3ed8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 2 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=<MYSQL_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=<MYSQL_ROOT_PASSWORD> ping\` and reinstall the agent."
on_error
exit 1
fi
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions mysqlconfigurer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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-------"
Expand All @@ -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"
Expand Down

0 comments on commit 2fb3ed8

Please sign in to comment.