diff --git a/config/config.go b/config/config.go index 663e554..5f53d79 100644 --- a/config/config.go +++ b/config/config.go @@ -9,7 +9,7 @@ import ( ) const ( - ReleemAgentVersion = "1.10.0.4" + ReleemAgentVersion = "1.11.0" ) type Config struct { diff --git a/current_version_agent b/current_version_agent index af72e4e..169f19b 100644 --- a/current_version_agent +++ b/current_version_agent @@ -1 +1 @@ -1.10.0.4 \ No newline at end of file +1.11.0 \ No newline at end of file diff --git a/install.sh b/install.sh index 241ddaf..55c4da4 100644 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/bash -# install.sh - Version 1.10.0.4 +# install.sh - Version 1.11.0 # (C) Releem, Inc 2022 # All rights reserved @@ -7,7 +7,7 @@ # using the package manager. set -e -install_script_version=1.10.0.4 +install_script_version=1.11.0 logfile="releem-install.log" WORKDIR="/opt/releem" @@ -55,7 +55,7 @@ function releem_update() { $sudo_cmd chmod 755 $WORKDIR/mysqlconfigurer.sh $WORKDIR/releem-agent $sudo_cmd $WORKDIR/releem-agent start || true $sudo_cmd $WORKDIR/releem-agent -f - + echo echo echo -e "Releem Agent updated successfully." diff --git a/mysqlconfigurer.sh b/mysqlconfigurer.sh index a201e4b..3b40a36 100755 --- a/mysqlconfigurer.sh +++ b/mysqlconfigurer.sh @@ -1,5 +1,5 @@ #!/bin/bash -# mysqlconfigurer.sh - Version 1.10.0.4 +# mysqlconfigurer.sh - Version 1.11.0 # (C) Releem, Inc 2022 # All rights reserved @@ -12,7 +12,7 @@ MYSQLTUNER_REPORT=$MYSQLCONFIGURER_PATH"mysqltunerreport.json" RELEEM_MYSQL_VERSION=$MYSQLCONFIGURER_PATH"mysql_version" MYSQLCONFIGURER_CONFIGFILE="${MYSQLCONFIGURER_PATH}${MYSQLCONFIGURER_FILE_NAME}" MYSQL_MEMORY_LIMIT=0 -VERSION="1.10.0.4" +VERSION="1.11.0 RELEEM_INSTALL_PATH=$MYSQLCONFIGURER_PATH"install.sh" logfile="releem-mysqlconfigurer.log" diff --git a/repeater/releemConfiguration.go b/repeater/releemConfiguration.go index 68baff0..a1d2622 100644 --- a/repeater/releemConfiguration.go +++ b/repeater/releemConfiguration.go @@ -37,6 +37,7 @@ func (repeater ReleemConfigurationsRepeater) ProcessMetrics(context m.MetricCont req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return nil, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) client := http.Client{ @@ -45,6 +46,7 @@ func (repeater ReleemConfigurationsRepeater) ProcessMetrics(context m.MetricCont res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return nil, err } defer res.Body.Close() repeater.logger.Println(" * Downloading recommended MySQL configuration from Releem Cloud Platform...") @@ -52,6 +54,7 @@ func (repeater ReleemConfigurationsRepeater) ProcessMetrics(context m.MetricCont body_res, err := io.ReadAll(res.Body) if err != nil { repeater.logger.Error("Response: error read body request: ", err) + return nil, err } if res.StatusCode != 200 { repeater.logger.Println("Response: status code: ", res.StatusCode) @@ -62,6 +65,7 @@ func (repeater ReleemConfigurationsRepeater) ProcessMetrics(context m.MetricCont err = os.WriteFile(context.GetReleemConfDir()+"/z_aiops_mysql.cnf", body_res, 0644) if err != nil { repeater.logger.Error("WriteFile: Error write to file: ", err) + return nil, err } repeater.logger.Println("1. Recommended MySQL configuration downloaded to ", context.GetReleemConfDir()) repeater.logger.Println("2. To check MySQL Performance Score please visit https://app.releem.com/dashboard?menu=metrics") diff --git a/repeater/releemEvents.go b/repeater/releemEvents.go index 5814ce3..fe20182 100644 --- a/repeater/releemEvents.go +++ b/repeater/releemEvents.go @@ -37,6 +37,7 @@ func (repeater ReleemEventsRepeater) ProcessMetrics(context m.MetricContext, met req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return nil, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) @@ -47,6 +48,7 @@ func (repeater ReleemEventsRepeater) ProcessMetrics(context m.MetricContext, met res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return nil, err } repeater.logger.Debug("Response: status code: ", res) return nil, err diff --git a/repeater/releemMetrics.go b/repeater/releemMetrics.go index 88dd2b7..55eed17 100644 --- a/repeater/releemMetrics.go +++ b/repeater/releemMetrics.go @@ -35,6 +35,7 @@ func (repeater ReleemMetricsRepeater) ProcessMetrics(context m.MetricContext, me req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return nil, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) @@ -45,10 +46,15 @@ func (repeater ReleemMetricsRepeater) ProcessMetrics(context m.MetricContext, me res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return nil, err } repeater.logger.Debug("Response: status code: ", res.StatusCode) defer res.Body.Close() - body_res, _ := io.ReadAll(res.Body) + body_res, err := io.ReadAll(res.Body) + if err != nil { + repeater.logger.Error("Response: error read body request: ", err) + return nil, err + } repeater.logger.Debug("Response: body:\n", string(body_res)) return string(body_res), err } diff --git a/tasks/taskGet.go b/tasks/taskGet.go index 4d9601c..d69332d 100644 --- a/tasks/taskGet.go +++ b/tasks/taskGet.go @@ -19,6 +19,7 @@ type ReleemTasksRepeater struct { } func (repeater ReleemTasksRepeater) ProcessMetrics(context m.MetricContext, metrics m.Metrics) (interface{}, error) { + result_data := m.Task{} e, _ := json.Marshal(metrics) bodyReader := strings.NewReader(string(e)) repeater.logger.Debug("Result Send data: ", string(e)) @@ -34,6 +35,7 @@ func (repeater ReleemTasksRepeater) ProcessMetrics(context m.MetricContext, metr req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return result_data, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) client := http.Client{ @@ -42,20 +44,26 @@ func (repeater ReleemTasksRepeater) ProcessMetrics(context m.MetricContext, metr res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return result_data, err } defer res.Body.Close() body_res, err := io.ReadAll(res.Body) if err != nil { repeater.logger.Error("Response: error read body request: ", err) + return result_data, err } - repeater.logger.Debug("Response: status code: ", res.StatusCode, api_domain) - repeater.logger.Debug("Response: body:\n", string(body_res)) - result_data := m.Task{} - err1 := json.Unmarshal(body_res, &result_data) + if res.StatusCode != 200 { + repeater.logger.Println("Response: status code: ", res.StatusCode) + repeater.logger.Println("Response: body:\n", string(body_res)) + } else { + repeater.logger.Debug("Response: status code: ", res.StatusCode) + repeater.logger.Debug("Response: body:\n", string(body_res)) + err := json.Unmarshal(body_res, &result_data) - if err1 != nil { - repeater.logger.Error(err1) + if err != nil { + repeater.logger.Error(err) + } } return result_data, err diff --git a/tasks/taskSet.go b/tasks/taskSet.go index 139dff3..b93610a 100644 --- a/tasks/taskSet.go +++ b/tasks/taskSet.go @@ -36,6 +36,7 @@ func (repeater ReleemTaskSetRepeater) ProcessMetrics(context m.MetricContext, me req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return nil, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) @@ -46,6 +47,7 @@ func (repeater ReleemTaskSetRepeater) ProcessMetrics(context m.MetricContext, me res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return nil, err } repeater.logger.Debug("Response: status code: ", res) return nil, err diff --git a/tasks/taskStatus.go b/tasks/taskStatus.go index 45a829b..132b744 100644 --- a/tasks/taskStatus.go +++ b/tasks/taskStatus.go @@ -33,6 +33,7 @@ func (repeater ReleemTaskStatusRepeater) ProcessMetrics(context m.MetricContext, req, err := http.NewRequest(http.MethodPost, api_domain, bodyReader) if err != nil { repeater.logger.Error("Request: could not create request: ", err) + return nil, err } req.Header.Set("x-releem-api-key", context.GetApiKey()) @@ -43,6 +44,7 @@ func (repeater ReleemTaskStatusRepeater) ProcessMetrics(context m.MetricContext, res, err := client.Do(req) if err != nil { repeater.logger.Error("Request: error making http request: ", err) + return nil, err } if res.StatusCode != 201 { repeater.logger.Println("Response: status code: ", res.StatusCode)