{%- if pillar.influxdb.server is defined %} {%- from "influxdb/map.jinja" import server, relay, monitoring with context %} {%- if server.get('enabled', False) or relay.get('enabled') %} server: alert: {%- if server.get('http', {}).get('enabled', False) %} InfluxdbInfo: if: >- influxdb_up == 0 labels: severity: info service: influxdb annotations: {%- raw %} summary: 'InfluxDB service down' description: 'InfluxDB service is down on node {{ $labels.host }}' {%- endraw %} InfluxdbWarning: if: >- count(influxdb_up == 0) >= count(influxdb_up) * {{ monitoring.service_failed_warning_threshold_percent }} labels: severity: warning service: influxdb annotations: summary: 'More than {{monitoring.service_failed_warning_threshold_percent*100}}% of InfluxDB services are down' description: 'More than {{monitoring.service_failed_warning_threshold_percent*100}}% of InfluxDB services are down' InfluxdbCritical: if: >- count(influxdb_up == 0) >= count(influxdb_up) * {{ monitoring.service_failed_critical_threshold_percent }} labels: severity: critical service: influxdb annotations: summary: 'More than {{monitoring.service_failed_critical_threshold_percent*100}}% of InfluxDB services are down' description: 'More than {{monitoring.service_failed_critical_threshold_percent*100}}% of InfluxDB services are down' InfluxdbDown: if: >- count(influxdb_up == 0) == count(influxdb_up) labels: severity: down service: influxdb annotations: summary: 'All InfluxDB services are down' description: 'All InfluxDB services are down' InfluxdbSeriesNumberHigh: {%- set influx_max_series_threshold = monitoring.max_series_percentage * server.data.max_series_per_database / 100 %} if: >- influxdb_database_numSeries >= {{ influx_max_series_threshold }} labels: severity: warning service: influxdb annotations: {% raw %} summary: 'InfluxDB high number of series for {{ $labels.database }}' description: 'The InfluxDB {{ $labels.database }} database is getting close to the maximum number of series (value={{ $value }}{%- endraw %},threshold={{ influx_max_series_threshold }}).' InfluxdbSeriesNumberTooHigh: if: >- influxdb_database_numSeries >= {{ server.data.max_series_per_database }} labels: severity: critical service: influxdb annotations: {% raw %} summary: 'InfluxDB too many series for {{ $labels.database }}' description: 'The InfluxDB {{ $labels.database }} database has exceeded the maximum number of series (value={{ $value }}{%- endraw %},threshold={{ server.data.max_series_per_database }}).' InfluxdbHTTPClientErrors: {%- set influx_http_client_error_threshold = monitoring.http_errors_percentage %} if: >- rate(influxdb_httpd_clientError[2m]) / rate(influxdb_httpd_req[2m]) * 100 > {{ influx_http_client_error_threshold }} {% raw %} labels: severity: warning service: influxdb annotations: summary: 'Influxdb number of client errors is high' description: '{{ printf `%.1f` $value }}% of client requests are in error on {{ $labels.host }} (threshold={%- endraw %}{{ influx_http_client_error_threshold }}).' InfluxdbHTTPPointsWrittenFail: {%- set influx_http_points_written_fail_threshold = monitoring.failed_points_percentage %} if: >- rate(influxdb_httpd_pointsWrittenFail[2m]) / rate(influxdb_httpd_pointsWrittenOK[2m]) * 100 > {{ influx_http_points_written_fail_threshold }} {% raw %} labels: severity: warning service: influxdb annotations: summary: 'Influxdb too many failed writes' description: '{{ printf `%.1f` $value }}% of written points have failed on {{ $labels.host }} (threshold={%- endraw %}{{ influx_http_points_written_fail_threshold }}).' InfluxdbHTTPPointsWrittenDropped: {%- set influx_http_points_written_dropped_threshold = monitoring.dropped_points_percentage %} if: >- rate(influxdb_httpd_pointsWrittenDropped[2m]) / rate(influxdb_httpd_pointsWrittenOK[2m]) * 100 > {{ influx_http_points_written_dropped_threshold }} {% raw %} labels: severity: warning service: influxdb annotations: summary: 'Influxdb too many dropped writes' description: '{{ printf `%.1f` $value }}% of written points have been dropped on {{ $labels.host }} (threshold={%- endraw %}{{ influx_http_points_written_dropped_threshold }}).' {%- if relay.get('enabled', False) and relay.telemetry is defined and relay.telemetry.get('enabled') %} {%- set buffer_sizes = [] %} {%- for name, listen in relay.listen.iteritems()|sort %} {%- for backend_name, backend in listen.output.iteritems()|sort %} {%- do buffer_sizes.append(backend.get('buffer_size_mb', 0)|float) %} {%- endfor %} {%- endfor %} {%- set buffer_sizes = buffer_sizes|sort %} {%- set buffer_size = buffer_sizes[-1] * 1024 * 1024 %} {%- if buffer_size > 0 %} InfluxdbRelayBufferNearFull: {%- set influx_relay_buffer_size_threshold = monitoring.max_relay_buffer_percentage %} if: >- influxdb_relay_backend_buffer_bytes > {{ buffer_size }} * {{ influx_relay_buffer_size_threshold }} / 100 {% raw %} labels: severity: warning service: influxdb-relay annotations: summary: 'InfluxDB Relay buffer almost full' description: 'The buffer size for the {{ $labels.instance }}/{{ $labels.backend }} backend is getting full (current value={{ $value }} bytes, threshold={%- endraw %}{{ buffer_size * influx_relay_buffer_size_threshold / 100 }}).' {%- endif %} InfluxdbRelayFailedRequests: {%- set influx_relay_failed_requests_threshold = monitoring.relay_failed_requests_percentage %} if: >- rate(influxdb_relay_failed_requests_total[5m]) / rate(influxdb_relay_requests_total[5m]) * 100 > {{ influx_relay_failed_requests_threshold }} {% raw %} labels: severity: warning service: influxdb-relay annotations: summary: 'InfluxDB Relay too many failed requests' description: '{{ printf `%.1f` $value }}% of requests have been dropped on {{ $labels.instance }} (threshold={%- endraw %}{{ influx_relay_failed_requests_threshold }}).' {%- endif %} {%- if relay.get('enabled') and relay.telemetry.get('enabled') %} {%- set addresses = [] %} {%- if relay.telemetry.get('bind', {}).address is defined and not relay.telemetry.bind.address.startswith('127') and relay.telemetry.bind.address != '0.0.0.0' %} {%- do addresses.append(relay.telemetry.bind.address) %} {%- endif %} {%- for address in grains['fqdn_ip4'] %} {%- if not address.startswith('127') %} {%- do addresses.append(address) %} {%- endif %} {%- endfor %} target: static: influxdb_relay: enabled: true endpoint: - address: {{ addresses[0] }} port: {{ relay.telemetry.bind.port }} {%- endif %} {%- endif %} {%- endif %} {%- endif %}