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..4c6a046 100644 --- a/go/osagent/osagent.go +++ b/go/osagent/osagent.go @@ -559,7 +559,11 @@ 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)`)) + mycnf := config.Config.MySQLConfigFileLocation + + 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) return tail, err }