Skip to content

Commit

Permalink
Merge pull request #222 from Sanketika-Obsrv/redis-exporter
Browse files Browse the repository at this point in the history
configured the redis-exporter helmchart
  • Loading branch information
ravismula authored Dec 24, 2024
2 parents fa3b7cb + cb903a4 commit 48d476f
Show file tree
Hide file tree
Showing 46 changed files with 2,893 additions and 2 deletions.
11 changes: 10 additions & 1 deletion helmcharts/global-resource-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -696,4 +696,13 @@ keycloak:
memory: 750Mi
requests:
cpu: 250m
memory: 512Mi
memory: 512Mi

redis-exporter:
resources:
limits:
cpu: 250m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
12 changes: 12 additions & 0 deletions helmcharts/global-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@ redis-dedup: &redis_dedup
host: &redis-url redis-dedup-headless.redis.svc.cluster.local
port: 6379

redis-exporter:
namespace: *redis-namespace
fullnameOverride: redis-exporter
serviceMonitor:
enabled: true
multipleTarget: true
targets:
- url: redis://redis-denorm-headless.redis.svc.cluster.local
name: denorm-redis
- url: redis://redis-dedup-headless.redis.svc.cluster.local
name: dedup-redis

flink: &flink
namespace: *flink_namespace
host: "flink-headless.flink.svc.cluster.local"
Expand Down
9 changes: 9 additions & 0 deletions helmcharts/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ images: &images
pullSecrets:
- *dockerSecretName

redis-exporter: &redis-exporter
repository: oliver006/redis_exporter
# Overrides the image tag whose default is the chart appVersion.
tag: "v1.66.0"
# submit-ingestion: &submit-ingestion
# registry: "docker.io"
# repository: "ubuntu"
Expand Down Expand Up @@ -405,6 +409,11 @@ internal: &internal
image:
<<: *redis

redis-exporter:
image:
<<: *redis-exporter


loki:
singleBinary:
image:
Expand Down
2 changes: 1 addition & 1 deletion helmcharts/kitchen/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ obsrvtools)
additional)
rm -rf additional
cp -rf ../obsrv additional
cp -rf ../services/{spark,system-rules-ingestor,secor,druid-exporter,postgresql-exporter,postgresql-backup,kong-ingress-routes,velero,volume-autoscaler} additional/charts/
cp -rf ../services/{spark,system-rules-ingestor,secor,druid-exporter,postgresql-exporter,redis-exporter,postgresql-backup,kong-ingress-routes,velero,volume-autoscaler} additional/charts/

# copy cloud specific helm charts
case $cloud_env in
Expand Down
14 changes: 14 additions & 0 deletions helmcharts/obsrv/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,20 @@ kube-prometheus-stack:
- target_label: __address__
replacement: s3-exporter.s3-exporter.svc.cluster.local:9340 # S3 exporter.

- job_name: 'redis_exporter_targets'
static_configs:
- targets:
- redis://redis-denorm-headless.redis.svc.cluster.local:6379
- redis://redis-dedup-headless.redis.svc.cluster.local:6379
metrics_path: /metrics
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: redis-exporter.redis.svc.cluster.local:9121


kube-state-metrics:
namespaceOverride: "monitoring"
Expand Down
21 changes: 21 additions & 0 deletions helmcharts/services/redis-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
17 changes: 17 additions & 0 deletions helmcharts/services/redis-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
appVersion: v1.66.0
description: Prometheus exporter for Redis metrics
name: redis-exporter
version: 6.8.0
home: https://github.com/oliver006/redis_exporter
sources:
- https://github.com/oliver006/redis_exporter
keywords:
- prometheus
- redis
maintainers:
- name: acondrat
email: [email protected]
- name: zanhsieh
email: [email protected]
type: application
133 changes: 133 additions & 0 deletions helmcharts/services/redis-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# prometheus-redis-exporter

Prometheus exporter for [Redis](https://redis.io/) metrics.

This chart bootstraps a [Redis exporter](https://github.com/oliver006/redis_exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.10+ with Beta APIs enabled
- Helm 3+

## Get Repository Info

```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Install Chart

```console
helm install [RELEASE_NAME] prometheus-community/prometheus-redis-exporter
```

_See [configuration](#configuration) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Chart

```console
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] [CHART] --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

### To 5.0.0

From 5.0.0 redis exporter is using the [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). Therefore you have to delete the deployment before you upgrade.

```console
kubectl delete deployment -l app=prometheus-redis-exporter
helm upgrade -i prometheus-redis-exporter prometheus-community/prometheus-redis-exporter
```

From 5.0.0 redis exporter helm chart supports multiple targets.

By enabling `serviceMonitor.multipleTarget` and settings the targets in `serviceMonitor.targets`, multiple redis instance can be scraped.

```yaml
serviceMonitor:
enabled: true
multipleTarget: true
telemetryPath: /scrape
targets:
- url: redis://my-redis:6379
name: foo
- url: redis://my-redis-cluster:6379
name: bar
additionalRelabeling:
- sourceLabels: [type]
targetLabel: type
replacement: cluster
```
### To 3.0.1
The default tag for the exporter image is now `v1.x.x`. This major release includes changes to the names of various metrics and no longer directly supports the configuration (and scraping) of multiple redis instances; that is now the Prometheus server's responsibility. You'll want to use [this dashboard](https://github.com/oliver006/redis_exporter/blob/master/contrib/grafana_prometheus_redis_dashboard.json) now. Please see the [redis_exporter GitHub page](https://github.com/oliver006/redis_exporter#upgrading-from-0x-to-1x) for more details.

## Configuring

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:

```console
helm show values prometheus-community/prometheus-redis-exporter
```

For more information please refer to the [redis_exporter](https://github.com/oliver006/redis_exporter) documentation.

### Redis Connection

- To configure Redis connection by value set `redisAddress` string (example format: `redis://myredis:6379`)
- To configure Redis connection by configmap set `redisAddressConfig.enabled` to `true`, set `redisAddressConfig.configmap.name` and `redisAddressConfig.configmap.key` values
- To configure auth by value, set `auth.enabled` to `true`, and `auth.redisPassword` value
- To configure auth by secret, set `auth.secret.name` and `auth.secret.key` values

### Using a custom LUA-Script

First, you need to deploy the script with a configmap. This is an example script from mentioned in the [redis_exporter-image repository](https://github.com/oliver006/redis_exporter/blob/master/contrib/sample_collect_script.lua)

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-redis-exporter-script
data:
script: |-
-- Example collect script for -script option
-- This returns a Lua table with alternating keys and values.
-- Both keys and values must be strings, similar to a HGETALL result.
-- More info about Redis Lua scripting: https://redis.io/commands/eval
local result = {}
-- Add all keys and values from some hash in db 5
redis.call("SELECT", 5)
local r = redis.call("HGETALL", "some-hash-with-stats")
if r ~= nil then
for _,v in ipairs(r) do
table.insert(result, v) -- alternating keys and values
end
end
-- Set foo to 42
table.insert(result, "foo")
table.insert(result, "42") -- note the string, use tostring() if needed
return result
```

If you want to use this script for collecting metrics, you could do this by just set `script.configmap` to the name of the configmap (e.g. `prometheus-redis-exporter-script`) and `script.keyname` to the configmap-key holding the script (eg. `script`). The required variables inside the container will be set automatically.
23 changes: 23 additions & 0 deletions helmcharts/services/redis-exporter/charts/common/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
12 changes: 12 additions & 0 deletions helmcharts/services/redis-exporter/charts/common/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
description: Library chart for Sunbird
keywords:
- common
- helper
- template
- function
maintainers:
- name: NimbusHub.in
name: common
type: library
version: 0.1.0
Loading

0 comments on commit 48d476f

Please sign in to comment.