From dcfdae23e23d790cf6c2dfab87e58ae80f09a1f5 Mon Sep 17 00:00:00 2001 From: Nicolas VION Date: Tue, 22 Sep 2020 14:06:03 +0200 Subject: [PATCH 1/2] init jmx detectors --- middleware/jmx/README.md | 39 +++ middleware/jmx/detectors-jmx.tf | 239 ++++++++++++++++ middleware/jmx/modules.tf | 8 + middleware/jmx/outputs.tf | 0 middleware/jmx/variables.tf | 483 ++++++++++++++++++++++++++++++++ middleware/jmx/versions.tf | 9 + 6 files changed, 778 insertions(+) create mode 100644 middleware/jmx/README.md create mode 100644 middleware/jmx/detectors-jmx.tf create mode 100644 middleware/jmx/modules.tf create mode 100644 middleware/jmx/outputs.tf create mode 100644 middleware/jmx/variables.tf create mode 100644 middleware/jmx/versions.tf diff --git a/middleware/jmx/README.md b/middleware/jmx/README.md new file mode 100644 index 000000000..52b5f4654 --- /dev/null +++ b/middleware/jmx/README.md @@ -0,0 +1,39 @@ +# MIDDLEWARE Java SignalFx detectors + +## Prerequisites + +In the **bin/setenv.sh** file: +``` +-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5000 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 +``` + +In the **/etc/signalfx/agent.yaml**: + +``` +- type: collectd/genericjmx + host: 127.0.0.1 + port: 5000 +``` + +## How to use this module + +```hcl +module "signalfx-detectors-middleware-jmx" { + source = "github.com/claranet/terraform-signalfx-detectors.git//middleware/jmx?ref={revision}" + + environment = var.environment + notifications = var.notifications +} +``` + +## Purpose + +Creates SignalFx detectors with the following checks: +- JMX G1 Old Gen Space Usage +- JMX Memory CodeCache Space Usage +- JMX Memory Compressed Class Space Usage +- JMX Memory Geometry Metaspace Space Usage +- JMX Memory Heap Usage +- JMX Memory Non Heap Usage +- JMX Memory Survivor Space Usage +- JMX Threads Count diff --git a/middleware/jmx/detectors-jmx.tf b/middleware/jmx/detectors-jmx.tf new file mode 100644 index 000000000..43d2c89bb --- /dev/null +++ b/middleware/jmx/detectors-jmx.tf @@ -0,0 +1,239 @@ +# jmx thread count +resource "signalfx_detector" "jmx_thread_count" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Threads Count" + + program_text = <<-EOF + signal = data('gauge.jvm.threads.count', filter=${module.filter-tags.filter_custom})${var.jmx_thread_count_aggregation_function}${var.jmx_thread_count_transformation_function}.publish('signal') + detect(when(signal > ${var.jmx_thread_count_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_thread_count_threshold_warning}) and (signal < ${var.jmx_thread_count_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too low > ${var.jmx_thread_count_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_thread_count_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_thread_count_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too low > ${var.jmx_thread_count_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_thread_count_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_thread_count_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx heap size +resource "signalfx_detector" "jmx_memory_heap_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Heap Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.jmx_memory_heap_used_aggregation_function}${var.jmx_memory_heap_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.jmx_memory_heap_max_aggregation_function}${var.jmx_memory_heap_max_transformation_function} + signal = (A/B).fill(0).scale(100).publish('signal') + detect(when(signal > ${var.jmx_memory_heap_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_heap_usage_threshold_warning}) and (signal < ${var.jmx_memory_heap_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_heap_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_heap_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_heap_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_heap_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_heap_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_heap_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx survivor space size +resource "signalfx_detector" "jmx_memory_survivor_space_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Survivor Space Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-G1 Survivor Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_survivor_space_used_aggregation_function}${var.jmx_memory_survivor_space_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-G1 Survivor Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_survivor_space_max_aggregation_function}${var.jmx_memory_survivor_space_max_transformation_function} + signal = ((A/B).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_survivor_space_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_survivor_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_survivor_space_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_survivor_space_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_survivor_space_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_survivor_space_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_survivor_space_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_survivor_space_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_survivor_space_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx compressed class space size +resource "signalfx_detector" "jmx_memory_compressed_class_space_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Compressed Class Space Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-Compressed Class Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_compressed_class_space_used_aggregation_function}${var.jmx_memory_compressed_class_space_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-Compressed Class Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_compressed_class_space_max_aggregation_function}${var.jmx_memory_compressed_class_space_max_transformation_function} + signal = ((A/B).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_compressed_class_space_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_compressed_class_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_compressed_class_space_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_compressed_class_space_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_compressed_class_space_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_compressed_class_space_usage_notifications_warning, "critical", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_compressed_class_space_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_compressed_class_space_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_compressed_class_space_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx g1 old gen +resource "signalfx_detector" "jmx_memory_g1_old_gen_space_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX G1 Old Gen Space Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.jmx_memory_g1_old_gen_space_used_aggregation_function}${var.jmx_memory_g1_old_gen_space_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.jmx_memory_g1_old_gen_space_max_aggregation_function}${var.jmx_memory_g1_old_gen_space_max_transformation_function} + signal = ((A/B).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_g1_old_gen_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_g1_old_gen_space_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_g1_old_gen_space_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_g1_old_gen_space_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_g1_old_gen_space_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_g1_old_gen_space_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx geometry metaspace +resource "signalfx_detector" "jmx_memory_geometry_metaspace_space_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Geometry Metaspace Space Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-Metaspace') and ${module.filter-tags.filter_custom})${var.jmx_memory_geometry_metaspace_space_used_aggregation_function}${var.jmx_memory_geometry_metaspace_space_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-Metaspace') and ${module.filter-tags.filter_custom})${var.jmx_memory_geometry_metaspace_space_max_aggregation_function}${var.jmx_memory_geometry_metaspace_space_max_transformation_function} + signal = ((A/B).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_geometry_metaspace_space_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_geometry_metaspace_space_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_geometry_metaspace_space_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_geometry_metaspace_space_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx codecache usage +resource "signalfx_detector" "jmx_memory_codecache_space_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory CodeCache Space Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', "memory_pool-CodeHeap 'non-profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_max_aggregation_function}${var.jmx_memory_codecache_space_max_transformation_function} + C = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'non-profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} + D = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} + signal = (((A+C)/(B+D)).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_codecache_space_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_codecache_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_codecache_space_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_codecache_space_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_codecache_space_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_codecache_space_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_codecache_space_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_codecache_space_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_codecache_space_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} + +# jmx non heap size +resource "signalfx_detector" "jmx_memory_non_heap_usage" { + name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Non Heap Usage" + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory-nonheap') and ${module.filter-tags.filter_custom})${var.jmx_memory_non_heap_used_aggregation_function}${var.jmx_memory_non_heap_used_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory-nonheap') and ${module.filter-tags.filter_custom})${var.jmx_memory_non_heap_max_aggregation_function}${var.jmx_memory_non_heap_max_transformation_function} + signal = ((A/B).fill(0).scale(100)).publish('signal') + detect(when(signal > ${var.jmx_memory_non_heap_usage_threshold_critical})).publish('critical') + detect(when(signal > ${var.jmx_memory_non_heap_usage_threshold_warning}) and (signal < ${var.jmx_memory_non_heap_usage_threshold_critical})).publish('WARN') +EOF + + rule { + description = "is too high > ${var.jmx_memory_non_heap_usage_threshold_warning}" + severity = "Warning" + detect_label = "WARN" + disabled = coalesce(var.jmx_memory_non_heap_usage_disabled_warning, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_non_heap_usage_notifications_warning, "warning", []), var.notifications.warning) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } + rule { + description = "is too high > ${var.jmx_memory_non_heap_usage_threshold_critical}" + severity = "Critical" + detect_label = "critical" + disabled = coalesce(var.jmx_memory_non_heap_usage_disabled_critical, var.detectors_disabled) + notifications = coalescelist(lookup(var.jmx_memory_non_heap_usage_notifications_critical, "critical", []), var.notifications.critical) + parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" + } +} diff --git a/middleware/jmx/modules.tf b/middleware/jmx/modules.tf new file mode 100644 index 000000000..a5f64ce95 --- /dev/null +++ b/middleware/jmx/modules.tf @@ -0,0 +1,8 @@ +module "filter-tags" { + source = "github.com/claranet/terraform-signalfx-detectors.git//common/filter-tags" + + filter_defaults = "filter('env', '${var.environment}') and filter('sfx_monitored', 'true')" + filter_custom_includes = var.filter_custom_includes + filter_custom_excludes = var.filter_custom_excludes +} + diff --git a/middleware/jmx/outputs.tf b/middleware/jmx/outputs.tf new file mode 100644 index 000000000..e69de29bb diff --git a/middleware/jmx/variables.tf b/middleware/jmx/variables.tf new file mode 100644 index 000000000..619e5ba34 --- /dev/null +++ b/middleware/jmx/variables.tf @@ -0,0 +1,483 @@ +# Global + +variable "environment" { + description = "Infrastructure environment" + type = string +} + +# SignalFx module specific + +variable "notifications" { + description = "Default notification recipients list per severity" + type = object({ + critical = list(string) + major = list(string) + minor = list(string) + warning = list(string) + info = list(string) + }) +} + +variable "prefixes" { + description = "Prefixes list to prepend between brackets on every monitors names before environment" + type = list + default = [] +} + +variable "filter_custom_includes" { + description = "List of tags to include when custom filtering is used" + type = list + default = [] +} + +variable "filter_custom_excludes" { + description = "List of tags to exclude when custom filtering is used" + type = list + default = [] +} + +variable "detectors_disabled" { + description = "Disable all detectors in this module" + type = bool + default = false +} + +# jmx detectors specific + +variable "jmx_memory_heap_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_heap_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_heap_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_heap_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_heap_used_aggregation_function" { + description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_heap_used_transformation_function" { + description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_heap_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_heap_max_transformation_function" { + description = "Transformation function for jmx memory max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_thread_count_disabled_warning" { + type = bool + default = null +} + +variable "jmx_thread_count_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_thread_count_disabled_critical" { + type = bool + default = null +} + +variable "jmx_thread_count_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_thread_count_aggregation_function" { + description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_thread_count_transformation_function" { + description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_non_heap_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_non_heap_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_non_heap_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_non_heap_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_non_heap_used_aggregation_function" { + description = "Aggregation function and group by for jmx non heap memory used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_non_heap_used_transformation_function" { + description = "Transformation function for jmx non heap memory used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_non_heap_max_aggregation_function" { + description = "Aggregation function and group by for jmx non heap memory max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_non_heap_max_transformation_function" { + description = "Transformation function for jmx non heap memory max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_codecache_space_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_codecache_space_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_codecache_space_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_codecache_space_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_codecache_space_used_aggregation_function" { + description = "Aggregation function and group by for jmx memory codecache space used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_codecache_space_used_transformation_function" { + description = "Transformation function for jmx memory codecache space used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_codecache_space_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory codecache space max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_codecache_space_max_transformation_function" { + description = "Transformation function for jmx memory codecache space max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_geometry_metaspace_space_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_geometry_metaspace_space_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_geometry_metaspace_space_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_geometry_metaspace_space_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_geometry_metaspace_space_used_aggregation_function" { + description = "Aggregation function and group by for jmx memory metaspace space used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_geometry_metaspace_space_used_transformation_function" { + description = "Transformation function for jmx memory metaspace space used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_geometry_metaspace_space_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory max metaspace space detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_geometry_metaspace_space_max_transformation_function" { + description = "Transformation function for jmx memory max metaspace space detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_g1_old_gen_space_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_g1_old_gen_space_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_g1_old_gen_space_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_g1_old_gen_space_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_g1_old_gen_space_used_aggregation_function" { + description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_g1_old_gen_space_used_transformation_function" { + description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_g1_old_gen_space_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_g1_old_gen_space_max_transformation_function" { + description = "Transformation function for jmx memory max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_compressed_class_space_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_compressed_class_space_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_compressed_class_space_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_compressed_class_space_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_compressed_class_space_used_aggregation_function" { + description = "Aggregation function and group by for jmx compressed class memory used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_compressed_class_space_used_transformation_function" { + description = "Transformation function for jmx memory compressed class used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_compressed_class_space_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory compressed class max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_compressed_class_space_max_transformation_function" { + description = "Transformation function for jmx memory compressed class max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_survivor_space_usage_disabled_warning" { + type = bool + default = null +} + +variable "jmx_memory_survivor_space_usage_notifications_warning" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_survivor_space_usage_disabled_critical" { + type = bool + default = null +} + +variable "jmx_memory_survivor_space_usage_notifications_critical" { + type = map(list(string)) + default = {} +} + +variable "jmx_memory_survivor_space_used_aggregation_function" { + description = "Aggregation function and group by for jmx memory survivor space used detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_survivor_space_used_transformation_function" { + description = "Transformation function for jmx memory survivor space used detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +variable "jmx_memory_survivor_space_max_aggregation_function" { + description = "Aggregation function and group by for jmx memory survivor space max detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "jmx_memory_survivor_space_max_transformation_function" { + description = "Transformation function for jmx memory survivor space max detector (i.e. \".mean(over='5m')\"))" + type = string + default = ".min(over='5m')" +} + +# jmx threshold + +variable "jmx_memory_heap_usage_threshold_warning" { + description = "Warning threshold for jmx heap usage" + type = number + default = 80 +} + +variable "jmx_memory_heap_usage_threshold_critical" { + description = "critical threshold for jmx heap usage" + type = number + default = 90 +} + +variable "jmx_thread_count_threshold_warning" { + description = "Warning threshold for jmx heap usage" + type = number + default = 400 +} + +variable "jmx_thread_count_threshold_critical" { + description = "critical threshold for jmx heap usage" + type = number + default = 500 +} + +variable "jmx_memory_non_heap_usage_threshold_warning" { + description = "Warning threshold for jmx non heap usage" + type = number + default = 80 +} + +variable "jmx_memory_non_heap_usage_threshold_critical" { + description = "critical threshold for jmx non heap usage" + type = number + default = 90 +} + +variable "jmx_memory_geometry_metaspace_space_usage_threshold_warning" { + description = "Warning threshold for jmx metaspace usage" + type = number + default = 80 +} + +variable "jmx_memory_geometry_metaspace_space_usage_threshold_critical" { + description = "critical threshold for jmx metaspace usage" + type = number + default = 90 +} + +variable "jmx_memory_survivor_space_usage_threshold_warning" { + description = "Warning threshold for jmx survivor usage" + type = number + default = 80 +} + +variable "jmx_memory_survivor_space_usage_threshold_critical" { + description = "critical threshold for jmx survivor usage" + type = number + default = 90 +} + +variable "jmx_memory_compressed_class_space_usage_threshold_warning" { + description = "Warning threshold for jmx compressed usage" + type = number + default = 80 +} + +variable "jmx_memory_compressed_class_space_usage_threshold_critical" { + description = "critical threshold for jmx compressed usage" + type = number + default = 90 +} + +variable "jmx_memory_g1_old_gen_space_usage_threshold_warning" { + description = "Warning threshold for jmx G1 old gen usage" + type = number + default = 80 +} + +variable "jmx_memory_g1_old_gen_space_usage_threshold_critical" { + description = "critical threshold for jmx G1 old gen usage" + type = number + default = 90 +} + +variable "jmx_memory_codecache_space_usage_threshold_warning" { + description = "Warning threshold for jmx codecache usage" + type = number + default = 80 +} + +variable "jmx_memory_codecache_space_usage_threshold_critical" { + description = "critical threshold for jmx codecache usage" + type = number + default = 90 +} diff --git a/middleware/jmx/versions.tf b/middleware/jmx/versions.tf new file mode 100644 index 000000000..eed326812 --- /dev/null +++ b/middleware/jmx/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + signalfx = { + source = "terraform-providers/signalfx" + version = ">= 4.26.4" + } + } + required_version = ">= 0.12.24" +} From 7fb8e30e5d93e85aa241aabbb6f60e8549532df0 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Mon, 19 Oct 2020 13:34:22 +0200 Subject: [PATCH 2/2] rework genericjmx detectors --- middleware/genericjmx/README.md | 45 ++ middleware/genericjmx/common-locals.tf | 1 + middleware/genericjmx/common-variables.tf | 1 + middleware/genericjmx/detectors-genericjmx.tf | 62 +++ middleware/{jmx => genericjmx}/modules.tf | 0 middleware/genericjmx/outputs.tf | 10 + middleware/genericjmx/variables.tf | 102 ++++ middleware/{jmx => genericjmx}/versions.tf | 4 +- middleware/jmx/README.md | 39 -- middleware/jmx/detectors-jmx.tf | 239 --------- middleware/jmx/outputs.tf | 0 middleware/jmx/variables.tf | 483 ------------------ 12 files changed, 223 insertions(+), 763 deletions(-) create mode 100644 middleware/genericjmx/README.md create mode 120000 middleware/genericjmx/common-locals.tf create mode 120000 middleware/genericjmx/common-variables.tf create mode 100644 middleware/genericjmx/detectors-genericjmx.tf rename middleware/{jmx => genericjmx}/modules.tf (100%) create mode 100644 middleware/genericjmx/outputs.tf create mode 100644 middleware/genericjmx/variables.tf rename middleware/{jmx => genericjmx}/versions.tf (53%) delete mode 100644 middleware/jmx/README.md delete mode 100644 middleware/jmx/detectors-jmx.tf delete mode 100644 middleware/jmx/outputs.tf delete mode 100644 middleware/jmx/variables.tf diff --git a/middleware/genericjmx/README.md b/middleware/genericjmx/README.md new file mode 100644 index 000000000..c0f8926c6 --- /dev/null +++ b/middleware/genericjmx/README.md @@ -0,0 +1,45 @@ +# MIDDLEWARE JMX SignalFx detectors + +## How to use this module + +```hcl +module "signalfx-detectors-middleware-jmx" { + source = "github.com/claranet/terraform-signalfx-detectors.git//middleware/jmx?ref={revision}" + + environment = var.environment + notifications = var.notifications +} +``` + +## Purpose + +Creates SignalFx detectors with the following checks: +- JMX GC old generation usage +- JMX memory heap usage + +## Notes + +This module uses the [GenericJMX](https://docs.signalfx.com/en/latest/integrations/agent/monitors/collectd-genericjmx.html) +monitor to fetch common Java runtime metrics for every JVM based applications. + +You must [enable JMX Remote](https://docs.oracle.com/javadb/10.10.1.2/adminguide/radminjmxenabledisable.html) on your JAVA +application. Depending on your application you should add following paramters as example: + +``` +-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5000 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 +``` + +If there is a native GenericJMX based monitor for your specific application like for +[Cassandra](https://docs.signalfx.com/en/latest/integrations/agent/monitors/collectd-cassandra.html) +so you should configure its dedicated monitor and you will automatically retrieve required metrics for this module. + +Else if there is no monitor available for your specific application or you simply do not want to collect specific +application metrics, so you have to configure the GenericJMX directly: + +``` +- type: collectd/genericjmx + host: 127.0.0.1 + port: 5000 +``` + +Keep in mind you can easily add specific application metrics defining `mBeanDefinitions` parameter. diff --git a/middleware/genericjmx/common-locals.tf b/middleware/genericjmx/common-locals.tf new file mode 120000 index 000000000..3dc5abd06 --- /dev/null +++ b/middleware/genericjmx/common-locals.tf @@ -0,0 +1 @@ +../../common/locals.tf \ No newline at end of file diff --git a/middleware/genericjmx/common-variables.tf b/middleware/genericjmx/common-variables.tf new file mode 120000 index 000000000..3ba34a173 --- /dev/null +++ b/middleware/genericjmx/common-variables.tf @@ -0,0 +1 @@ +../../common/variables.tf \ No newline at end of file diff --git a/middleware/genericjmx/detectors-genericjmx.tf b/middleware/genericjmx/detectors-genericjmx.tf new file mode 100644 index 000000000..c26d75f55 --- /dev/null +++ b/middleware/genericjmx/detectors-genericjmx.tf @@ -0,0 +1,62 @@ +resource "signalfx_detector" "jmx_memory_heap" { + name = format("%s %s", local.detector_name_prefix, "JMX memory heap usage") + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.memory_heap_aggregation_function}${var.memory_heap_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.memory_heap_aggregation_function}${var.memory_heap_transformation_function} + signal = (A/B).scale(100).publish('signal') + detect(when(signal > ${var.memory_heap_threshold_critical})).publish('CRIT') + detect(when(signal > ${var.memory_heap_threshold_major}) and (signal < ${var.memory_heap_threshold_critical})).publish('MAJOR') +EOF + + rule { + description = "is too high > ${var.memory_heap_threshold_major}" + severity = "Major" + detect_label = "MAJOR" + disabled = coalesce(var.memory_heap_disabled_major, var.memory_heap_disabled, var.detectors_disabled) + notifications = coalescelist(lookup(var.memory_heap_notifications, "major", []), var.notifications.major) + parameterized_subject = local.rule_subject + parameterized_body = local.rule_body + } + rule { + description = "is too high > ${var.memory_heap_threshold_critical}" + severity = "Critical" + detect_label = "CRIT" + disabled = coalesce(var.memory_heap_disabled_critical, var.memory_heap_disabled, var.detectors_disabled) + notifications = coalescelist(lookup(var.memory_heap_notifications, "critical", []), var.notifications.critical) + parameterized_subject = local.rule_subject + parameterized_body = local.rule_body + } +} + +resource "signalfx_detector" "jmx_old_gen" { + name = format("%s %s", local.detector_name_prefix, "JMX GC old generation usage") + + program_text = <<-EOF + A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.gc_old_gen_aggregation_function}${var.gc_old_gen_transformation_function} + B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.gc_old_gen_aggregation_function}${var.gc_old_gen_transformation_function} + signal = (A/B).scale(100).publish('signal') + detect(when(signal > ${var.gc_old_gen_threshold_critical})).publish('CRIT') + detect(when(signal > ${var.gc_old_gen_threshold_major}) and (signal < ${var.gc_old_gen_threshold_critical})).publish('MAJOR') +EOF + + rule { + description = "is too high > ${var.gc_old_gen_threshold_major}" + severity = "Major" + detect_label = "MAJOR" + disabled = coalesce(var.gc_old_gen_disabled_major, var.gc_old_gen_disabled, var.detectors_disabled) + notifications = coalescelist(lookup(var.gc_old_gen_notifications, "major", []), var.notifications.major) + parameterized_subject = local.rule_subject + parameterized_body = local.rule_body + } + rule { + description = "is too high > ${var.gc_old_gen_threshold_critical}" + severity = "Critical" + detect_label = "CRIT" + disabled = coalesce(var.gc_old_gen_disabled_critical, var.gc_old_gen_disabled, var.detectors_disabled) + notifications = coalescelist(lookup(var.gc_old_gen_notifications, "critical", []), var.notifications.critical) + parameterized_subject = local.rule_subject + parameterized_body = local.rule_body + } +} + diff --git a/middleware/jmx/modules.tf b/middleware/genericjmx/modules.tf similarity index 100% rename from middleware/jmx/modules.tf rename to middleware/genericjmx/modules.tf diff --git a/middleware/genericjmx/outputs.tf b/middleware/genericjmx/outputs.tf new file mode 100644 index 000000000..590385050 --- /dev/null +++ b/middleware/genericjmx/outputs.tf @@ -0,0 +1,10 @@ +output "jmx_memory_heap" { + description = "Detector resource for jmx_memory_heap" + value = signalfx_detector.jmx_memory_heap +} + +output "jmx_old_gen" { + description = "Detector resource for jmx_old_gen" + value = signalfx_detector.jmx_old_gen +} + diff --git a/middleware/genericjmx/variables.tf b/middleware/genericjmx/variables.tf new file mode 100644 index 000000000..666370fa4 --- /dev/null +++ b/middleware/genericjmx/variables.tf @@ -0,0 +1,102 @@ +# Module specific + +# memory_heap detector + +variable "memory_heap_disabled" { + description = "Disable all alerting rules for memory_heap detector" + type = bool + default = null +} + +variable "memory_heap_disabled_critical" { + description = "Disable critical alerting rule for memory_heap detector" + type = bool + default = null +} + +variable "memory_heap_disabled_major" { + description = "Disable major alerting rule for memory_heap detector" + type = bool + default = null +} + +variable "memory_heap_notifications" { + description = "Notification recipients list per severity overridden for memory_heap detector" + type = map(list(string)) + default = {} +} + +variable "memory_heap_aggregation_function" { + description = "Aggregation function and group by for memory_heap detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "memory_heap_transformation_function" { + description = "Transformation function for memory_heap detector (i.e. \".mean(over='5m')\")" + type = string + default = ".min(over='5m')" +} + +variable "memory_heap_threshold_major" { + description = "Warning threshold for memory_heap detector" + type = number + default = 80 +} + +variable "memory_heap_threshold_critical" { + description = "Critical threshold for memory_heap detector" + type = number + default = 90 +} + +# gc_old_gen detector + +variable "gc_old_gen_disabled" { + description = "Disable all alerting rules for gc_old_gen detector" + type = bool + default = null +} + +variable "gc_old_gen_disabled_critical" { + description = "Disable critical alerting rule for gc_old_gen detector" + type = bool + default = null +} + +variable "gc_old_gen_disabled_major" { + description = "Disable major alerting rule for gc_old_gen detector" + type = bool + default = null +} + +variable "gc_old_gen_notifications" { + description = "Notification recipients list per severity overridden for gc_old_gen detector" + type = map(list(string)) + default = {} +} + +variable "gc_old_gen_aggregation_function" { + description = "Aggregation function and group by for gc_old_gen detector (i.e. \".mean(by=['host']).\")" + type = string + default = "" +} + +variable "gc_old_gen_transformation_function" { + description = "Transformation function for gc_old_gen detector (i.e. \".mean(over='5m')\")" + type = string + default = ".min(over='5m')" +} + +variable "gc_old_gen_threshold_major" { + description = "Warning threshold for gc_old_gen detector" + type = number + default = 80 +} + +variable "gc_old_gen_threshold_critical" { + description = "Critical threshold for gc_old_gen detector" + type = number + default = 90 +} + diff --git a/middleware/jmx/versions.tf b/middleware/genericjmx/versions.tf similarity index 53% rename from middleware/jmx/versions.tf rename to middleware/genericjmx/versions.tf index eed326812..31c870b77 100644 --- a/middleware/jmx/versions.tf +++ b/middleware/genericjmx/versions.tf @@ -1,9 +1,9 @@ terraform { required_providers { signalfx = { - source = "terraform-providers/signalfx" + source = "splunk-terraform/signalfx" version = ">= 4.26.4" } } - required_version = ">= 0.12.24" + required_version = ">= 0.12.26" } diff --git a/middleware/jmx/README.md b/middleware/jmx/README.md deleted file mode 100644 index 52b5f4654..000000000 --- a/middleware/jmx/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# MIDDLEWARE Java SignalFx detectors - -## Prerequisites - -In the **bin/setenv.sh** file: -``` --Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5000 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 -``` - -In the **/etc/signalfx/agent.yaml**: - -``` -- type: collectd/genericjmx - host: 127.0.0.1 - port: 5000 -``` - -## How to use this module - -```hcl -module "signalfx-detectors-middleware-jmx" { - source = "github.com/claranet/terraform-signalfx-detectors.git//middleware/jmx?ref={revision}" - - environment = var.environment - notifications = var.notifications -} -``` - -## Purpose - -Creates SignalFx detectors with the following checks: -- JMX G1 Old Gen Space Usage -- JMX Memory CodeCache Space Usage -- JMX Memory Compressed Class Space Usage -- JMX Memory Geometry Metaspace Space Usage -- JMX Memory Heap Usage -- JMX Memory Non Heap Usage -- JMX Memory Survivor Space Usage -- JMX Threads Count diff --git a/middleware/jmx/detectors-jmx.tf b/middleware/jmx/detectors-jmx.tf deleted file mode 100644 index 43d2c89bb..000000000 --- a/middleware/jmx/detectors-jmx.tf +++ /dev/null @@ -1,239 +0,0 @@ -# jmx thread count -resource "signalfx_detector" "jmx_thread_count" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Threads Count" - - program_text = <<-EOF - signal = data('gauge.jvm.threads.count', filter=${module.filter-tags.filter_custom})${var.jmx_thread_count_aggregation_function}${var.jmx_thread_count_transformation_function}.publish('signal') - detect(when(signal > ${var.jmx_thread_count_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_thread_count_threshold_warning}) and (signal < ${var.jmx_thread_count_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too low > ${var.jmx_thread_count_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_thread_count_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_thread_count_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too low > ${var.jmx_thread_count_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_thread_count_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_thread_count_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx heap size -resource "signalfx_detector" "jmx_memory_heap_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Heap Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.jmx_memory_heap_used_aggregation_function}${var.jmx_memory_heap_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory-heap') and ${module.filter-tags.filter_custom})${var.jmx_memory_heap_max_aggregation_function}${var.jmx_memory_heap_max_transformation_function} - signal = (A/B).fill(0).scale(100).publish('signal') - detect(when(signal > ${var.jmx_memory_heap_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_heap_usage_threshold_warning}) and (signal < ${var.jmx_memory_heap_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_heap_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_heap_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_heap_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_heap_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_heap_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_heap_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx survivor space size -resource "signalfx_detector" "jmx_memory_survivor_space_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Survivor Space Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-G1 Survivor Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_survivor_space_used_aggregation_function}${var.jmx_memory_survivor_space_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-G1 Survivor Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_survivor_space_max_aggregation_function}${var.jmx_memory_survivor_space_max_transformation_function} - signal = ((A/B).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_survivor_space_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_survivor_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_survivor_space_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_survivor_space_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_survivor_space_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_survivor_space_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_survivor_space_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_survivor_space_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_survivor_space_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx compressed class space size -resource "signalfx_detector" "jmx_memory_compressed_class_space_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Compressed Class Space Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-Compressed Class Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_compressed_class_space_used_aggregation_function}${var.jmx_memory_compressed_class_space_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-Compressed Class Space') and ${module.filter-tags.filter_custom})${var.jmx_memory_compressed_class_space_max_aggregation_function}${var.jmx_memory_compressed_class_space_max_transformation_function} - signal = ((A/B).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_compressed_class_space_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_compressed_class_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_compressed_class_space_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_compressed_class_space_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_compressed_class_space_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_compressed_class_space_usage_notifications_warning, "critical", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_compressed_class_space_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_compressed_class_space_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_compressed_class_space_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx g1 old gen -resource "signalfx_detector" "jmx_memory_g1_old_gen_space_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX G1 Old Gen Space Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.jmx_memory_g1_old_gen_space_used_aggregation_function}${var.jmx_memory_g1_old_gen_space_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-G1 Old Gen') and ${module.filter-tags.filter_custom})${var.jmx_memory_g1_old_gen_space_max_aggregation_function}${var.jmx_memory_g1_old_gen_space_max_transformation_function} - signal = ((A/B).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_g1_old_gen_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_g1_old_gen_space_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_g1_old_gen_space_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_g1_old_gen_space_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_g1_old_gen_space_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_g1_old_gen_space_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_g1_old_gen_space_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx geometry metaspace -resource "signalfx_detector" "jmx_memory_geometry_metaspace_space_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Geometry Metaspace Space Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory_pool-Metaspace') and ${module.filter-tags.filter_custom})${var.jmx_memory_geometry_metaspace_space_used_aggregation_function}${var.jmx_memory_geometry_metaspace_space_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory_pool-Metaspace') and ${module.filter-tags.filter_custom})${var.jmx_memory_geometry_metaspace_space_max_aggregation_function}${var.jmx_memory_geometry_metaspace_space_max_transformation_function} - signal = ((A/B).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_geometry_metaspace_space_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_geometry_metaspace_space_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_geometry_metaspace_space_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_geometry_metaspace_space_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_geometry_metaspace_space_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx codecache usage -resource "signalfx_detector" "jmx_memory_codecache_space_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory CodeCache Space Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', "memory_pool-CodeHeap 'non-profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_max_aggregation_function}${var.jmx_memory_codecache_space_max_transformation_function} - C = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'non-profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} - D = data('jmx_memory.used', filter=filter('plugin_instance', "memory_pool-CodeHeap 'profiled nmethods'") and ${module.filter-tags.filter_custom})${var.jmx_memory_codecache_space_used_aggregation_function}${var.jmx_memory_codecache_space_used_transformation_function} - signal = (((A+C)/(B+D)).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_codecache_space_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_codecache_space_usage_threshold_warning}) and (signal < ${var.jmx_memory_codecache_space_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_codecache_space_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_codecache_space_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_codecache_space_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_codecache_space_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_codecache_space_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_codecache_space_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} - -# jmx non heap size -resource "signalfx_detector" "jmx_memory_non_heap_usage" { - name = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}] JMX Memory Non Heap Usage" - - program_text = <<-EOF - A = data('jmx_memory.used', filter=filter('plugin_instance', 'memory-nonheap') and ${module.filter-tags.filter_custom})${var.jmx_memory_non_heap_used_aggregation_function}${var.jmx_memory_non_heap_used_transformation_function} - B = data('jmx_memory.max', filter=filter('plugin_instance', 'memory-nonheap') and ${module.filter-tags.filter_custom})${var.jmx_memory_non_heap_max_aggregation_function}${var.jmx_memory_non_heap_max_transformation_function} - signal = ((A/B).fill(0).scale(100)).publish('signal') - detect(when(signal > ${var.jmx_memory_non_heap_usage_threshold_critical})).publish('critical') - detect(when(signal > ${var.jmx_memory_non_heap_usage_threshold_warning}) and (signal < ${var.jmx_memory_non_heap_usage_threshold_critical})).publish('WARN') -EOF - - rule { - description = "is too high > ${var.jmx_memory_non_heap_usage_threshold_warning}" - severity = "Warning" - detect_label = "WARN" - disabled = coalesce(var.jmx_memory_non_heap_usage_disabled_warning, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_non_heap_usage_notifications_warning, "warning", []), var.notifications.warning) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } - rule { - description = "is too high > ${var.jmx_memory_non_heap_usage_threshold_critical}" - severity = "Critical" - detect_label = "critical" - disabled = coalesce(var.jmx_memory_non_heap_usage_disabled_critical, var.detectors_disabled) - notifications = coalescelist(lookup(var.jmx_memory_non_heap_usage_notifications_critical, "critical", []), var.notifications.critical) - parameterized_subject = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} on {{{dimensions}}}" - } -} diff --git a/middleware/jmx/outputs.tf b/middleware/jmx/outputs.tf deleted file mode 100644 index e69de29bb..000000000 diff --git a/middleware/jmx/variables.tf b/middleware/jmx/variables.tf deleted file mode 100644 index 619e5ba34..000000000 --- a/middleware/jmx/variables.tf +++ /dev/null @@ -1,483 +0,0 @@ -# Global - -variable "environment" { - description = "Infrastructure environment" - type = string -} - -# SignalFx module specific - -variable "notifications" { - description = "Default notification recipients list per severity" - type = object({ - critical = list(string) - major = list(string) - minor = list(string) - warning = list(string) - info = list(string) - }) -} - -variable "prefixes" { - description = "Prefixes list to prepend between brackets on every monitors names before environment" - type = list - default = [] -} - -variable "filter_custom_includes" { - description = "List of tags to include when custom filtering is used" - type = list - default = [] -} - -variable "filter_custom_excludes" { - description = "List of tags to exclude when custom filtering is used" - type = list - default = [] -} - -variable "detectors_disabled" { - description = "Disable all detectors in this module" - type = bool - default = false -} - -# jmx detectors specific - -variable "jmx_memory_heap_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_heap_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_heap_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_heap_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_heap_used_aggregation_function" { - description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_heap_used_transformation_function" { - description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_heap_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_heap_max_transformation_function" { - description = "Transformation function for jmx memory max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_thread_count_disabled_warning" { - type = bool - default = null -} - -variable "jmx_thread_count_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_thread_count_disabled_critical" { - type = bool - default = null -} - -variable "jmx_thread_count_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_thread_count_aggregation_function" { - description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_thread_count_transformation_function" { - description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_non_heap_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_non_heap_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_non_heap_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_non_heap_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_non_heap_used_aggregation_function" { - description = "Aggregation function and group by for jmx non heap memory used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_non_heap_used_transformation_function" { - description = "Transformation function for jmx non heap memory used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_non_heap_max_aggregation_function" { - description = "Aggregation function and group by for jmx non heap memory max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_non_heap_max_transformation_function" { - description = "Transformation function for jmx non heap memory max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_codecache_space_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_codecache_space_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_codecache_space_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_codecache_space_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_codecache_space_used_aggregation_function" { - description = "Aggregation function and group by for jmx memory codecache space used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_codecache_space_used_transformation_function" { - description = "Transformation function for jmx memory codecache space used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_codecache_space_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory codecache space max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_codecache_space_max_transformation_function" { - description = "Transformation function for jmx memory codecache space max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_geometry_metaspace_space_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_geometry_metaspace_space_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_geometry_metaspace_space_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_geometry_metaspace_space_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_geometry_metaspace_space_used_aggregation_function" { - description = "Aggregation function and group by for jmx memory metaspace space used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_geometry_metaspace_space_used_transformation_function" { - description = "Transformation function for jmx memory metaspace space used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_geometry_metaspace_space_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory max metaspace space detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_geometry_metaspace_space_max_transformation_function" { - description = "Transformation function for jmx memory max metaspace space detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_g1_old_gen_space_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_g1_old_gen_space_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_g1_old_gen_space_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_g1_old_gen_space_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_g1_old_gen_space_used_aggregation_function" { - description = "Aggregation function and group by for jmx memory used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_g1_old_gen_space_used_transformation_function" { - description = "Transformation function for jmx memory used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_g1_old_gen_space_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_g1_old_gen_space_max_transformation_function" { - description = "Transformation function for jmx memory max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_compressed_class_space_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_compressed_class_space_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_compressed_class_space_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_compressed_class_space_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_compressed_class_space_used_aggregation_function" { - description = "Aggregation function and group by for jmx compressed class memory used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_compressed_class_space_used_transformation_function" { - description = "Transformation function for jmx memory compressed class used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_compressed_class_space_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory compressed class max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_compressed_class_space_max_transformation_function" { - description = "Transformation function for jmx memory compressed class max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_survivor_space_usage_disabled_warning" { - type = bool - default = null -} - -variable "jmx_memory_survivor_space_usage_notifications_warning" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_survivor_space_usage_disabled_critical" { - type = bool - default = null -} - -variable "jmx_memory_survivor_space_usage_notifications_critical" { - type = map(list(string)) - default = {} -} - -variable "jmx_memory_survivor_space_used_aggregation_function" { - description = "Aggregation function and group by for jmx memory survivor space used detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_survivor_space_used_transformation_function" { - description = "Transformation function for jmx memory survivor space used detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -variable "jmx_memory_survivor_space_max_aggregation_function" { - description = "Aggregation function and group by for jmx memory survivor space max detector (i.e. \".mean(by=['host']).\")" - type = string - default = "" -} - -variable "jmx_memory_survivor_space_max_transformation_function" { - description = "Transformation function for jmx memory survivor space max detector (i.e. \".mean(over='5m')\"))" - type = string - default = ".min(over='5m')" -} - -# jmx threshold - -variable "jmx_memory_heap_usage_threshold_warning" { - description = "Warning threshold for jmx heap usage" - type = number - default = 80 -} - -variable "jmx_memory_heap_usage_threshold_critical" { - description = "critical threshold for jmx heap usage" - type = number - default = 90 -} - -variable "jmx_thread_count_threshold_warning" { - description = "Warning threshold for jmx heap usage" - type = number - default = 400 -} - -variable "jmx_thread_count_threshold_critical" { - description = "critical threshold for jmx heap usage" - type = number - default = 500 -} - -variable "jmx_memory_non_heap_usage_threshold_warning" { - description = "Warning threshold for jmx non heap usage" - type = number - default = 80 -} - -variable "jmx_memory_non_heap_usage_threshold_critical" { - description = "critical threshold for jmx non heap usage" - type = number - default = 90 -} - -variable "jmx_memory_geometry_metaspace_space_usage_threshold_warning" { - description = "Warning threshold for jmx metaspace usage" - type = number - default = 80 -} - -variable "jmx_memory_geometry_metaspace_space_usage_threshold_critical" { - description = "critical threshold for jmx metaspace usage" - type = number - default = 90 -} - -variable "jmx_memory_survivor_space_usage_threshold_warning" { - description = "Warning threshold for jmx survivor usage" - type = number - default = 80 -} - -variable "jmx_memory_survivor_space_usage_threshold_critical" { - description = "critical threshold for jmx survivor usage" - type = number - default = 90 -} - -variable "jmx_memory_compressed_class_space_usage_threshold_warning" { - description = "Warning threshold for jmx compressed usage" - type = number - default = 80 -} - -variable "jmx_memory_compressed_class_space_usage_threshold_critical" { - description = "critical threshold for jmx compressed usage" - type = number - default = 90 -} - -variable "jmx_memory_g1_old_gen_space_usage_threshold_warning" { - description = "Warning threshold for jmx G1 old gen usage" - type = number - default = 80 -} - -variable "jmx_memory_g1_old_gen_space_usage_threshold_critical" { - description = "critical threshold for jmx G1 old gen usage" - type = number - default = 90 -} - -variable "jmx_memory_codecache_space_usage_threshold_warning" { - description = "Warning threshold for jmx codecache usage" - type = number - default = 80 -} - -variable "jmx_memory_codecache_space_usage_threshold_critical" { - description = "critical threshold for jmx codecache usage" - type = number - default = 90 -}