From 1f480f5fc52e73d0468f9a2aba63a0400964e28f Mon Sep 17 00:00:00 2001 From: ioanav104 <18243119+ioanav104@users.noreply.github.com> Date: Mon, 31 Jan 2022 01:04:31 +0000 Subject: [PATCH] Make the redis connection threshold a variable for alerting (#604) * Make the redis connection threshold a variable for alerting * Specifiy redisConnectionsThreshold as string for interpolation Co-authored-by: Louis Taylor Co-authored-by: ioanav Co-authored-by: Louis Taylor --- contrib/redis-mixin/alerts/redis.libsonnet | 2 +- contrib/redis-mixin/config.libsonnet | 5 +++++ contrib/redis-mixin/mixin.libsonnet | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 contrib/redis-mixin/config.libsonnet diff --git a/contrib/redis-mixin/alerts/redis.libsonnet b/contrib/redis-mixin/alerts/redis.libsonnet index 04dd0591..5d28057a 100755 --- a/contrib/redis-mixin/alerts/redis.libsonnet +++ b/contrib/redis-mixin/alerts/redis.libsonnet @@ -30,7 +30,7 @@ }, { alert: 'RedisTooManyConnections', - expr: 'redis_connected_clients > 100', + expr: 'redis_connected_clients > %(redisConnectionsThreshold)s' % $._config, 'for': '5m', labels: { severity: 'warning', diff --git a/contrib/redis-mixin/config.libsonnet b/contrib/redis-mixin/config.libsonnet new file mode 100644 index 00000000..be231aa3 --- /dev/null +++ b/contrib/redis-mixin/config.libsonnet @@ -0,0 +1,5 @@ +{ + _config+:: { + redisConnectionsThreshold: '100', + }, +} diff --git a/contrib/redis-mixin/mixin.libsonnet b/contrib/redis-mixin/mixin.libsonnet index 9ec7ae92..bfbf9cfa 100755 --- a/contrib/redis-mixin/mixin.libsonnet +++ b/contrib/redis-mixin/mixin.libsonnet @@ -1,3 +1,4 @@ (import 'alerts/redis.libsonnet') + (import 'rules/redis.libsonnet') + -(import 'dashboards/redis.libsonnet') +(import 'dashboards/redis.libsonnet') + +(import 'config.libsonnet')