From 9f91e36bc64388de361cefa480bc26936486835e Mon Sep 17 00:00:00 2001 From: Chris Swingler Date: Thu, 23 Mar 2017 15:19:36 -0500 Subject: [PATCH 1/2] Configurable my.cnf location --- go/config/config.go | 2 ++ go/osagent/osagent.go | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/go/config/config.go b/go/config/config.go index 57384c4..8151029 100644 --- a/go/config/config.go +++ b/go/config/config.go @@ -32,6 +32,7 @@ type Configuration struct { AvailableLocalSnapshotHostsCommand string // Command which returns list of hosts (one host per line) with available snapshots in local datacenter AvailableSnapshotHostsCommand string // Command which returns list of hosts (one host per line) with available snapshots in any datacenter SnapshotVolumesFilter string // text pattern filtering agent logical volumes that are valid snapshots + MySQLConfigFileLocation string // Path to my.cnf (default: /etc/my.cnf) MySQLDatadirCommand string // command expected to present with @@datadir MySQLPortCommand string // command expected to present with @@port MySQLDeleteDatadirContentCommand string // command which deletes all content from MySQL datadir (does not remvoe directory itself) @@ -75,6 +76,7 @@ func NewConfiguration() *Configuration { AvailableLocalSnapshotHostsCommand: "", AvailableSnapshotHostsCommand: "", SnapshotVolumesFilter: "", + MySQLConfigFileLocation: "/etc/my.cnf", MySQLDatadirCommand: "", MySQLPortCommand: "", MySQLDeleteDatadirContentCommand: "", diff --git a/go/osagent/osagent.go b/go/osagent/osagent.go index f83b7cd..7ec0aeb 100644 --- a/go/osagent/osagent.go +++ b/go/osagent/osagent.go @@ -559,7 +559,12 @@ func AvailableSnapshots(requireLocal bool) ([]string, error) { } func MySQLErrorLogTail() ([]string, error) { - output, err := commandOutput(sudoCmd(`tail -n 20 $(egrep "log[-_]error" /etc/my.cnf | cut -d "=" -f 2)`)) + // XXX: MARKER + mycnf := config.Config.MySQLConfigFileLocation + + command := fnt.Sprintf(`tail -n 20 $(egrep "log[-_]error" %s | cut -d "=" -f 2)`, mycnf) + + output, err := commandOutput(sudoCmd(command)) tail, err := outputLines(output, err) return tail, err } From c41a1351173c611e5ab01f5d6355fe27fa429a61 Mon Sep 17 00:00:00 2001 From: Chris Swingler Date: Thu, 23 Mar 2017 15:26:56 -0500 Subject: [PATCH 2/2] removing spurious comment --- go/osagent/osagent.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go/osagent/osagent.go b/go/osagent/osagent.go index 7ec0aeb..4c6a046 100644 --- a/go/osagent/osagent.go +++ b/go/osagent/osagent.go @@ -559,10 +559,9 @@ func AvailableSnapshots(requireLocal bool) ([]string, error) { } func MySQLErrorLogTail() ([]string, error) { - // XXX: MARKER mycnf := config.Config.MySQLConfigFileLocation - command := fnt.Sprintf(`tail -n 20 $(egrep "log[-_]error" %s | cut -d "=" -f 2)`, mycnf) + command := fmt.Sprintf(`tail -n 20 $(egrep "log[-_]error" %s | cut -d "=" -f 2)`, mycnf) output, err := commandOutput(sudoCmd(command)) tail, err := outputLines(output, err)