Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/scollector: pull index data from non-master hosts #2368

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 2 additions & 2 deletions cmd/scollector/collectors/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func c_elasticsearch(collectIndices bool, instance conf.Elastic) (opentsdb.Multi
// As we're pulling _local stats here, this will only process 1 node.
for nodeID, nodeStats := range clusterStats.Nodes {
isMaster = nodeID == clusterState.MasterNode
if isMaster {
if isMaster || instance.CollectAllMetrics {
s.add("elastic.health.cluster", clusterHealth, ts)
if statusCode, ok := elasticStatusMap[clusterHealth.Status]; ok {
Add(&md, "elastic.health.cluster.status", statusCode, ts, metadata.Gauge, metadata.StatusCode, "The current status of the cluster. Zero for green, one for yellow, two for red.")
Expand All @@ -289,7 +289,7 @@ func c_elasticsearch(collectIndices bool, instance conf.Elastic) (opentsdb.Multi
s.add("elastic.jvm.gc", nodeStats.JVM.GC.Collectors.Old, opentsdb.TagSet{"gc": "old"}.Merge(ts))
s.add("elastic.jvm.gc", nodeStats.JVM.GC.Collectors.Young, opentsdb.TagSet{"gc": "young"}.Merge(ts))
}
if collectIndices && isMaster {
if collectIndices && (isMaster || instance.CollectAllMetrics) {
for k, index := range indexStats.Indices {
if esSkipIndex(k) {
slog.Infof("Skipping index: %v", k)
Expand Down
19 changes: 10 additions & 9 deletions cmd/scollector/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,14 @@ type OracleInstance struct {
// Optional Elastic instance configuration - if omitted then the defaults are used
// You can also define multiple instances where more than one node is running
type Elastic struct {
Host string // default is localhost
Port uint16 // default is 9200
ClusterInterval string // default is DefaultFreq
IndexInterval string // default is 15 mins
User string // default is empty
Password string // default is empty
Disable bool // default is false.
Name string // default is host_port
Scheme string // default is http
Host string // default is localhost
Port uint16 // default is 9200
ClusterInterval string // default is DefaultFreq
IndexInterval string // default is 15 mins
User string // default is empty
Password string // default is empty
Disable bool // default is false.
Name string // default is host_port
Scheme string // default is http
CollectAllMetrics bool // default is false
}
3 changes: 3 additions & 0 deletions cmd/scollector/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ you specify basic auth credentials and using TLS by setting the Scheme to https:
ClusterInterval = "10s"
IndexInterval = "1m"

By default cluster-wide metrics are collected, only if current node is master.
You can override this behaviour with CollectAllMetrics switch.

Windows

scollector has full Windows support. It can be run standalone, or installed as a
Expand Down