diff --git a/README.md b/README.md index 6b74085e..991f46c8 100644 --- a/README.md +++ b/README.md @@ -223,10 +223,14 @@ Further Information | elasticsearch_thread_pool_queue_count | gauge | 14 | Thread Pool operations queued | elasticsearch_thread_pool_rejected_count | counter | 14 | Thread Pool operations rejected | elasticsearch_thread_pool_threads_count | gauge | 14 | Thread Pool current threads count +| elasticsearch_transport_tcp_connections_open_current | gauge | 1 | Number of connections opened for cluster communication +| elasticsearch_transport_outbound_connections_total | counter | 1 | Total number of outbound transport connections | elasticsearch_transport_rx_packets_total | counter | 1 | Count of packets received | elasticsearch_transport_rx_size_bytes_total | counter | 1 | Total number of bytes received | elasticsearch_transport_tx_packets_total | counter | 1 | Count of packets sent | elasticsearch_transport_tx_size_bytes_total | counter | 1 | Total number of bytes sent +| elasticsearch_http_connections_opened_current | gauge | 1 | Current number of opened connections +| elasticsearch_http_connections_opened_total | counter | 1 | Total number of opened connections | elasticsearch_clusterinfo_last_retrieval_success_ts | gauge | 1 | Timestamp of the last successful cluster info retrieval | elasticsearch_clusterinfo_up | gauge | 1 | Up metric for the cluster info collector | elasticsearch_clusterinfo_version_info | gauge | 6 | Constant metric with ES version information as labels diff --git a/collector/nodes.go b/collector/nodes.go index ba93a9b6..b42e1497 100644 --- a/collector/nodes.go +++ b/collector/nodes.go @@ -56,7 +56,7 @@ func getRoles(node NodeStatsNodeResponse) map[string]bool { } } } - if len(node.HTTP) == 0 { + if node.HTTP == nil { roles["client"] = false } return roles @@ -1462,6 +1462,30 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no return defaultNodeLabelValues(cluster, node) }, }, + { + Type: prometheus.GaugeValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "transport", "tcp_connections_open_current"), + "Current number of connections open for cluster communication", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Transport.ServerOpen) + }, + Labels: defaultNodeLabelValues, + }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "transport", "outbound_connections_total"), + "Count of outbound transport connections", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.Transport.OutboundConn) + }, + Labels: defaultNodeLabelValues, + }, { Type: prometheus.CounterValue, Desc: prometheus.NewDesc( @@ -1510,6 +1534,30 @@ func NewNodes(logger log.Logger, client *http.Client, url *url.URL, all bool, no }, Labels: defaultNodeLabelValues, }, + { + Type: prometheus.GaugeValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "http", "connections_opened_current"), + "Current number of open HTTP connections", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.HTTP.CurrentOpen) + }, + Labels: defaultNodeLabelValues, + }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "http", "connections_opened_total"), + "Total number of HTTP connections opened ", + defaultNodeLabels, nil, + ), + Value: func(node NodeStatsNodeResponse) float64 { + return float64(node.HTTP.TotalOpen) + }, + Labels: defaultNodeLabelValues, + }, }, gcCollectionMetrics: []*gcCollectionMetric{ { diff --git a/collector/nodes_response.go b/collector/nodes_response.go index 4985add0..89c1f117 100644 --- a/collector/nodes_response.go +++ b/collector/nodes_response.go @@ -37,7 +37,7 @@ type NodeStatsNodeResponse struct { ThreadPool map[string]NodeStatsThreadPoolPoolResponse `json:"thread_pool"` JVM NodeStatsJVMResponse `json:"jvm"` Breakers map[string]NodeStatsBreakersResponse `json:"breakers"` - HTTP map[string]interface{} `json:"http"` + HTTP *NodeStatsHTTPResponse `json:"http"` Transport NodeStatsTransportResponse `json:"transport"` Process NodeStatsProcessResponse `json:"process"` } @@ -101,11 +101,12 @@ type NodeStatsNetworkResponse struct { // NodeStatsTransportResponse is a representation of a transport statistics about sent and received bytes in cluster communication type NodeStatsTransportResponse struct { - ServerOpen int64 `json:"server_open"` - RxCount int64 `json:"rx_count"` - RxSize int64 `json:"rx_size_in_bytes"` - TxCount int64 `json:"tx_count"` - TxSize int64 `json:"tx_size_in_bytes"` + ServerOpen int64 `json:"server_open"` + OutboundConn int64 `json:"total_outbound_connections"` + RxCount int64 `json:"rx_count"` + RxSize int64 `json:"rx_size_in_bytes"` + TxCount int64 `json:"tx_count"` + TxSize int64 `json:"tx_size_in_bytes"` } // NodeStatsThreadPoolPoolResponse is a representation of a statistics about each thread pool, including current size, queue and rejected tasks @@ -333,7 +334,7 @@ type NodeStatsProcessCPUResponse struct { // NodeStatsHTTPResponse defines node stats HTTP connections structure type NodeStatsHTTPResponse struct { CurrentOpen int64 `json:"current_open"` - TotalOpen int64 `json:"total_open"` + TotalOpen int64 `json:"total_opened"` } // NodeStatsFSResponse is a representation of a file system information, data path, free disk space, read/write stats