├── LICENSE ├── README.md └── rules ├── cassandra └── cassandra-rules.yml ├── dcos-storage.yml ├── elasticsearch ├── elasticsearch.rules └── elasticsearch.yml ├── kafka └── kafka-rules.yml └── telegraf.yml /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2019 Mesosphere 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DC/OS Prometheus Alert Rules 2 | 3 | This repository is the home of the official DC/OS Prometheus alert rules. They are automatically included in releases of the DC/OS Monitoring framework. 4 | 5 | ## Contributing 6 | 7 | Please read the documentation on Prometheus [alerting rules][1] carefully, then 8 | open a pull request with your changes. 9 | 10 | Each DC/OS component or framework should have a single rule file which contains 11 | all its alert rules. They will be passed to Prometheus via the `rule_files` 12 | configuration parameter. 13 | 14 | ## Severity Levels 15 | 16 | Alerts should be configured at two severity levels, warning and critical: 17 | 18 | - **`warning`** should be used for alerts which will be read by a human, but do not 19 | require immediate action. They would, for example, trigger an email notification. 20 | 21 | - **`critical`** should be used for alerts which will immediately interrupt a human. 22 | They would, for example, trigger a pager notification. 23 | 24 | ## Related Projects 25 | 26 | - https://github.com/mesosphere/dcos-monitoring 27 | - https://github.com/dcos/grafana-dashboards 28 | - https://github.com/dcos/telegraf 29 | 30 | [1]: https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/ 31 | -------------------------------------------------------------------------------- /rules/cassandra/cassandra-rules.yml: -------------------------------------------------------------------------------- 1 | 2 | groups: 3 | - name: Cassandra_Alerts 4 | rules: 5 | - alert: Client_Request_Write_Failures 6 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Failures_Write_m1_rate) > 0 7 | for: 1m 8 | labels: 9 | severity: warning 10 | annotations: 11 | description: "Number of write failures encountered. A write failure is a non-timeout exception encountered during a write request. Examine the reason map to find to the root cause. The most common cause for this type of error is when batch sizes are too large." 12 | 13 | - alert: Client_Request_Read_Failures 14 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Failures_Read_m1_rate) > 0 15 | for: 1m 16 | labels: 17 | severity: warning 18 | annotations: 19 | description: 'Number of read failures encountered. A read failure is a non-timeout exception encountered during a read request. Investigate the reason map to find to the root cause. The most common cause for this type of error is when too many tombstones are read during the request. ' 20 | 21 | - alert: Storage_Exceptions 22 | expr: sum(org_apache_cassandra_metrics_Storage_Exceptions) > 0 23 | for: 1m 24 | labels: 25 | severity: critical 26 | annotations: 27 | description: 'Number of internal exceptions caught. Under normal exceptions this should be zero.' 28 | 29 | - alert: ClientRequest_Unavailables_CASWrite_exception 30 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Unavailables_CASWrite_m1_rate) > 0 31 | for: 1m 32 | labels: 33 | severity: warning 34 | annotations: 35 | description: 'Number of lightweight transaction writes that failed because too many nodes were unavailable' 36 | 37 | - alert: ClientRequest_Unavailables_CASRead_exception 38 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Unavailables_CASRead_m1_rate) > 0 39 | for: 1m 40 | labels: 41 | severity: warning 42 | annotations: 43 | description: 'Number of lightweight transaction reads that failed because too many replicas were unavailable' 44 | 45 | - alert: Client_Request_Failures_CASWrite 46 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Failures_CASWrite_m1_rate) > 0 47 | for: 1m 48 | labels: 49 | severity: warning 50 | annotations: 51 | description: 'Number of lightweight transaction writes that failed.' 52 | 53 | - alert: Client_Request_Failures_CASRead 54 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Failures_CASRead_m1_rate) > 0 55 | for: 1m 56 | labels: 57 | severity: warning 58 | annotations: 59 | description: 'Number of lightweight transaction reads that failed.' 60 | 61 | - alert: ClientRequest_Timeouts_CASWrite 62 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Timeouts_CASWrite_m1_rate) > 0 63 | for: 1m 64 | labels: 65 | severity: warning 66 | annotations: 67 | description: 'Number of lightweight transaction writes that timed out.' 68 | 69 | - alert: ClientRequest_Timeouts_CASRead 70 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Timeouts_CASRead_m1_rate) > 0 71 | for: 1m 72 | labels: 73 | severity: warning 74 | annotations: 75 | description: 'Number of lightweight transaction read that timed out.' 76 | 77 | - alert: ClientRequest_Unavailables_Write 78 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Unavailables_Write_m1_rate) > 0 79 | for: 1m 80 | labels: 81 | severity: warning 82 | annotations: 83 | description: 'Write failures have occurred because too many replicas were unavailable.' 84 | 85 | - alert: ClientRequest_Unavailables_Read 86 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Unavailables_Read_m1_rate) > 0 87 | for: 1m 88 | labels: 89 | severity: warning 90 | annotations: 91 | description: 'Read failures have occurred because too many nodes were unavailable.' 92 | 93 | - alert: ClientRequest_Timeouts_Read 94 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Timeouts_Read_m1_rate) > 0 95 | for: 1m 96 | labels: 97 | severity: warning 98 | annotations: 99 | description: 'Read timeouts signal that a timeout exception occurred during the read request. Read timeouts can occur for a variety of reasons. Some possible causes are if the query is requesting a very large amount of data at all once or if there are long server side garbage collection events occurring. This typically indicates issues with the data model or query patterns that are causing poor performance on the server. To debug, first verify in the server logs that garbage collection times are acceptable and then examine the data model and access patterns. The server side read timeout can be altered in cassandra.yaml if no other underlying cause of the timeouts can be diagnosed.' 100 | 101 | - alert: ClientRequest_Timeouts_Write 102 | expr: sum(org_apache_cassandra_metrics_ClientRequest_Timeouts_Write_m1_rate) > 0 103 | for: 1m 104 | labels: 105 | severity: warning 106 | annotations: 107 | description: 'Write timeouts signal that a timeout exception occurred during the write request. When this happens on a non-idempotent write, such as incrementing a counter, caution must be exercised by the client, as the data may or may not have been written to the table by the node. With an idempotent write, the write can simply be retried. Only batchlog writes are retried by the driver’s default retry policy. A query’s idempotence can be defined in the application. See the individual driver documentation for the API specifics. Depending on the SLAs and application requirements, the default server side write timeout may not be adequate and this value can be adjusted in the cassandra.yaml. One common case when write timeouts surface is when batches are large or span multiple partitions. To address this, consider decreasing the batch size and limiting batch writes to a single partition.' 108 | 109 | - alert: Nodes_Down 110 | expr: sum(mesos_master_frameworks_tasks_terminal{framework_name=~".*cassandra.*",task_state="task_failed"}) > 0 111 | for: 1m 112 | labels: 113 | severity: critical 114 | annotations: 115 | description: 'Cassandra node(s) down. Investigate immediately.' 116 | 117 | - alert: CurrentlyBlockedTasks_internal_MemtableFlushWriter 118 | expr: org_apache_cassandra_metrics_ThreadPools_CurrentlyBlockedTasks_internal_MemtableFlushWriter > 0 119 | for: 1m 120 | labels: 121 | severity: warning 122 | annotations: 123 | description: 'There are a number of tasks that cannot yet be queued for processing.' 124 | 125 | - alert: Cache_HitRate_KeyCache 126 | expr: org_apache_cassandra_metrics_Cache_HitRate_KeyCache < .85 127 | for: 1m 128 | labels: 129 | severity: warning 130 | annotations: 131 | description: 'Key Cache HitRate is below 85%. Please investigate.' 132 | 133 | - alert: jvm_memory_heap_usage 134 | expr: jvm_memory_heap_usage{service_name=~".*cassandra.*"} > .80 135 | for: 1m 136 | labels: 137 | severity: warning 138 | annotations: 139 | description: 'Cassandra heap usage currently greater then 80% of available capacity. Please investigate and if need be increase total capacity' 140 | 141 | - alert: Read_Latency 142 | expr: org_apache_cassandra_metrics_ClientRequest_Latency_Read_p99 > 1000 143 | for: 1m 144 | labels: 145 | severity: critical 146 | annotations: 147 | description: 'p99 Read Latency has reached 1 second. Please investigate.' 148 | 149 | - alert: Write_Latency 150 | expr: org_apache_cassandra_metrics_ClientRequest_Latency_Write_p99 > 1000 151 | for: 1m 152 | labels: 153 | severity: critical 154 | annotations: 155 | description: 'p99 Write Latency has reached 1 second. Please investigate.' 156 | 157 | - alert: Write_Requests 158 | expr: org_apache_cassandra_metrics_ClientRequest_Latency_Write_m1_rate > 1000 159 | for: 1m 160 | labels: 161 | severity: warning 162 | annotations: 163 | description: 'The number of write requests per second has reached 1000 ops/sec.' 164 | 165 | - alert: Read_Requests 166 | expr: org_apache_cassandra_metrics_ClientRequest_Latency_Read_m1_rate > 1000 167 | for: 1m 168 | labels: 169 | severity: warning 170 | annotations: 171 | description: 'The number of Read requests per second has reached 1000 ops/sec.' 172 | -------------------------------------------------------------------------------- /rules/dcos-storage.yml: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: DSS 3 | rules: 4 | - alert: Failover 5 | # If the uptime of the service is less than 300 s it likely failed over. 6 | expr: dss_sched_uptime < 300 7 | labels: 8 | severity: warning 9 | service: dcos-storage 10 | annotations: 11 | summary: DC/OS storage service failed over 12 | - alert: Disconnected 13 | # The default heartbeat interval in Mesos is 1/(15 s) = 0.067/s. 14 | expr: rate(dss_sched_events_heartbeat_process_count[5m]) < 0.05 15 | for: 5m 16 | labels: 17 | severity: critical 18 | service: dcos-storage 19 | annotations: 20 | summary: DC/OS storage service has problem connecting to master 21 | - alert: "Volume provider RECOVERY" 22 | expr: count(dss_obj_providers_recovery) > 0 23 | labels: 24 | severity: warning 25 | service: dcos-storage 26 | annotations: 27 | summary: DC/OS storage service has at least one recovering volume provider 28 | - alert: "Volume RECOVERY" 29 | expr: count(dss_obj_volumes_recovery) > 0 30 | labels: 31 | severity: warning 32 | service: dcos-storage 33 | annotations: 34 | summary: DC/OS storage service has at least one recovering volume 35 | - alert: "Device RECOVERY" 36 | expr: count(dss_obj_devices_recovery) > 0 37 | labels: 38 | severity: warning 39 | service: dcos-storage 40 | annotations: 41 | summary: DC/OS storage service has at least one recovering device 42 | - alert: "Volume provider MISSING" 43 | expr: count(dss_obj_providers_missing) > 0 44 | for: 5m 45 | labels: 46 | severity: warning 47 | service: dcos-storage 48 | annotations: 49 | summary: DC/OS storage service has at least one missing volume provider 50 | - alert: "Volume MISSING" 51 | expr: count(dss_obj_volumes_missing) > 0 52 | for: 5m 53 | labels: 54 | severity: warning 55 | service: dcos-storage 56 | annotations: 57 | summary: DC/OS storage service has at least one missing volume 58 | - alert: "Device MISSING" 59 | expr: count(dss_obj_devices_missing) > 0 60 | for: 5m 61 | labels: 62 | severity: warning 63 | service: dcos-storage 64 | annotations: 65 | summary: DC/OS storage service has at least one missing device 66 | -------------------------------------------------------------------------------- /rules/elasticsearch/elasticsearch.rules: -------------------------------------------------------------------------------- 1 | ALERT Elastic_UP 2 | IF elasticsearch_up{job="elasticsearch"} != 1 3 | FOR 120s 4 | LABELS { severity="alert", value = "{{$value}}" } 5 | ANNOTATIONS { 6 | summary = "Instance {{ $labels.instance }}: Elasticsearch instance status is not 1", 7 | description = "This server's Elasticsearch instance status has a value of {{ $value }}.", 8 | } 9 | 10 | ALERT Elastic_Cluster_Health_RED 11 | IF elasticsearch_cluster_health_status{color="red"}==1 12 | FOR 300s 13 | LABELS { severity="alert", value = "{{$value}}" } 14 | ANNOTATIONS { 15 | summary = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster {{ $labels.cluster }}", 16 | description = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster {{ $labels.cluster }}.", 17 | } 18 | 19 | ALERT Elastic_Cluster_Health_Yellow 20 | IF elasticsearch_cluster_health_status{color="yellow"}==1 21 | FOR 300s 22 | LABELS { severity="alert", value = "{{$value}}" } 23 | ANNOTATIONS { 24 | summary = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster {{ $labels.cluster }}", 25 | description = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster {{ $labels.cluster }}.", 26 | } 27 | 28 | ALERT Elasticsearch_JVM_Heap_Too_High 29 | IF elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"} > 0.8 30 | FOR 15m 31 | LABELS { severity="alert", value = "{{$value}}" } 32 | ANNOTATIONS { 33 | summary = "ElasticSearch node {{ $labels.instance }} heap usage is high", 34 | description = "The heap in {{ $labels.instance }} is over 80% for 15m.", 35 | } 36 | 37 | ALERT Elasticsearch_health_up 38 | IF elasticsearch_cluster_health_up !=1 39 | FOR 1m 40 | LABELS { severity="alert", value = "{{$value}}" } 41 | ANNOTATIONS { 42 | summary = "ElasticSearch node: {{ $labels.instance }} last scrape of the ElasticSearch cluster health failed", 43 | description = "ElasticSearch node: {{ $labels.instance }} last scrape of the ElasticSearch cluster health failed", 44 | } 45 | 46 | ALERT Elasticsearch_Too_Few_Nodes_Running 47 | IF elasticsearch_cluster_health_number_of_nodes < 3 48 | FOR 5m 49 | LABELS { severity="alert", value = "{{$value}}" } 50 | ANNOTATIONS { 51 | description="There are only {{$value}} < 3 ElasticSearch nodes running", 52 | summary="ElasticSearch running on less than 3 nodes" 53 | } 54 | 55 | ALERT Elasticsearch_Count_of_JVM_GC_Runs 56 | IF rate(elasticsearch_jvm_gc_collection_seconds_count{}[5m])>5 57 | FOR 60s 58 | LABELS { severity="warning", value = "{{$value}}" } 59 | ANNOTATIONS { 60 | summary = "ElasticSearch node {{ $labels.instance }}: Count of JVM GC runs > 5 per sec and has a value of {{ $value }}", 61 | description = "ElasticSearch node {{ $labels.instance }}: Count of JVM GC runs > 5 per sec and has a value of {{ $value }}", 62 | } 63 | 64 | ALERT Elasticsearch_GC_Run_Time 65 | IF rate(elasticsearch_jvm_gc_collection_seconds_sum[5m])>0.3 66 | FOR 60s 67 | LABELS { severity="warning", value = "{{$value}}" } 68 | ANNOTATIONS { 69 | summary = "ElasticSearch node {{ $labels.instance }}: GC run time in seconds > 0.3 sec and has a value of {{ $value }}", 70 | description = "ElasticSearch node {{ $labels.instance }}: GC run time in seconds > 0.3 sec and has a value of {{ $value }}", 71 | } 72 | 73 | ALERT Elasticsearch_json_parse_failures 74 | IF elasticsearch_cluster_health_json_parse_failures>0 75 | FOR 60s 76 | LABELS { severity="warning", value = "{{$value}}" } 77 | ANNOTATIONS { 78 | summary = "ElasticSearch node {{ $labels.instance }}: json parse failures > 0 and has a value of {{ $value }}", 79 | description = "ElasticSearch node {{ $labels.instance }}: json parse failures > 0 and has a value of {{ $value }}", 80 | } 81 | 82 | 83 | ALERT Elasticsearch_breakers_tripped 84 | IF rate(elasticsearch_breakers_tripped{}[5m])>0 85 | FOR 60s 86 | LABELS { severity="warning", value = "{{$value}}" } 87 | ANNOTATIONS { 88 | summary = "ElasticSearch node {{ $labels.instance }}: breakers tripped > 0 and has a value of {{ $value }}", 89 | description = "ElasticSearch node {{ $labels.instance }}: breakers tripped > 0 and has a value of {{ $value }}", 90 | } 91 | 92 | ALERT Elasticsearch_health_timed_out 93 | IF elasticsearch_cluster_health_timed_out>0 94 | FOR 60s 95 | LABELS { severity="warning", value = "{{$value}}" } 96 | ANNOTATIONS { 97 | summary = "ElasticSearch node {{ $labels.instance }}: Number of cluster health checks timed out > 0 and has a value of {{ $value }}", 98 | description = "ElasticSearch node {{ $labels.instance }}: Number of cluster health checks timed out > 0 and has a value of {{ $value }}", 99 | } -------------------------------------------------------------------------------- /rules/elasticsearch/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: elasticsearch 3 | rules: 4 | - alert: Elastic_UP 5 | expr: elasticsearch_up{job="elasticsearch"} != 1 6 | for: 2m 7 | labels: 8 | severity: alert 9 | value: '{{$value}}' 10 | annotations: 11 | description: This server's Elasticsearch instance status has a value of {{ $value 12 | }}. 13 | summary: 'Instance {{ $labels.instance }}: Elasticsearch instance status is 14 | not 1' 15 | - alert: Elastic_Cluster_Health_RED 16 | expr: elasticsearch_cluster_health_status{color="red"} == 1 17 | for: 5m 18 | labels: 19 | severity: alert 20 | value: '{{$value}}' 21 | annotations: 22 | description: 'Instance {{ $labels.instance }}: not all primary and replica shards 23 | are allocated in elasticsearch cluster {{ $labels.cluster }}.' 24 | summary: 'Instance {{ $labels.instance }}: not all primary and replica shards 25 | are allocated in elasticsearch cluster {{ $labels.cluster }}' 26 | - alert: Elastic_Cluster_Health_Yellow 27 | expr: elasticsearch_cluster_health_status{color="yellow"} == 1 28 | for: 5m 29 | labels: 30 | severity: alert 31 | value: '{{$value}}' 32 | annotations: 33 | description: 'Instance {{ $labels.instance }}: not all primary and replica shards 34 | are allocated in elasticsearch cluster {{ $labels.cluster }}.' 35 | summary: 'Instance {{ $labels.instance }}: not all primary and replica shards 36 | are allocated in elasticsearch cluster {{ $labels.cluster }}' 37 | - alert: Elasticsearch_JVM_Heap_Too_High 38 | expr: elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"} 39 | > 0.8 40 | for: 15m 41 | labels: 42 | severity: alert 43 | value: '{{$value}}' 44 | annotations: 45 | description: The heap in {{ $labels.instance }} is over 80% for 15m. 46 | summary: ElasticSearch node {{ $labels.instance }} heap usage is high 47 | - alert: Elasticsearch_health_up 48 | expr: elasticsearch_cluster_health_up != 1 49 | for: 1m 50 | labels: 51 | severity: alert 52 | value: '{{$value}}' 53 | annotations: 54 | description: 'ElasticSearch node: {{ $labels.instance }} last scrape of the 55 | ElasticSearch cluster health failed' 56 | summary: 'ElasticSearch node: {{ $labels.instance }} last scrape of the ElasticSearch 57 | cluster health failed' 58 | - alert: Elasticsearch_Too_Few_Nodes_Running 59 | expr: elasticsearch_cluster_health_number_of_nodes < 3 60 | for: 5m 61 | labels: 62 | severity: alert 63 | value: '{{$value}}' 64 | annotations: 65 | description: There are only {{$value}} < 3 ElasticSearch nodes running 66 | summary: ElasticSearch running on less than 3 nodes 67 | - alert: Elasticsearch_Count_of_JVM_GC_Runs 68 | expr: rate(elasticsearch_jvm_gc_collection_seconds_count[5m]) > 5 69 | for: 1m 70 | labels: 71 | severity: warning 72 | value: '{{$value}}' 73 | annotations: 74 | description: 'ElasticSearch node {{ $labels.instance }}: Count of JVM GC runs 75 | > 5 per sec and has a value of {{ $value }}' 76 | summary: 'ElasticSearch node {{ $labels.instance }}: Count of JVM GC runs > 77 | 5 per sec and has a value of {{ $value }}' 78 | - alert: Elasticsearch_GC_Run_Time 79 | expr: rate(elasticsearch_jvm_gc_collection_seconds_sum[5m]) > 0.3 80 | for: 1m 81 | labels: 82 | severity: warning 83 | value: '{{$value}}' 84 | annotations: 85 | description: 'ElasticSearch node {{ $labels.instance }}: GC run time in seconds 86 | > 0.3 sec and has a value of {{ $value }}' 87 | summary: 'ElasticSearch node {{ $labels.instance }}: GC run time in seconds 88 | > 0.3 sec and has a value of {{ $value }}' 89 | - alert: Elasticsearch_json_parse_failures 90 | expr: elasticsearch_cluster_health_json_parse_failures > 0 91 | for: 1m 92 | labels: 93 | severity: warning 94 | value: '{{$value}}' 95 | annotations: 96 | description: 'ElasticSearch node {{ $labels.instance }}: json parse failures 97 | > 0 and has a value of {{ $value }}' 98 | summary: 'ElasticSearch node {{ $labels.instance }}: json parse failures > 0 99 | and has a value of {{ $value }}' 100 | - alert: Elasticsearch_breakers_tripped 101 | expr: rate(elasticsearch_breakers_tripped[5m]) > 0 102 | for: 1m 103 | labels: 104 | severity: warning 105 | value: '{{$value}}' 106 | annotations: 107 | description: 'ElasticSearch node {{ $labels.instance }}: breakers tripped > 108 | 0 and has a value of {{ $value }}' 109 | summary: 'ElasticSearch node {{ $labels.instance }}: breakers tripped > 0 and 110 | has a value of {{ $value }}' 111 | - alert: Elasticsearch_health_timed_out 112 | expr: elasticsearch_cluster_health_timed_out > 0 113 | for: 1m 114 | labels: 115 | severity: warning 116 | value: '{{$value}}' 117 | annotations: 118 | description: 'ElasticSearch node {{ $labels.instance }}: Number of cluster health 119 | checks timed out > 0 and has a value of {{ $value }}' 120 | summary: 'ElasticSearch node {{ $labels.instance }}: Number of cluster health 121 | checks timed out > 0 and has a value of {{ $value }}' 122 | -------------------------------------------------------------------------------- /rules/kafka/kafka-rules.yml: -------------------------------------------------------------------------------- 1 | 2 | groups: 3 | - name: Kafka_Alerts 4 | rules: 5 | - alert: Offline_Partiton_Count 6 | expr: sum(kafka_controller_KafkaController_OfflinePartitionsCount{executor_name="kafka"})by(service_name) > 0 7 | for: 1m 8 | labels: 9 | severity: critical 10 | annotations: 11 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }} partitons offline' 12 | description: 'After successful leader election, if the leader for partition dies, then the partition moves to the OfflinePartition state. Offline partitions are not available for reading and writing. Restart the brokers, if needed, and check the logs for errors.' 13 | 14 | - alert: Under_Replicated_Partition_Count 15 | expr: sum(kafka_server_ReplicaManager_UnderReplicatedPartitions{executor_name="kafka"})by(service_name) > 0 16 | for: 1m 17 | labels: 18 | severity: critical 19 | annotations: 20 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }} under replicated partitons' 21 | description: 'Under-replicated partitions means that one or more replicas are not available. This is usually because a broker is down. Restart the broker, and check for errors in the logs.' 22 | 23 | - alert: Active_Controller 24 | expr: sum(kafka_controller_KafkaController_ActiveControllerCount{executor_name="kafka"})by(service_name) != 1 25 | for: 1m 26 | labels: 27 | severity: critical 28 | annotations: 29 | summary: 'Kafka {{ $labels.service_name }}: No active controller' 30 | description: 'No broker in the cluster is reporting as the active controller in the last 1 minute interval. During steady state there should be only one active controller per cluster.' 31 | 32 | - alert: Unclean_Leader_Election 33 | expr: max(kafka_controller_ControllerStats_UncleanLeaderElectionsPerSec_5MinuteRate{executor_name="kafka"})by(service_name) != 0 34 | for: 1m 35 | labels: 36 | severity: critical 37 | annotations: 38 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }} unclean leader elections' 39 | description: '{{ $value }} unclean partition leader elections in the cluster reported in the last 1 minute interval. When unclean leader election is held among out-of-sync replicas, there is a possibility of data loss if any messages were not synced prior to the loss of the former leader. So if the number of unclean elections is greater than 0, investigate broker logs to determine why leaders were re-elected, and look for WARN or ERROR messages. Consider setting the broker configuration parameter unclean.leader.election.enable to false so that a replica outside of the set of in-sync replicas is never elected leader.' 40 | 41 | - alert: ISR_Expand_Rate 42 | expr: sum(kafka_server_ReplicaManager_IsrExpandsPerSec_5MinuteRate)by(service_name) != 0 43 | for: 1m 44 | labels: 45 | severity: warning 46 | annotations: 47 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }} ISR Expansion Rate' 48 | description: 'If a broker goes down, ISR for some of the partitions shrink. When that broker is up again, ISRs are expanded once the replicas are fully caught up. Other than that, the expected value for ISR expansion rate is 0. If ISR is expanding and shrinking frequently, adjust Allowed replica lag.' 49 | 50 | - alert: ISR_Shrink_Rate 51 | expr: sum(kafka_server_ReplicaManager_IsrShrinksPerSec_5MinuteRate)by(service_name) != 0 52 | for: 1m 53 | labels: 54 | severity: warning 55 | annotations: 56 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }} ISR Shrink Rate' 57 | description: 'If a broker goes down, ISR for some of the partitions shrink. When that broker is up again, ISRs are expanded once the replicas are fully caught up. Other than that, the expected value for ISR shrink rate is 0. If ISR is expanding and shrinking frequently, adjust Allowed replica lag.' 58 | 59 | - alert: Broker_Count 60 | expr: count(kafka_server_KafkaServer_BrokerState{executor_name="kafka"})by(service_name) == 0 61 | for: 1m 62 | labels: 63 | severity: critical 64 | annotations: 65 | summary: 'Kafka {{ $labels.service_name }}: No Brokers online!' 66 | description: 'Broker count is 0' 67 | 68 | - alert: Network_Processor_Idle_Percent 69 | expr: avg(sum(kafka_network_Processor_IdlePercent{executor_name="kafka"})by(service_name, task_name))by(service_name) < 0.3 70 | for: 1m 71 | labels: 72 | severity: critical 73 | annotations: 74 | summary: 'Kafka {{ $labels.service_name }}: Network Processor Idle Percent is {{ $value }}!' 75 | description: 'The average fraction of time the network processors are idle. A lower value {{ $value }} indicates that the network workload of the broker is very high.' 76 | 77 | - alert: Request_Handler_Idle_Percent 78 | expr: avg(kafka_server_KafkaRequestHandlerPool_RequestHandlerAvgIdlePercent_meanRate)by(service_name) < 0.3 79 | for: 1m 80 | labels: 81 | severity: critical 82 | annotations: 83 | summary: 'Kafka {{ $labels.service_name }}: Request Handler Idle Percent is {{ $value }}!' 84 | description: 'The average fraction of time the request handler threads (IO) are idle. A lower value {{ $value }} indicates that the workload of a broker is very high.' 85 | 86 | - alert: Replica_Fetcher_Manager_Max_Lag 87 | expr: avg(kafka_server_ReplicaFetcherManager_MaxLag)by(service_name) > 50 88 | for: 1m 89 | labels: 90 | severity: critical 91 | annotations: 92 | summary: 'Kafka {{ $labels.service_name }}: Replica Fetcher Manager Max Lag is {{ $value }}!' 93 | description: 'The maximum lag between the time that messages are received by the leader replica and by the follower replicas.' 94 | 95 | - alert: Topic_Count 96 | expr: count(count by (topic,service_name) (kafka_server_BrokerTopicMetrics_MessagesInPerSec_5MinuteRate{executor_name="kafka"}))by(service_name) > 1000 97 | for: 5m 98 | labels: 99 | severity: warning 100 | annotations: 101 | summary: 'Kafka {{ $labels.service_name }}: 1000 topics reached' 102 | description: 'The number of active topics in the cluster has reached 1000.' 103 | 104 | - alert: Request_Queue_Time_Max 105 | expr: max(kafka_network_RequestMetrics_RequestQueueTimeMs_mean{executor_name="kafka"})by(service_name) > 100 106 | for: 1m 107 | labels: 108 | severity: warning 109 | annotations: 110 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }}ms request queue time' 111 | description: 'Max request queue time exceeded 100ms for a request. It is the time, in milliseconds, that a request currently spends in the request queue.' 112 | 113 | - alert: Response_Queue_Time_Max 114 | expr: max(kafka_network_RequestMetrics_ResponseQueueTimeMs_mean{executor_name="kafka"})by(service_name) > 100 115 | for: 1m 116 | labels: 117 | severity: warning 118 | annotations: 119 | summary: 'Kafka {{ $labels.service_name }}: {{ $value }}ms response queue time' 120 | description: 'Max response queue time exceeded 100ms for a request. It is the length of time, in milliseconds, that the request waits in the response queue.' 121 | 122 | - alert: Zookeeper_Sync_Connect 123 | expr: avg(kafka_server_SessionExpireListener_ZooKeeperSyncConnectsPerSec_count{executor_name="kafka"})by(service_name) < 1 124 | for: 1m 125 | labels: 126 | severity: warning 127 | annotations: 128 | summary: 'Kafka {{ $labels.service_name }}: Zookeeper Sync Disconected' 129 | description: 'Zookeeper Sync Disconected' 130 | -------------------------------------------------------------------------------- /rules/telegraf.yml: -------------------------------------------------------------------------------- 1 | groups: 2 | - name: Telegraf 3 | rules: 4 | - alert: HighErrorRate 5 | expr: job:internal_agent_gather_errors:mean5m > 10 6 | for: 10m 7 | labels: 8 | severity: critical 9 | annotations: 10 | summary: Telegraf is failing to gather metrics 11 | 12 | --------------------------------------------------------------------------------