Skip to content

Commit

Permalink
smart-agent_system-common: rename "per_cpu_enabled" variable to "agen…
Browse files Browse the repository at this point in the history
…t_per_cpu_enabled" (#381)
  • Loading branch information
BzSpi authored Feb 17, 2022
1 parent 6b8ed26 commit 0beeea5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions modules/smart-agent_system-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ But we exclude it explicitly in related detector for safety to prevent any alert
#### Load

You have two choices to use load based detectors:
- either keep the `per_cpu_enabled` enabled (variable default value) __and__ define `perCPU: true` in the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) configuration (for Kubernetes, you can use `loadPerCPU` option from the Helm chart available from `1.2.0` version).
- or override the `per_cpu_enabled` to `false` __and__ keep the default configuration for the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) with `perCPU: false` or not defined
- either keep the `agent_per_cpu_enabled` enabled (variable default value) __and__ define `perCPU: true` in the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) configuration (for Kubernetes, you can use `loadPerCPU` option from the Helm chart available from `1.2.0` version).
- or override the `agent_per_cpu_enabled` to `false` __and__ keep the default configuration for the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) with `perCPU: false` or not defined

In both cases, the goal is to get alerts based on the __ratio__ of load by dividing the original load per the number of CPU/cores which is the only way to get generic and relevant alerts for load.
It mainly depends if you want to collect 2 metrics instead of 1 and if you want the load one to be raw or already averaged.
Expand Down
2 changes: 1 addition & 1 deletion modules/smart-agent_system-common/conf/02-load.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ signals:
num_processors:
metric: cpu.num_processors
signal:
formula: '(${var.per_cpu_enabled ? "load" : "load/num_processors"})'
formula: '(${var.agent_per_cpu_enabled ? "load" : "load/num_processors"})'
rules:
critical:
threshold: 2.5
Expand Down
4 changes: 2 additions & 2 deletions modules/smart-agent_system-common/conf/readme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ source_doc: |
#### Load
You have two choices to use load based detectors:
- either keep the `per_cpu_enabled` enabled (variable default value) __and__ define `perCPU: true` in the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) configuration (for Kubernetes, you can use `loadPerCPU` option from the Helm chart available from `1.2.0` version).
- or override the `per_cpu_enabled` to `false` __and__ keep the default configuration for the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) with `perCPU: false` or not defined
- either keep the `agent_per_cpu_enabled` enabled (variable default value) __and__ define `perCPU: true` in the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) configuration (for Kubernetes, you can use `loadPerCPU` option from the Helm chart available from `1.2.0` version).
- or override the `agent_per_cpu_enabled` to `false` __and__ keep the default configuration for the [load monitor](https://github.com/signalfx/signalfx-agent/blob/main/docs/monitors/load.md) with `perCPU: false` or not defined
In both cases, the goal is to get alerts based on the __ratio__ of load by dividing the original load per the number of CPU/cores which is the only way to get generic and relevant alerts for load.
It mainly depends if you want to collect 2 metrics instead of 1 and if you want the load one to be raw or already averaged.
Expand Down
2 changes: 1 addition & 1 deletion modules/smart-agent_system-common/detectors-gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ resource "signalfx_detector" "load" {
program_text = <<-EOF
load = data('load.midterm', filter=${module.filtering.signalflow})${var.load_aggregation_function}${var.load_transformation_function}
num_processors = data('cpu.num_processors', filter=${module.filtering.signalflow})${var.load_aggregation_function}${var.load_transformation_function}
signal = (${var.per_cpu_enabled ? "load" : "load/num_processors"}).publish('signal')
signal = (${var.agent_per_cpu_enabled ? "load" : "load/num_processors"}).publish('signal')
detect(when(signal > ${var.load_threshold_critical}, lasting=%{if var.load_lasting_duration_critical == null}None%{else}'${var.load_lasting_duration_critical}'%{endif}, at_least=${var.load_at_least_percentage_critical})).publish('CRIT')
detect(when(signal > ${var.load_threshold_major}, lasting=%{if var.load_lasting_duration_major == null}None%{else}'${var.load_lasting_duration_major}'%{endif}, at_least=${var.load_at_least_percentage_major}) and (not when(signal > ${var.load_threshold_critical}, lasting=%{if var.load_lasting_duration_critical == null}None%{else}'${var.load_lasting_duration_critical}'%{endif}, at_least=${var.load_at_least_percentage_critical}))).publish('MAJOR')
EOF
Expand Down
4 changes: 2 additions & 2 deletions modules/smart-agent_system-common/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Module specific

variable "per_cpu_enabled" {
description = "Is perCPU option is enabled for the load monitor of the agent"
variable "agent_per_cpu_enabled" {
description = "Is `perCPU` option is enabled for the load monitor in the agent configuration"
type = bool
default = true
}
Expand Down

0 comments on commit 0beeea5

Please sign in to comment.