|
1 | | -# terraform-module-template |
2 | 1 |
|
3 | | -## Getting Started |
| 2 | + |
4 | 3 |
|
5 | | -Pre-commit: |
| 4 | +[//]: # (This file is generated. Do not edit, module description can be added by editing / creating module_description.md) |
| 5 | + |
| 6 | +# Terraform module for Datadog Apache Server |
| 7 | + |
| 8 | +This module is part of a larger suite of modules that provide alerts in Datadog. |
| 9 | +Other modules can be found on the [Terraform Registry](https://registry.terraform.io/search/modules?namespace=kabisa&provider=datadog) |
| 10 | + |
| 11 | +We have two base modules we use to standardise development of our Monitor Modules: |
| 12 | +- [generic monitor](https://github.com/kabisa/terraform-datadog-generic-monitor) Used in 90% of our alerts |
| 13 | +- [service check monitor](https://github.com/kabisa/terraform-datadog-service-check-monitor) |
| 14 | + |
| 15 | +Modules are generated with this tool: https://github.com/kabisa/datadog-terraform-generator |
| 16 | + |
| 17 | + |
| 18 | +[Module Variables](#module-variables) |
| 19 | + |
| 20 | +Monitors: |
| 21 | + |
| 22 | +| Monitor name | Default enabled | Priority | Query | |
| 23 | +|-----------------|------|----|------------------------| |
| 24 | +| [CPU Load](#cpu-load) | True | 3 | `avg(${var.cpu_usage_evaluation_period}):avg:apache.performance.cpu_load{${local.cpu_usage_filter}} by {service,host} > ${var.cpu_usage_critical}` | |
| 25 | +| [Traffic](#traffic) | True | 3 | `avg(last_15m):avg:apache.net.bytes_per_s{tag:xxx} by {service,host} > 100000` | |
| 26 | +| [Vhost Request Rate](#vhost-request-rate) | True | 3 | `avg(last_30m):per_minute(avg:apache.net.hits{tag:xxx,env:${var.env}} by {service,host}) > ` | |
| 27 | +| [Vhost Workers](#vhost-workers) | True | 2 | `max(last_15m):min:apache.performance.idle_workers{tag:xxx} by {service,host} < 1` | |
| 28 | + |
| 29 | +# Getting started developing |
| 30 | +[pre-commit](http://pre-commit.com/) was used to do Terraform linting and validating. |
| 31 | + |
| 32 | +Steps: |
6 | 33 | - Install [pre-commit](http://pre-commit.com/). E.g. `brew install pre-commit`. |
7 | | - - Run `pre-commit install` in this repo. (Every time you cloud a repo with pre-commit enabled you will need to run the pre-commit install command) |
| 34 | + - Run `pre-commit install` in this repo. (Every time you clone a repo with pre-commit enabled you will need to run the pre-commit install command) |
8 | 35 | - That’s it! Now every time you commit a code change (`.tf` file), the hooks in the `hooks:` config `.pre-commit-config.yaml` will execute. |
| 36 | + |
| 37 | +## CPU Load |
| 38 | + |
| 39 | +Query: |
| 40 | +```terraform |
| 41 | +avg(${var.cpu_usage_evaluation_period}):avg:apache.performance.cpu_load{${local.cpu_usage_filter}} by {service,host} > ${var.cpu_usage_critical} |
| 42 | +``` |
| 43 | + |
| 44 | +| variable | default | required | description | |
| 45 | +|-----------------------------|----------|----------|----------------------------------| |
| 46 | +| cpu_usage_enabled | True | No | | |
| 47 | +| cpu_usage_warning | 75 | No | | |
| 48 | +| cpu_usage_critical | 80 | No | | |
| 49 | +| cpu_usage_evaluation_period | last_15m | No | | |
| 50 | +| cpu_usage_note | "" | No | | |
| 51 | +| cpu_usage_docs | "" | No | | |
| 52 | +| cpu_usage_filter_override | "" | No | | |
| 53 | +| cpu_usage_alerting_enabled | True | No | | |
| 54 | +| cpu_usage_no_data_timeframe | None | No | | |
| 55 | +| cpu_usage_notify_no_data | False | No | | |
| 56 | +| cpu_usage_ok_threshold | None | No | | |
| 57 | +| cpu_usage_name_prefix | None | No | | |
| 58 | +| cpu_usage_name_suffix | None | No | | |
| 59 | +| cpu_usage_priority | 3 | No | Number from 1 (high) to 5 (low). | |
| 60 | + |
| 61 | + |
| 62 | +## Traffic |
| 63 | + |
| 64 | +Query: |
| 65 | +```terraform |
| 66 | +avg(last_15m):avg:apache.net.bytes_per_s{tag:xxx} by {service,host} > 100000 |
| 67 | +``` |
| 68 | + |
| 69 | +| variable | default | required | description | |
| 70 | +|---------------------------|----------|----------|----------------------------------| |
| 71 | +| traffic_enabled | True | No | | |
| 72 | +| traffic_warning | 75000 | No | | |
| 73 | +| traffic_critical | 100000 | No | | |
| 74 | +| traffic_evaluation_period | last_15m | No | | |
| 75 | +| traffic_note | "" | No | | |
| 76 | +| traffic_docs | "" | No | | |
| 77 | +| traffic_filter_override | "" | No | | |
| 78 | +| traffic_alerting_enabled | True | No | | |
| 79 | +| traffic_no_data_timeframe | None | No | | |
| 80 | +| traffic_notify_no_data | False | No | | |
| 81 | +| traffic_ok_threshold | None | No | | |
| 82 | +| traffic_name_prefix | None | No | | |
| 83 | +| traffic_name_suffix | None | No | | |
| 84 | +| traffic_priority | 3 | No | Number from 1 (high) to 5 (low). | |
| 85 | + |
| 86 | + |
| 87 | +## Vhost Availability |
| 88 | + |
| 89 | +This monitor raises alerts when it cannot successfully connect to an apache vhost. |
| 90 | + |
| 91 | +| variable | default | required | description | |
| 92 | +|--------------------------------------|------------------------------------------|----------|----------------------------------| |
| 93 | +| vhost_availability_enabled | True | No | | |
| 94 | +| vhost_availability_freshness_cycles | 3 | No | | |
| 95 | +| vhost_availability_warning | 2 | No | | |
| 96 | +| vhost_availability_critical | 3 | No | | |
| 97 | +| vhost_availability_evaluation_period | last_5m | No | | |
| 98 | +| vhost_availability_note | "" | No | | |
| 99 | +| vhost_availability_docs | This monitor raises alerts when it cannot successfully connect to an apache vhost. | No | | |
| 100 | +| vhost_availability_include_tags | [] | No | | |
| 101 | +| vhost_availability_exclude_tags | [] | No | | |
| 102 | +| vhost_availability_filter_override | "" | No | | |
| 103 | +| vhost_availability_alerting_enabled | True | No | | |
| 104 | +| vhost_availability_no_data_timeframe | 0 | No | | |
| 105 | +| vhost_availability_notify_no_data | False | No | | |
| 106 | +| vhost_availability_ok_threshold | 1 | No | | |
| 107 | +| vhost_availability_name_prefix | "" | No | | |
| 108 | +| vhost_availability_name_suffix | "" | No | | |
| 109 | +| vhost_availability_priority | 2 | No | Number from 1 (high) to 5 (low). | |
| 110 | +| vhost_require_full_window | False | No | | |
| 111 | + |
| 112 | + |
| 113 | +## Vhost Request Rate |
| 114 | + |
| 115 | +Query: |
| 116 | +```terraform |
| 117 | +avg(last_30m):per_minute(avg:apache.net.hits{tag:xxx,env:${var.env}} by {service,host}) > |
| 118 | +``` |
| 119 | + |
| 120 | +| variable | default | required | description | |
| 121 | +|--------------------------------------|----------|----------|-------------------------------------------------------| |
| 122 | +| vhost_request_rate_enabled | True | No | | |
| 123 | +| vhost_request_rate_warning | None | No | | |
| 124 | +| vhost_request_rate_critical | | Yes | | |
| 125 | +| vhost_request_rate_evaluation_period | last_30m | No | | |
| 126 | +| vhost_request_rate_note | "" | No | | |
| 127 | +| vhost_request_rate_docs | "" | No | | |
| 128 | +| vhost_request_rate_filter_override | "" | No | | |
| 129 | +| vhost_request_rate_alerting_enabled | True | No | | |
| 130 | +| vhost_request_rate_no_data_timeframe | None | No | | |
| 131 | +| vhost_request_rate_notify_no_data | False | No | | |
| 132 | +| vhost_request_rate_ok_threshold | None | No | | |
| 133 | +| vhost_request_rate_name_prefix | None | No | | |
| 134 | +| vhost_request_rate_name_suffix | None | No | | |
| 135 | +| vhost_request_rate_priority | 3 | No | Number from 1 (high) to 5 (low). | |
| 136 | +| vhost_request_new_group_delay | 300 | No | Time (in seconds) to skip evaluations for new groups. | |
| 137 | + |
| 138 | + |
| 139 | +## Vhost Workers |
| 140 | + |
| 141 | +Query: |
| 142 | +```terraform |
| 143 | +max(last_15m):min:apache.performance.idle_workers{tag:xxx} by {service,host} < 1 |
| 144 | +``` |
| 145 | + |
| 146 | +| variable | default | required | description | |
| 147 | +|---------------------------------|----------|----------|----------------------------------| |
| 148 | +| vhost_workers_enabled | True | No | | |
| 149 | +| vhost_workers_warning | 5 | No | | |
| 150 | +| vhost_workers_critical | 1 | No | | |
| 151 | +| vhost_workers_evaluation_period | last_15m | No | | |
| 152 | +| vhost_workers_note | "" | No | | |
| 153 | +| vhost_workers_docs | "" | No | | |
| 154 | +| vhost_workers_filter_override | "" | No | | |
| 155 | +| vhost_workers_alerting_enabled | True | No | | |
| 156 | +| vhost_workers_no_data_timeframe | None | No | | |
| 157 | +| vhost_workers_notify_no_data | False | No | | |
| 158 | +| vhost_workers_ok_threshold | None | No | | |
| 159 | +| vhost_workers_name_prefix | None | No | | |
| 160 | +| vhost_workers_name_suffix | None | No | | |
| 161 | +| vhost_workers_priority | 2 | No | Number from 1 (high) to 5 (low). | |
| 162 | + |
| 163 | + |
| 164 | +## Module Variables |
| 165 | + |
| 166 | +| variable | default | required | description | |
| 167 | +|----------------------|----------|----------|--------------| |
| 168 | +| filter_str | | Yes | | |
| 169 | +| env | | Yes | | |
| 170 | +| service | | Yes | | |
| 171 | +| service_display_name | None | No | | |
| 172 | +| notification_channel | | Yes | | |
| 173 | +| additional_tags | [] | No | | |
| 174 | +| locked | False | No | | |
| 175 | +| name_prefix | "" | No | | |
| 176 | +| name_suffix | "" | No | | |
| 177 | + |
| 178 | + |
0 commit comments