PT-1979 Improved mdb summary information

Added the MongoDB instance command line options to the output.
Also fixed the spacing in the replicaset section.
This commit is contained in:
Carlos Salguero
2022-03-28 12:35:19 -03:00
parent 2760e8c927
commit 0d39dd1e3d
2 changed files with 8 additions and 1 deletions

View File

@@ -93,6 +93,7 @@ type hostInfo struct {
ProcCreateTime time.Time
ProcProcessCount int
CmdlineArgs []string
// Server Status
ProcessName string
ReplicasetName string
@@ -326,6 +327,11 @@ func formatResults(ci *collectedInfo, format string) ([]byte, error) {
return nil, errors.Wrap(err, "cannot parse hosttemplateData section of the output template")
}
t = template.Must(template.New("cmdlineargsa").Parse(templates.CmdlineArgs))
if err := t.Execute(buf, ci.HostInfo); err != nil {
return nil, errors.Wrap(err, "cannot parse the command line args section of the output template")
}
t = template.Must(template.New("runningOps").Parse(templates.RunningOps))
if err := t.Execute(buf, ci.RunningOps); err != nil {
return nil, errors.Wrap(err, "cannot parse runningOps section of the output template")
@@ -400,6 +406,7 @@ func getHostInfo(ctx context.Context, client *mongo.Client) (*hostInfo, error) {
ProcPath: pi.Path,
ProcUserName: pi.UserName,
ProcCreateTime: pi.CreateTime,
CmdlineArgs: cmdOpts.Argv,
}
if ss.Repl != nil {
i.ReplicasetName = ss.Repl.SetName

View File

@@ -19,7 +19,7 @@ const HostInfo = `# This host
{{- end }}
Processes | {{.ProcProcessCount}}
Process Type | {{.NodeType}}
{{ if .ReplicasetName -}}
{{- if .ReplicasetName }}
ReplSet | {{.ReplicasetName}}
Repl Status |
{{- end -}}