From 8aeb0535b91cf4262b218df86a95ce91ebe8203d Mon Sep 17 00:00:00 2001 From: Carlos Castro Date: Thu, 2 Sep 2021 17:43:26 +0100 Subject: [PATCH] chore: improve redis config and content --- .../redis-monitoring-integration.mdx | 682 +++++++++++------- 1 file changed, 437 insertions(+), 245 deletions(-) diff --git a/src/content/docs/integrations/host-integrations/host-integrations-list/redis-monitoring-integration.mdx b/src/content/docs/integrations/host-integrations/host-integrations-list/redis-monitoring-integration.mdx index d6169ccafab..34d8326c008 100644 --- a/src/content/docs/integrations/host-integrations/host-integrations-list/redis-monitoring-integration.mdx +++ b/src/content/docs/integrations/host-integrations/host-integrations-list/redis-monitoring-integration.mdx @@ -158,316 +158,508 @@ Additional notes: -## Configure the integration [#config] +## Configuration [#configuration] -An integration's YAML-format configuration is where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference. +### Enabling your Redis Server [#enable-instance] + +If you are using Redis v6+ and using ACLs to control the access to your instance, you may want to create a user specific for the integration. Use this command to creat and grant the required permissions to your user: + +``` +ACL SETUSER newrelic on >'YOUR_SELECTED_PASSWORD' ~* +INFO +CONFIG|GET +SELECT +TYPE +LLEN +SCARD +ZCOUNT +HLEN +``` + +### Configure the integration [#config] There are several ways to configure the integration, depending on how it was installed: * If enabled via Kubernetes: see [Monitor services running on Kubernetes](/docs/monitor-service-running-kubernetes). * If enabled via Amazon ECS: see [Monitor services running on ECS](/docs/integrations/host-integrations/host-integrations-list/monitor-services-running-amazon-ecs). -* If installed on-host: edit the config in the integration's YAML config file. (The [install process](#install) includes setting some of these.) - -Config commands include: +* If installed on-host: edit the config in the integration's YAML config file, `redis-config.yml`. - - - `metrics` reports the metric data and accepts the following arguments: - - * `hostname`: Redis server hostname. Default value: `localhost`. - * `port`: Port where Redis server is listening. Default value: `6379`. - * `unix_socket_path`: Unix socket path on which Redis server is listening (if set). Default value: None. - * `use_unix_socket`: Uses the `unix_socket_path` value to help you to uniquely identify the Redis instances when there are more than one on the same host using Unix sockets. Default value: `false`. - * `use_tls`: Set it to use TLS when communicating with the Redis server. - * `tls_insecure_skip_verify`: Set it to disable server name verification when connecting over TLS. - * `keys`: List of the keys for retrieving their lengths. Default value: None. See [keyspace config](#keyspace-config) for more information. - * `keys_limit`: Max number of the keys to retrieve their lengths. Default value: `30`. For more information, see [About this integration](#about) and [Keyspace metrics configuration](#keyspace-config). - * `password`: Password to use when connecting to the Redis server. Use only if your Redis server is password-protected. Default value: None. - * `config_inventory`: Set it to `false` to avoid invoking the `CONFIG GET` Redis command. This option is useful in managed environments without permissions to execute the `CONFIG` command (for example, AWS ElastiCache). Default value: `true`. - * `renamed_commands`: Tell the integration to use renamed redis-server commands over defaults. This option is useful in environments where certain redis server commands have been renamed. Example: `renamed_commands: '{"CONFIG": "XYZ"}'`. Default value: None. - - - - `inventory` captures all the Redis [configuration parameters](https://redis.io/commands/config-get), with the exception of `requirepass`. To disable the collection of inventory data, delete the inventory command from the config file. - - Note: If the `CONFIG` command in your Redis Server installation has been renamed you may need to specify `renamed_commands` argument. - +An integration's YAML-format configuration is where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference. - - If you want to see metrics related to the length of selected keys, specify the `keys` parameter in single-line JSON format in `redis-config.yml`. For example: +The configuration file has common settings applicable to all integrations like `interval`, `timeout`, `inventory_source`. To read all about these common settings refer to our [Configuration Format](/docs/create-integrations/infrastructure-integrations-sdk/specifications/host-integrations-newer-configuration-format/#configuration-basics) document. - ``` - keys: '{"0":["KEY_1"],"1":["KEY_2"]}' - ``` + + If you are still using our Legacy configuration/definition files please refer to this [document](/docs/create-integrations/infrastructure-integrations-sdk/specifications/host-integrations-standard-configuration-format/) for help. + - If your selected keys are stored only in Redis database 0, then you can set the `keys` parameter as follows: +Specific settings related to Redis are defined using the `env` section of the configuration file. These settings control the connection to your Redis instance as well as other security settings and features. The list of valid settings is described in the next section of this document. - ``` - keys: '["KEY_1","KEY_2"]' - ``` +### Redis Instance Settings [#instance-settings] - The `keys_limit` parameter defaults to `30` for performance reasons. Be aware that increasing this number could have a substantial impact on your Redis server performance. +The Redis integration collects both Metrics(**M**) and Inventory(**I**) information. Check the "**Applies To**" column below to find which settings can be used for each specific collection: - To see the keyspace metric data that is collected, see [`RedisKeyspaceSample`](#keyspace-metrics). - - + + + + + + + + + -### Activate remote monitoring [#remote-monitoring] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -The `remote_monitoring` parameter enables remote monitoring and multi-tenancy for this integration. + +
+ Setting + + Description + + Default + + Applies To +
+ **HOSTNAME** + + Redis server hostname. + + localhost + + M/I +
+ **PORT** + + Port where Redis server is listening. + + 6379 + + M/I +
+ **USERNAME** + + Username to use when connecting to the Redis server. Use only with Redis v6+ if ACL is enabled. + + N/A + + M/I +
+ **PASSWORD** + + Password to use when connecting to the Redis server. Use only with Redis servers if `REQUIREPASS` or ACL is enabled. + + N/A + + M/I +
+ **UNIX_SOCKET_PATH** + + Path to Unix socket file on which Redis server is listening. Use this instead of Hostname/Port. + + N/A + + M/I +
+ **USE_UNIX_SOCKET** + + Set to `true` to uniquely identify the monitored entities when using Unix sockets. + + false + + M/I +
+ **USE_TLS** + + Use TLS when communicating with the Redis server. + + false + + M/I +
+ **TLS_INSECURE_SKIP_VERIFY** + + Disable server name verification when connecting over TLS. + + false + + M/I +
+ **KEYS** + + List of the keys for retrieving their lengths. + + N/A + + M +
+ **KEYS_LIMIT** + + Max number of the keys to retrieve their lengths. + + 30 + + M +
+ **CONFIG_INVENTORY** + + Set to 'false' in environments where the Redis CONFIG command is not allowed (e.g. AWS, ElastiCache). + + true + + I +
+ **RENAMED_COMMANDS** + + Map of default Redis commands to their renamed form. + + N/A + + M/I +
+ **[REMOTE_MONITORING](https://docs.newrelic.com/docs/remote-monitoring-host-integrations)** + + Enable multi-tenancy monitoring. + + true + + M/I +
+ **METRICS** + + Set to `true` to enable Metrics only collection. + + false + +
+ **INVENTORY** + + Set to `true` to enable Inventory only collection. + + false + +
-Activating `remote_monitoring` may change some attributes and/or affect your configured alerts. For more information, see [remote monitoring in on-host integrations](/docs/remote-monitoring-host-integrations). +The values for these settings can be defined in several ways: +* Adding the value directly in the config file. This is the most common way. +* Replacing the values from environment variables using the `{{}}` notation. This requires infrastructure agent v1.14.0+. Read more [here](/docs/infrastructure/install-infrastructure-agent/configuration/configure-infrastructure-agent/#passthrough). +* Using Secrets management. Use this to protect sensible information such as passwords to be exposed in plain text on the configuration file. For more information, see [Secrets management](https://docs.newrelic.com/docs/integrations/host-integrations/installation/secrets-management). - - Infrastructure agent version 1.2.25 or higher is required to use `remote_monitoring`. - +### Labels/Custom Attributes [#labels] -### Environment variable passthroughs [#environment-variable] +You can further decorate your metrics using labels. Labels allow you to add key/value pairs attributes to your metrics which you can then use to query, filter or group your metrics on.
+Our default sample config file includes examples of labels but, as they are not mandatory, you can remove, modify or add new ones of your choice. -Environment variables can be used to control config settings, and are then passed through to the infrastructure agent. For instructions on how to use this feature, see [Configure the infrastructure agent](/docs/infrastructure/new-relic-infrastructure/configuration/configure-infrastructure-agent#passthrough). +``` + labels: + env: production + role: load_balancer +``` - - With secrets management, you can configure on-host integrations with New Relic infrastructure's agent to use sensitive data (such as passwords) without having to write them as plain text into the integration's configuration file. For more information, see [Secrets management](/docs/integrations/host-integrations/installation/secrets-management). - +## Example configurations [#examples] - Redis server hostname. - - - - - - - - - - - - - - - -
- Type - - String -
- Default - - localhost -
- - Example: + This is the very basic configuration to collect Metrics and Inventory from your localhost: ``` - HOSTNAME='Redis DB' + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: localhost + PORT: 6379 + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production + + - name: nri-redis + env: + INVENTORY: true + HOSTNAME: localhost + PORT: 6379 + REMOTE_MONITORING: true + interval: 60s + labels: + environment: production + inventory_source: config/redis + ``` +
+ + This configuration connects to Redis using basic authentication. Replace `my_password` with your `REQUIREPASS` password: + + ``` + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: localhost + PORT: 6379 + PASSWORD: my_password + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production + + - name: nri-redis + env: + INVENTORY: true + HOSTNAME: localhost + PORT: 6379 + PASSWORD: my_password + REMOTE_MONITORING: true + interval: 60s + labels: + environment: production + inventory_source: config/redis ``` - The port where Redis server is listening. - - - - - - - - - - - - - - - -
- Type - - Integer -
- Default - - 6379 -
- - Example: + In Redis version 6 or above you can protect your instance with [Access Control List](https://redis.io/topics/acl) (ACLs). In this scenario, use `USERNAME` and `PASSWORD` replacing their values with your correct credentials: ``` - PORT=7199 + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: localhost + PORT: 6379 + USERNAME: my_user + PASSWORD: my_password + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production + + - name: nri-redis + env: + INVENTORY: true + HOSTNAME: localhost + PORT: 6379 + USERNAME: my_user + PASSWORD: my_password + REMOTE_MONITORING: true + interval: 60s + labels: + environment: production + inventory_source: config/redis ```
- Unix socket path on which Redis server is listening (if set). - - - - - - - - - - - - - - - -
- Type - - String -
- Default - - (none) -
- - Example: + This configuration connects to Redis using TLS. You can also add `TLS_INSECURE_SKIP_VERIFY : true` to disable server name verification: ``` - UNIX_SOCKET_PATH='tpf_unix_sock.server' + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: localhost + PORT: 6379 + USE_TLS: true + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production ```
- List of the keys for retrieving their lengths. - - - - - - - - - - - - - - - -
- Type - - JSON -
- Default - - (none) -
- - Example: + This configuration connects to Redis using a socket file as an alternative to TCP Hostname/Port connection: ``` - KEYS='{"0":["KEY_1"],"1":["KEY_2"]}' + integrations: + - name: nri-redis + env: + METRICS: true + UNIX_SOCKET_PATH: /var/run/redis/redis.sock + USE_UNIX_SOCKET: true + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production ```
- Max number of the keys to retrieve their lengths. - - - - - - - - - - - - - - - -
- Type - - Integer -
- Default - - 30 -
- - Example: + This configuration shows how to collect your metrics/inventory if you have used [`rename-command`](https://redis.io/topics/security#disabling-of-specific-commands) to protect your instance: ``` - KEYS_LIMIT=50 + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: localhost + PORT: 6379 + RENAMED_COMMANDS: {"CONFIG":"b840fc9f15f59e41cb7be6c52","LLEN":"c940fc2d15f59e41cb7be6c21"} + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production + + - name: nri-redis + env: + INVENTORY: true + HOSTNAME: localhost + PORT: 6379 + RENAMED_COMMANDS: '{"CONFIG":"b840fc9f15f59e41cb7be6c52"}' + REMOTE_MONITORING: true + interval: 60s + labels: + environment: production + inventory_source: config/redis ```
- Password to use when connecting to the Redis server. - - - - - - - - - - - - - - - -
- Type - - String -
- Default - - (none) -
- - Example: + In this configuration we collect metrics from 2 different Redis servers using the the same integration. In the first instance we are collecting only `KEY_1` amd `KEY_2` from Redis database 0. If you need to collect from different databases specify them as `{"DB":"KEYS"}` as in the second instance example: ``` - PASSWORD='Hhv*$jIV' + integrations: + - name: nri-redis + env: + METRICS: true + HOSTNAME: redis_host_1 + PORT: 6379 + KEYS: '["KEY_1","KEY_2"]' + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production + + - name: nri-redis + env: + METRICS: true + HOSTNAME: redis_host_2 + PORT: 6379 + KEYS: '{"0":["KEY_1","KEY_2"],"1":["KEY_3"]}' + REMOTE_MONITORING: true + interval: 15s + labels: + environment: production ```
-
-For more about the general structure of on-host integration configuration, see [Configuration](/docs/integrations/integrations-sdk/file-specifications/host-integration-configuration-overview). + - - If you want to monitor several Redis instances from a single host you will need to duplicate the `name` block, adding arguments for your extra instances. For more information, see our [configuration file examples](/docs/create-integrations/infrastructure-integrations-sdk/specifications/host-integrations-standard-configuration-format/#config-file). - ## Find and use data [#find-and-use]