PT-1979 Improved mdb summary information (#536)

* PT-1979 Improved mdb summary information

Added the MongoDB instance command line options to the output.
Also fixed the spacing in the replicaset section.

* Added new template file

* Upgraded deps due to security issues
This commit is contained in:
Carlos Salguero
2022-04-07 18:12:45 -03:00
committed by GitHub
parent 2760e8c927
commit 8519e103ad
5 changed files with 291 additions and 37 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

@@ -0,0 +1,8 @@
package templates
const CmdlineArgs = `
{{ if . }}
# Command line arguments
{{ range .CmdlineArgs -}} {{- . }} {{ end }}
{{- end }}
`

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 -}}