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

[ML] Adds ML modules for Metrics UI Integration #76460

Merged
merged 13 commits into from
Sep 17, 2020
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"icon": "metricsApp"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"id": "metrics_ui_hosts",
"title": "Metrics Hosts",
"description": "Detect anomalous memory, cpu, and network behavior on hosts.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"description": "Detect anomalous memory, cpu, and network behavior on hosts.",
"description": "Detect anomalous memory, CPU, and network behavior on hosts.",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated - thanks!

"type": "Metricbeat Data",
"logoFile": "logo.json",
"defaultIndexPattern": "metricbeat-*",
"query": {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the jobs in this module provide no value without the specific overrides we are expecting from the Metrics UI, then removing this query block is the way to hide it from the ML job wizards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the query and defaultIndexPattern fields have been removed, as we do in the logs integration modules.

"bool": {
"must": [
{"exists": {"field": "system"}}
],
"must_not": [
{"bool": {"filter": [{"exists":{"field": "kubernetes"}}]}},
{"bool": {"filter": [{"exists":{"field": "docker"}}]}}
]
}
},
"jobs": [
{
"id": "hosts_cpu_usage",
Copy link
Contributor

Choose a reason for hiding this comment

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

Noticed that the host jobs have an id prefixed with hosts, but the k8s jobs don't. Should we be consistent here? Not sure we actually need the prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i've included the k8s prefix on the kubernetes jobs, as we'll want to distinguish between them in ML job management.

"file": "hosts_cpu_usage.json"
},
{
"id": "hosts_memory_usage",
"file": "hosts_memory_usage.json"
},
{
"id": "hosts_network_in",
"file": "hosts_network_in.json"
},
{
"id": "hosts_network_out",
"file": "hosts_network_out.json"
}
],
"datafeeds": [
{
"id": "datafeed-hosts_cpu_usage",
"file": "datafeed_hosts_cpu_usage.json",
"job_id": "hosts_cpu_usage"
},
{
"id": "datafeed-hosts_memory_usage",
"file": "datafeed_hosts_memory_usage.json",
"job_id": "hosts_memory_usage"
},
{
"id": "datafeed-hosts_network_in",
"file": "datafeed_hosts_network_in.json",
"job_id": "hosts_network_in"
},
{
"id": "datafeed-hosts_network_out",
"file": "datafeed_hosts_network_out.json",
"job_id": "hosts_network_out"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"job_id": "JOB_ID",
"indices": [
"INDEX_PATTERN_NAME"
],
"indices_options": {
"allow_no_indices": true
},
"chunking_config": {
"mode": "manual",
"time_span": "900s"
},
"query": {
"bool": {
"must": [
{
"exists": {
"field": "system.cpu"
}
}
]
}
},
"aggs": {
"host.name": {
"terms": {
"field": "host.name",
"size": 100
},
"aggs": {
"buckets": {
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "5m"
},
"aggs": {
"@timestamp": {
"max": {
"field": "@timestamp"
}
},
"cpu_user": {
"avg": {
"field": "system.cpu.user.pct"
}
},
"cpu_system": {
"avg": {
"field": "system.cpu.system.pct"
}
},
"cpu_cores": {
"max": {
"field": "system.cpu.cores"
}
},
"cpu": {
"bucket_script": {
"buckets_path": {
"user": "cpu_user",
"system": "cpu_system",
"cores": "cpu_cores"
},
"script": "(params.user + params.system) / params.cores",
"gap_policy": "skip"
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"job_id": "JOB_ID",
"indices": [
"INDEX_PATTERN_NAME"
],
"indices_options": {
"allow_no_indices": true
},
"query": {
"bool": {
"must": [
{"exists": {"field": "system.memory"}}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"job_id": "JOB_ID",
"indices": [
"INDEX_PATTERN_NAME"
],
"indices_options": {
"allow_no_indices": true
},
"query": {
"bool": {
"must": [
{"exists": {"field": "system.network"}}
]
}
},
"chunking_config": {
"mode": "manual",
"time_span": "900s"
},
"aggregations": {
"host.name": {"terms": {"field": "host.name", "size": 100},
"aggregations": {
"buckets": {
"date_histogram": {"field": "@timestamp","fixed_interval": "5m"},
"aggregations": {
"@timestamp": {"max": {"field": "@timestamp"}},
"bytes_in_max": {"max": {"field": "system.network.in.bytes"}},
"bytes_in_derivative": {"derivative": {"buckets_path": "bytes_in_max"}},
"positive_only":{
"bucket_script": {
"buckets_path": {"in_derivative": "bytes_in_derivative.value"},
"script": "params.in_derivative > 0.0 ? params.in_derivative : 0.0"
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"job_id": "JOB_ID",
"indices": [
"INDEX_PATTERN_NAME"
],
"indices_options": {
"allow_no_indices": true
},
"query": {
"bool": {
"must": [
{"exists": {"field": "system.network"}}
]
}
},
"chunking_config": {
"mode": "manual",
"time_span": "900s"
},
"aggregations": {
"host.name": {"terms": {"field": "host.name", "size": 100},
"aggregations": {
"buckets": {
"date_histogram": {"field": "@timestamp","fixed_interval": "5m"},
"aggregations": {
"@timestamp": {"max": {"field": "@timestamp"}},
"bytes_out_max": {"max": {"field": "system.network.out.bytes"}},
"bytes_out_derivative": {"derivative": {"buckets_path": "bytes_out_max"}},
"positive_only":{
"bucket_script": {
"buckets_path": {"out_derivative": "bytes_out_derivative.value"},
"script": "params.out_derivative > 0.0 ? params.out_derivative : 0.0"
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"job_type": "anomaly_detector",
"groups": [
"hosts",
"metrics"
],
"description": "Metrics: Hosts - Identify unusual spikes in cpu utilization across hosts.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"description": "Metrics: Hosts - Identify unusual spikes in cpu utilization across hosts.",
"description": "Metrics: Hosts - Identify unusual spikes in CPU utilization across hosts.",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated - thanks!

"analysis_config": {
"bucket_span": "15m",
"summary_count_field_name": "doc_count",
"detectors": [
{
"detector_description": "max('cpu')",
"function": "max",
"field_name": "cpu",
"custom_rules": [
{
"actions": [
"skip_result"
],
"conditions": [
{
"applies_to": "actual",
"operator": "lt",
"value": 0.1
}
]
}
]
}
],
"influencers": [
"host.name"
]
},
"data_description": {
"time_field": "@timestamp"
},
"analysis_limits": {
"model_memory_limit": "64mb"
},
"custom_settings": {
"created_by": "ml-module-metrics-ui-hosts",
"custom_urls": [
{
"url_name": "Host Metrics",
"url_value": "metrics/detail/host/$host.name$?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:%27$earliest$%27,interval:%3E%3D1m,to:%27$latest$%27))"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"job_type": "anomaly_detector",
"groups": [
"hosts",
"metrics"
],
"description": "Metrics: Hosts - Identify unusual spikes in memory usage across hosts.",
"analysis_config": {
"bucket_span": "15m",
"detectors": [
{
"detector_description": "max('system.memory.actual.used.pct')",
"function": "max",
"field_name": "system.memory.actual.used.pct",
"custom_rules": [
{
"actions": [
"skip_result"
],
"conditions": [
{
"applies_to": "actual",
"operator": "lt",
"value": 0.1
}
]
}
]
}
],
"influencers": [
"host.name"
]
},
"data_description": {
"time_field": "@timestamp"
},
"analysis_limits": {
"model_memory_limit": "64mb"
},
"custom_settings": {
"created_by": "ml-module-metrics-ui-hosts",
"custom_urls": [
{
"url_name": "Host Metrics",
"url_value": "metrics/detail/host/$host.name$?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:%27$earliest$%27,interval:%3E%3D1m,to:%27$latest$%27))"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"job_type": "anomaly_detector",
"description": "Metrics: Hosts - Identify unusual spikes in inbound traffic across hosts.",
"groups": [
"hosts",
"metrics"
],
"analysis_config": {
"bucket_span": "15m",
"detectors": [
{
"detector_description": "max(bytes_in_derivative)",
"function": "max",
"field_name": "bytes_in_derivative"
}
],
"influencers": [
"host.name"
],
"summary_count_field_name": "doc_count"
},
"data_description": {
"time_field": "@timestamp"
},
"analysis_limits": {
"model_memory_limit": "32mb"
},
"custom_settings": {
"created_by": "ml-module-metrics-ui-hosts",
"custom_urls": [
{
"url_name": "Host Metrics",
"url_value": "metrics/detail/host/$host.name$?metricTime=(autoReload:!f,refreshInterval:5000,time:(from:%27$earliest$%27,interval:%3E%3D1m,to:%27$latest$%27))"
}
]
}
}
Loading