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

[Ingest Management] Agent expose metrics #22793

Merged
merged 23 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7fabe99
[Ingest Manager] Log level reloadable from fleet (#22690)
michalpristas Nov 24, 2020
111722d
aa
michalpristas Nov 26, 2020
1602106
create drop
michalpristas Nov 26, 2020
f84f24c
updated drop
michalpristas Nov 26, 2020
7a29a0a
process contains everything
michalpristas Nov 26, 2020
e254ed3
drop start time
michalpristas Nov 30, 2020
24264e9
conflicts
michalpristas Nov 30, 2020
4fcd9bd
undo exposed endpoint
michalpristas Nov 30, 2020
c6ab1ed
Merge branch 'master' of github.com:elastic/beats into agent-expose-m…
michalpristas Dec 1, 2020
d7b98b1
sanitize dataset name
michalpristas Dec 1, 2020
725dd52
ups
michalpristas Dec 1, 2020
e680cf6
Merge branch 'master' of github.com:elastic/beats into agent-expose-m…
michalpristas Dec 3, 2020
d27a9b0
agent expose http
michalpristas Dec 4, 2020
69cd44a
collect all metrics from beats
michalpristas Dec 7, 2020
e4e7921
Merge branch 'master' of github.com:elastic/beats into agent-expose-m…
michalpristas Dec 7, 2020
344f411
colelct all from beats
michalpristas Dec 7, 2020
b3ecbcf
golint
michalpristas Dec 7, 2020
23ec64a
cleaner docs
michalpristas Dec 9, 2020
a341dca
Merge branch 'master' of github.com:elastic/beats into agent-expose-m…
michalpristas Dec 10, 2020
ed6da5f
updated structure
michalpristas Dec 10, 2020
c837bc2
Merge branch 'master' of github.com:elastic/beats into agent-expose-m…
michalpristas Dec 10, 2020
2d7db46
cgroup
michalpristas Dec 10, 2020
f785fda
long live file saving issues
michalpristas Dec 10, 2020
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
1 change: 0 additions & 1 deletion x-pack/elastic-agent/pkg/agent/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/spf13/cobra"

"github.com/elastic/beats/v7/libbeat/service"

"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/info"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths"
Expand Down
60 changes: 60 additions & 0 deletions x-pack/elastic-agent/pkg/agent/operation/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/application/paths"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/configrequest"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/errors"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/install"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/program"
"github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/core/app"
)
Expand All @@ -24,6 +25,7 @@ const (
logsProcessName = "filebeat"
metricsProcessName = "metricbeat"
artifactPrefix = "beats"
agentName = "elastic-agent"
)

func (o *Operator) handleStartSidecar(s configrequest.Step) (result error) {
Expand Down Expand Up @@ -324,6 +326,64 @@ func (o *Operator) getMonitoringMetricbeatConfig(output interface{}) (map[string
},
})
}

// setup cpu, memory and fd monitors for agents
modules = append(modules, map[string]interface{}{
"module": "system",
"period": "10s",
"metricsets": []string{"process"},
"index": fmt.Sprintf("metrics-elastic_agent.%s-default", agentName),
"processes": []string{install.BinaryName},
"processors": []map[string]interface{}{
{
"add_fields": map[string]interface{}{
"target": "data_stream",
"fields": map[string]interface{}{
"type": "metrics",
"dataset": fmt.Sprintf("elastic_agent.%s", agentName),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we do this for logs? Is it elastic_agent.elastic-agent? I think its just elastic_agent.

The - in elastic-agent is a problem as well. We should not have that, because we had to change endpoint-security to endpoint_security otherwise it breaks how the namespace is used of ending with -default.

"namespace": "default",
},
},
},
{
"add_fields": map[string]interface{}{
"target": "event",
"fields": map[string]interface{}{
"dataset": fmt.Sprintf("elastic_agent.%s", agentName),
},
},
},
{
"add_fields": map[string]interface{}{
"target": "elastic_agent",
"fields": map[string]interface{}{
"id": o.agentInfo.AgentID(),
"version": o.agentInfo.Version(),
"snapshot": o.agentInfo.Snapshot(),
},
},
},
{
"drop_event": map[string]interface{}{
"when": map[string]interface{}{
"not": map[string]interface{}{
"equals": map[string]interface{}{
"process.name": install.BinaryName,
},
},
},
},
},
{
// maps to keyword incorrectly, TODO: fix later, not that important field for our use-case
"drop_fields": map[string]interface{}{
"fields": []string{"system.process.cpu.start_time"},
"ignore_missing": true,
},
},
},
})

result := map[string]interface{}{
"metricbeat": map[string]interface{}{
"modules": modules,
Expand Down