Always print file diagnostics before/after crtmqdir if DEBUG=true

This commit is contained in:
Luke J Powlett
2020-03-09 16:07:27 +00:00
parent 2fae0e2258
commit c1cbb62ee1
2 changed files with 39 additions and 34 deletions

View File

@@ -154,41 +154,43 @@ func filterQMLogMessage(obj map[string]interface{}) bool {
} }
func logDiagnostics() { func logDiagnostics() {
log.Debug("--- Start Diagnostics ---") if getDebug() {
log.Debug("--- Start Diagnostics ---")
// show the directory ownership/permissions // show the directory ownership/permissions
// #nosec G104 // #nosec G104
out, _, _ := command.Run("ls", "-l", "/mnt/") out, _, _ := command.Run("ls", "-l", "/mnt/")
log.Debugf("/mnt/:\n%s", out) log.Debugf("/mnt/:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/mnt/mqm") out, _, _ = command.Run("ls", "-l", "/mnt/mqm")
log.Debugf("/mnt/mqm:\n%s", out) log.Debugf("/mnt/mqm:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/mnt/mqm/data") out, _, _ = command.Run("ls", "-l", "/mnt/mqm/data")
log.Debugf("/mnt/mqm/data:\n%s", out) log.Debugf("/mnt/mqm/data:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/mnt/mqm-log/log") out, _, _ = command.Run("ls", "-l", "/mnt/mqm-log/log")
log.Debugf("/mnt/mqm-log/log:\n%s", out) log.Debugf("/mnt/mqm-log/log:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/mnt/mqm-data/qmgrs") out, _, _ = command.Run("ls", "-l", "/mnt/mqm-data/qmgrs")
log.Debugf("/mnt/mqm-data/qmgrs:\n%s", out) log.Debugf("/mnt/mqm-data/qmgrs:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/var/mqm") out, _, _ = command.Run("ls", "-l", "/var/mqm")
log.Debugf("/var/mqm:\n%s", out) log.Debugf("/var/mqm:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/var/mqm/errors") out, _, _ = command.Run("ls", "-l", "/var/mqm/errors")
log.Debugf("/var/mqm/errors:\n%s", out) log.Debugf("/var/mqm/errors:\n%s", out)
// #nosec G104 // #nosec G104
out, _, _ = command.Run("ls", "-l", "/etc/mqm") out, _, _ = command.Run("ls", "-l", "/etc/mqm")
log.Debugf("/etc/mqm:\n%s", out) log.Debugf("/etc/mqm:\n%s", out)
// Print out summary of any FDCs // Print out summary of any FDCs
// #nosec G204 // #nosec G204
cmd := exec.Command("/opt/mqm/bin/ffstsummary") cmd := exec.Command("/opt/mqm/bin/ffstsummary")
cmd.Dir = "/var/mqm/errors" cmd.Dir = "/var/mqm/errors"
// #nosec G104 // #nosec G104
outB, _ := cmd.CombinedOutput() outB, _ := cmd.CombinedOutput()
log.Debugf("ffstsummary:\n%s", string(outB)) log.Debugf("ffstsummary:\n%s", string(outB))
log.Debug("--- End Diagnostics ---") log.Debug("--- End Diagnostics ---")
}
} }

View File

@@ -32,6 +32,8 @@ import (
// createDirStructure creates the default MQ directory structure under /var/mqm // createDirStructure creates the default MQ directory structure under /var/mqm
func createDirStructure() error { func createDirStructure() error {
// log file diagnostics before and after crtmqdir if DEBUG=true
logDiagnostics()
out, rc, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-a") out, rc, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-a")
if err != nil { if err != nil {
if rc == 10 { if rc == 10 {
@@ -42,6 +44,7 @@ func createDirStructure() error {
} }
} }
log.Println("Created directory structure under /var/mqm") log.Println("Created directory structure under /var/mqm")
logDiagnostics()
return nil return nil
} }