-
Notifications
You must be signed in to change notification settings - Fork 12
Pmm 6592 add ports output #225
base: main
Are you sure you want to change the base?
Changes from 4 commits
2835b82
334e0bf
335a6e5
4a67d2d
90ef4a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,9 @@ import ( | |
var listAgentsResultT = commands.ParseTemplate(` | ||
Agents list. | ||
|
||
{{ printf "%-27s" "Agent type" }} {{ printf "%-15s" "Status" }} {{ printf "%-47s" "Agent ID" }} {{ printf "%-47s" "PMM-Agent ID" }} {{ printf "%-47s" "Service ID" }} | ||
{{ printf "%-27s" "Agent type" }} {{ printf "%-15s" "Status" }} {{ printf "%-47s" "Agent ID" }} {{ printf "%-47s" "PMM-Agent ID" }} {{ printf "%-47s" "Service ID" }} {{ printf "%-47s" "Port" }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
{{ range .Agents }} | ||
{{- printf "%-27s" .HumanReadableAgentType }} {{ printf "%-15s" .NiceAgentStatus }} {{ .AgentID }} {{ .PMMAgentID }} {{ .ServiceID }} | ||
{{- printf "%-27s" .HumanReadableAgentType }} {{ printf "%-15s" .NiceAgentStatus }} {{ .AgentID }} {{ .PMMAgentID }} {{ .ServiceID }} {{ .Port }} | ||
{{ end }} | ||
`) | ||
|
||
|
@@ -57,6 +57,7 @@ type listResultAgent struct { | |
ServiceID string `json:"service_id"` | ||
Status string `json:"status"` | ||
Disabled bool `json:"disabled"` | ||
Port int64 `json:"port,omitempty"` | ||
} | ||
|
||
func (a listResultAgent) HumanReadableAgentType() string { | ||
|
@@ -132,6 +133,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
PMMAgentID: a.PMMAgentID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.MysqldExporter { | ||
|
@@ -142,6 +144,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
ServiceID: a.ServiceID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.MongodbExporter { | ||
|
@@ -152,6 +155,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
ServiceID: a.ServiceID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.PostgresExporter { | ||
|
@@ -162,6 +166,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
ServiceID: a.ServiceID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.ProxysqlExporter { | ||
|
@@ -172,6 +177,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
ServiceID: a.ServiceID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.RDSExporter { | ||
|
@@ -181,6 +187,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
PMMAgentID: a.PMMAgentID, | ||
Status: getAgentStatus(a.Status), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
for _, a := range agentsRes.Payload.QANMysqlPerfschemaAgent { | ||
|
@@ -240,6 +247,7 @@ func (cmd *listAgentsCommand) Run() (commands.Result, error) { | |
ServiceID: a.ServiceID, | ||
Status: getAgentStatus(nil), | ||
Disabled: a.Disabled, | ||
Port: a.ListenPort, | ||
}) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,15 +36,15 @@ func TestListResultString(t *testing.T) { | |
{ServiceType: types.ServiceTypeMySQLService, ServiceID: "/service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a", ServiceName: "mysql-service"}, | ||
}, | ||
Agents: []listResultAgent{ | ||
{AgentType: types.AgentTypeMySQLdExporter, AgentID: "/agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1140", ServiceID: "/service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a", Status: "RUNNING", MetricsMode: "pull"}, | ||
{AgentType: types.AgentTypeMySQLdExporter, AgentID: "/agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1140", ServiceID: "/service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a", Status: "RUNNING", MetricsMode: "pull", Port: 3306}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
}, | ||
}, | ||
expected: strings.TrimSpace(` | ||
Service type Service name Address and port Service ID | ||
MySQL mysql-service /service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a | ||
|
||
Agent type Status Metrics Mode Agent ID Service ID | ||
mysqld_exporter Running pull /agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1140 /service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a | ||
Agent type Status Metrics Mode Agent ID Service ID Port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
mysqld_exporter Running pull /agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1140 /service_id/4ff49c41-80a1-4030-bc02-cd76e3b0b84a 3306 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
`), | ||
}, | ||
{ | ||
|
@@ -53,7 +53,7 @@ mysqld_exporter Running pull /agent_id/8b732ac3-825 | |
expected: strings.TrimSpace(` | ||
Service type Service name Address and port Service ID | ||
|
||
Agent type Status Metrics Mode Agent ID Service ID | ||
Agent type Status Metrics Mode Agent ID Service ID Port | ||
`), | ||
}, | ||
{ | ||
|
@@ -63,15 +63,15 @@ Agent type Status Metrics Mode Agent ID Service ID | |
{ServiceType: types.ServiceTypeExternalService, ServiceID: "/service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a", ServiceName: "myhost-redis", Group: "redis"}, | ||
}, | ||
Agents: []listResultAgent{ | ||
{AgentType: types.AgentTypeExternalExporter, AgentID: "/agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1149", ServiceID: "/service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a", Status: "RUNNING"}, | ||
{AgentType: types.AgentTypeExternalExporter, AgentID: "/agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1149", ServiceID: "/service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a", Status: "RUNNING", Port: 8080}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
}, | ||
}, | ||
expected: strings.TrimSpace(` | ||
Service type Service name Address and port Service ID | ||
External:redis myhost-redis /service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a | ||
|
||
Agent type Status Metrics Mode Agent ID Service ID | ||
external-exporter Running /agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1149 /service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a | ||
Agent type Status Metrics Mode Agent ID Service ID Port | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
external-exporter Running /agent_id/8b732ac3-8256-40b0-a98b-0fd5fa9a1149 /service_id/8ff49c41-80a1-4030-bc02-cd76e3b0b84a 8080 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci-lint] reported by reviewdog 🐶 |
||
`), | ||
}, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
json(camel): got 'listen_port' want 'listenPort' (tagliatelle)