$ cd $GOPATH/src/github.com/oliver006/redis_exporter
$ go build
Loading
Loading
@@ -17,14 +18,14 @@ Locally build and run it:
You can also run it via docker:
```
```sh
$ docker pull oliver006/redis_exporter
$ docker run -d --name redis_exporter -p 9121:9121 oliver006/redis_exporter
```
Add a block to the `scrape_configs` of your prometheus.yml config file:
```
```yaml
scrape_configs:
...
Loading
Loading
@@ -35,23 +36,24 @@ scrape_configs:
...
```
and adjust the host name accordingly.
To run on Cloud Foundry, use:
```
```sh
cf push -f contrib/manifest.yml
```
#### Run on Kubernetes
### Run on Kubernetes
[Here](contrib/k8s-redis-and-exporter-deployment.yaml) is an example Kubernetes deployment configuration for how to deploy the redis_exporter as a sidecar with a Redis instance.
#### Run on Openshift
### Run on Openshift
In order to deploy the exporter on Openshift environment.
```
```sh
oc project <myproject>
oc process -f https://raw.githubusercontent.com/ivanovaleksandar/redis_exporter/master/contrib/openshift-template.yaml \
Loading
Loading
@@ -63,14 +65,16 @@ oc process -f https://raw.githubusercontent.com/ivanovaleksandar/redis_exporter/
```
*NOTE*: Some of the parameters can be ommited if no authentication is used or the default redis config is applied.
```
```sh
oc process -f https://raw.githubusercontent.com/ivanovaleksandar/redis_exporter/contrib/openshift-template.yaml \
-p REDIS_ADDR=<redis-service>:<redis-port>\
| oc create -f -
```
If you are running Prometheus on Openshift on the same cluster, **target** in `prometheus.yml` should point to the correct service name of the exporter
```
```yaml
scrape_configs:
...
Loading
Loading
@@ -82,7 +86,6 @@ scrape_configs:
...
```
### Flags
Name | Description
Loading
Loading
@@ -95,18 +98,17 @@ script | Path to Redis Lua script for gathering extra metrics.
redis.addr | Address of one or more redis nodes, comma separated, defaults to `redis://localhost:6379`.
redis.password | Password to use when authenticating to Redis
redis.alias | Alias for redis node addr, comma separated.
redis.file | Path to file containing one or more redis nodes, separated by newline. This option is mutually exclusive with redis.addr. Each line can optionally be comma-separated with the fields <addr>,<password>,<alias>.
redis.file | Path to file containing one or more redis nodes, separated by newline. This option is mutually exclusive with redis.addr. Each line can optionally be comma-separated with the fields `<addr>,<password>,<alias>`.
namespace | Namespace for the metrics, defaults to `redis`.
web.listen-address | Address to listen on for web interface and telemetry, defaults to `0.0.0.0:9121`.
web.telemetry-path | Path under which to expose metrics, defaults to `metrics`.
use-cf-bindings | Enable usage of Cloud Foundry service bindings. Defaults to `false`
Redis node addresses can be tcp addresses like `redis://localhost:6379`, `redis.example.com:6379` or unix socket addresses like `unix:///tmp/redis.sock`.<br>
Redis node addresses can be tcp addresses like `redis://localhost:6379`, `redis.example.com:6379` or unix socket addresses like `unix:///tmp/redis.sock`.\
SSL is supported by using the `rediss://` schema, for example: `rediss://azure-ssl-enabled-host.redis.cache.windows.net:6380` (note that the port is required when connecting to a non-standard 6379 port, e.g. with Azure Redis instances).
These settings take precedence over any configurations provided by [environment variables](#environment-variables).
see http://redis.io/commands/info for details.<br>
In addition, for every database there are metrics for total keys, expiring keys and the average TTL for keys in the database.<br>
You can also export values of keys if they're in numeric format by using the `-check-keys` flag. The exporter will also export the size (or, depending on the data type, the length) of the key. This can be used to export the number of elements in (sorted) sets, hashes, lists, etc.<br>
see https://redis.io/commands/info for details.\
In addition, for every database there are metrics for total keys, expiring keys and the average TTL for keys in the database.\
You can also export values of keys if they're in numeric format by using the `-check-keys` flag. The exporter will also export the size (or, depending on the data type, the length) of the key. This can be used to export the number of elements in (sorted) sets, hashes, lists, etc.
If you require custom metric collection, you can provide a [Redis Lua script](https://redis.io/commands/eval) using the `-script` flag. An example can be found [in the contrib folder](./contrib/sample_collect_script.lua).
### What does it look like?
Example [Grafana](http://grafana.org/) screenshots:<br>
Grafana dashboard is available on [grafana.net](https://grafana.net/dashboards/763) and/or [github.com](contrib/grafana_prometheus_redis_dashboard.json).
Loading
Loading
@@ -137,4 +140,3 @@ Grafana dashboard with host & alias selector is available on [github.com](contri
### What else?
Open an issue or PR if you have more suggestions or ideas about what to add.