diff --git a/commands/summary.go b/commands/summary.go index b354ad6f..d0229e58 100644 --- a/commands/summary.go +++ b/commands/summary.go @@ -42,6 +42,7 @@ import ( "gopkg.in/alecthomas/kingpin.v2" "github.com/percona/pmm-admin/agentlocal" + "github.com/percona/pmm-admin/helpers" ) var summaryResultT = ParseTemplate(` @@ -263,7 +264,10 @@ func addPprofData(ctx context.Context, zipW *zip.Writer, skipServer bool) { sources := map[string]string{ "client/pprof/pmm-agent": fmt.Sprintf("http://%s:%d/debug/pprof", agentlocal.Localhost, GlobalFlags.PMMAgentListenPort), } - if !skipServer { + + isRunOnPmmServer, _ := helpers.IsOnPmmServer() + + if !skipServer && isRunOnPmmServer { sources["server/pprof/pmm-managed"] = fmt.Sprintf("http://%s:7773/debug/pprof", agentlocal.Localhost) sources["server/pprof/qan-api2"] = fmt.Sprintf("http://%s:9933/debug/pprof", agentlocal.Localhost) } @@ -283,7 +287,7 @@ func addPprofData(ctx context.Context, zipW *zip.Writer, skipServer bool) { logrus.Infof("Getting %s ...", url) data, err := getURL(ctx, url) if err != nil { - logrus.Debugf("%s", err) + logrus.Warnf("%s", err) return } diff --git a/helpers/helpers.go b/helpers/helpers.go index 1c6a764e..af86bac1 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -82,3 +82,13 @@ func GetNodeName(node *nodes.GetNodeOKBody) (string, error) { return "", errors.Wrap(errNoNode, "unknown node type") } } + +// IsOnPmmServer returns true if pmm-admin is running on pmm-server. +func IsOnPmmServer() (bool, error) { + status, err := agentlocal.GetStatus(agentlocal.DoNotRequestNetworkInfo) + if err != nil { + return false, errors.Wrap(err, "can't get local pmm-agent status") + } + + return status.NodeID == "pmm-server", nil +}