Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions docs/reference/50_proxies.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2021, 2023 Oracle and/or its affiliates.
Copyright (c) 2021, 2024 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at
https://oss.oracle.com/licenses/upl.

Expand All @@ -14,6 +14,7 @@
There are various commands that allow you to work with and manage proxy servers.

* <<get-proxies, `cohctl get proxies`>> - displays the proxy servers for a cluster
* <<get-proxy-members, `cohctl get proxy-members`>> - displays proxy members for a specific proxy server
* <<get-proxy-connections, `cohctl get proxy-connections`>> - displays proxy server connections for a specific proxy server
* <<describe-proxy, `cohctl describe proxy`>> - shows information related to a specific proxy server

Expand All @@ -33,10 +34,32 @@ cohctl get proxies -c local
Output:
[source,bash]
----
NODE ID HOST IP SERVICE NAME CONNECTIONS BYTES SENT BYTES REC
1 0.0.0.0:53216.41408 Proxy 0 0 0
2 0.0.0.0:53215.47265 Proxy 0 0 0
3 0.0.0.0:53220.42214 Proxy 0 0 0
SERVICE NAME TOTAL CONNECTIONS TOTALDATA SENT TOTALDATA REC
"$SYS:SystemProxy" 0 0 MB 0 MB
Proxy 2 13 MB 0 MB
----

NOTE: You can also use `-o wide` to display more columns.

[#get-proxy-members]
==== Get Proxy Members

include::../../build/_output/docs-gen/get_proxy_members.adoc[tag=text]

*Examples*

[source,bash]
----
cohctl get proxy-members Proxy -c local
----
Output:
[source,bash]
----

NODE ID HOST IP SERVICE NAME CONNECTIONS DATA SENT DATA REC MSG SENT MSG RCV BYTES BACKLOG MSG BACKLOG UNAUTH
2 0.0.0.0:60488.38858 Proxy 1 4 MB 0 MB 10 15 0 0 0
3 0.0.0.0:60489.34448 Proxy 0 0 MB 0 MB 0 1 0 0 0
4 0.0.0.0:60490.43677 Proxy 1 8 MB 0 MB 15 20 0 0 0
----

NOTE: You can also use `-o wide` to display more columns.
Expand Down
28 changes: 23 additions & 5 deletions docs/reference/55_http_servers.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////

Copyright (c) 2021, 2023 Oracle and/or its affiliates.
Copyright (c) 2021, 2024 Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at
https://oss.oracle.com/licenses/upl.

Expand All @@ -14,6 +14,7 @@
There are various commands that allow you to work with and manage http servers.

* <<get-http-servers, `cohctl get http-servers`>> - displays the http servers for a cluster
* <<get-http-server-members, `cohctl get http-server-members`>> - displays the http proxy members for a specific http server
* <<describe-http-server, `cohctl describe http-server`>> - shows information related to a specific http server

[#get-http-servers]
Expand All @@ -32,10 +33,27 @@ cohctl get http-servers -c local
Output:
[source,bash]
----
NODE ID HOST IP SERVICE NAME SERVER TYPE REQUESTS ERRORS
1 0.0.0.0:0 ManagementHttpProxy com..http.DefaultHttpServer 0 0
2 0.0.0.0:30000 ManagementHttpProxy com..http.DefaultHttpServer 52 0
3 0.0.0.0:0 ManagementHttpProxy com..http.DefaultHttpServer 0 0
SERVICE NAME SERVER TYPE TOTAL REQUESTS TOTAL ERRORS
"$SYS:HealthHttpProxy" com.tangosol.coherence.http.JavaHttpServer 0 0
ManagementHttpProxy com.tangosol.coherence.http.JavaHttpServer 52 0
----

NOTE: You can also use `-o wide` to display more columns.

[#get-http-server-members]
==== Get Http Members

include::../../build/_output/docs-gen/get_http_server_members.adoc[tag=text]

[source,bash]
----
cohctl get http-server-members ManagementHttpProxy -c local
----
Output:
[source,bash]
----
NODE ID HOST IP SERVICE NAME SERVER TYPE REQUESTS ERRORS
4 0.0.0.0:30000 ManagementHttpProxy com.tangosol.coherence.http.JavaHttpServer 59 0
----

NOTE: You can also use `-o wide` to display more columns.
Expand Down
91 changes: 76 additions & 15 deletions pkg/cmd/formatting.go
Original file line number Diff line number Diff line change
Expand Up @@ -2041,23 +2041,84 @@ func FormatProxyServers(services []config.ProxySummary, protocol string) string
// common values
table.AddRow(value.NodeID, value.HostIP, value.ServiceName)

if protocol == tcp {
table.AddColumnsToRow(formatLargeInteger(value.ConnectionCount),
formattingFunction(value.TotalBytesSent), formattingFunction(value.TotalBytesReceived))
if OutputFormat == constants.WIDE {
table.AddColumnsToRow(formatLargeInteger(value.TotalMessagesSent),
formatLargeInteger(value.TotalMessagesReceived), formatLargeInteger(value.OutgoingByteBacklog),
formatLargeInteger(value.OutgoingMessageBacklog), formatLargeInteger(value.UnAuthConnectionAttempts))
}
addColumns(table, value, protocol, formattingFunction)
}

return table.String()
}

func addColumns(table FormattedTable, value config.ProxySummary, protocol string, formattingFunction func(bytesValue int64) string) {
if protocol == tcp {
table.AddColumnsToRow(formatLargeInteger(value.ConnectionCount),
formattingFunction(value.TotalBytesSent), formattingFunction(value.TotalBytesReceived))
if OutputFormat == constants.WIDE {
table.AddColumnsToRow(formatLargeInteger(value.TotalMessagesSent),
formatLargeInteger(value.TotalMessagesReceived), formatLargeInteger(value.OutgoingByteBacklog),
formatLargeInteger(value.OutgoingMessageBacklog), formatLargeInteger(value.UnAuthConnectionAttempts))
}
} else {
table.AddColumnsToRow(value.HTTPServerType,
formatLargeInteger(value.TotalRequestCount), formatLargeInteger(value.TotalErrorCount))
if OutputFormat == constants.WIDE {
table.AddColumnsToRow(formatLargeInteger(value.ResponseCount1xx),
formatLargeInteger(value.ResponseCount2xx), formatLargeInteger(value.ResponseCount3xx),
formatLargeInteger(value.ResponseCount4xx), formatLargeInteger(value.ResponseCount5xx))
}
}
}

// FormatProxyServersSummary returns the proxy servers' summary information in a column formatted output
// protocol is either tcp or http and will display a different format based upon this.
func FormatProxyServersSummary(services []config.ProxySummary, protocol string) string {
// get the number of proxies matching the protocol
var (
serviceCount = 0
formattingFunction = getFormattingFunction()
)

for _, value := range services {
if protocol == value.Protocol {
serviceCount++
}
}

if serviceCount == 0 {
return ""
}

// common header
table := newFormattedTable().WithHeader(ServiceNameColumn).WithSortingColumn(ServiceNameColumn)

if protocol == tcp {
table.AddHeaderColumns("TOTAL CONNECTIONS", "TOTAL"+dataSent, "TOTAL"+dataRec)
if OutputFormat == constants.WIDE {
table.AddHeaderColumns("TOTAL MSG SENT", "TOTAL MSG RCV", "TOTAL BYTES BACKLOG", "TOTAL MSG BACKLOG", "TOTAL UNAUTH")
table.WithAlignment(L, R, R, R, R, R, R, R, R)
table.AddFormattingFunction(9, errorFormatter)
table.AddFormattingFunction(10, errorFormatter)
} else {
table.AddColumnsToRow(value.HTTPServerType,
formatLargeInteger(value.TotalRequestCount), formatLargeInteger(value.TotalErrorCount))
if OutputFormat == constants.WIDE {
table.AddColumnsToRow(formatLargeInteger(value.ResponseCount1xx),
formatLargeInteger(value.ResponseCount2xx), formatLargeInteger(value.ResponseCount3xx),
formatLargeInteger(value.ResponseCount4xx), formatLargeInteger(value.ResponseCount5xx))
}
table.WithAlignment(L, R, R, R)
}
} else {
table.AddHeaderColumns("SERVER TYPE", "TOTAL REQUESTS", "TOTAL ERRORS")
table.AddFormattingFunction(5, errorFormatter)
if OutputFormat == constants.WIDE {
table.AddHeaderColumns("1xx", "2xx", "3xx", "4xx", "5xx")
table.WithAlignment(L, L, R, R, R, R, R, R, R)
table.AddFormattingFunction(9, errorFormatter)
table.AddFormattingFunction(10, errorFormatter)
} else {
table.WithAlignment(L, L, R, R)
}
}

for _, value := range services {
if protocol != value.Protocol {
continue
}
table.AddRow(value.ServiceName)

addColumns(table, value, protocol, formattingFunction)
}

return table.String()
Expand Down
38 changes: 37 additions & 1 deletion pkg/cmd/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var getHTTPProxiesCmd = &cobra.Command{
return err
}

details, err := returnGetProxiesDetails(cmd, httpString, dataFetcher, connection, "")
details, err := returnGetProxiesDetails(cmd, httpString, dataFetcher, connection, "", true)
if err != nil {
return err
}
Expand All @@ -47,6 +47,42 @@ var getHTTPProxiesCmd = &cobra.Command{
},
}

// getHTTPServerMembersCmd represents the get http-members command.
var getHTTPServerMembersCmd = &cobra.Command{
Use: "http-server-members",
Short: "display http proxy server members for a http server",
Long: `The 'get http-servers' command displays the list of http proxy servers
members for a HTTP server.`,
ValidArgsFunction: completionHTTPServers,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
displayErrorAndExit(cmd, provideService)
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
var (
err error
dataFetcher fetcher.Fetcher
connection string
)

connection, dataFetcher, err = GetConnectionAndDataFetcher()
if err != nil {
return err
}

details, err := returnGetProxiesDetails(cmd, httpString, dataFetcher, connection, args[0], false)
if err != nil {
return err
}
if !isWatchEnabled() {
cmd.Println(details)
}
return nil
},
}

// describeHTTPProxyCmd represents the describe http-proxy command.
var describeHTTPProxyCmd = &cobra.Command{
Use: "http-server service-name",
Expand Down
6 changes: 5 additions & 1 deletion pkg/cmd/monitor_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,12 @@ var proxiesContentInternal = func(protocol string, clusterSummary clusterSummary
if err != nil {
return emptyStringArray, err
}
finalResult, err := summarizeProxies(proxiesSummary.Proxies, protocol)
if err != nil {
return emptyStringArray, err
}

return strings.Split(FormatProxyServers(proxiesSummary.Proxies, protocol), "\n"), nil
return strings.Split(FormatProxyServersSummary(finalResult, protocol), "\n"), nil
}

var proxyConnectionsContent = func(dataFetcher fetcher.Fetcher, _ clusterSummaryInfo) ([]string, error) {
Expand Down
Loading
Loading