> For the complete documentation index, see [llms.txt](https://docs.apica.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apica.io/observe/prometheus/windows-redis-monitoring.md).

# Windows Redis Monitoring

To monitor a Redis server running on a Windows machine, you can use a combination of Windows Exporter and Prometheus to send metrics to Apica Ascent.

This script will help you setup Redis Exporter as a service on a 64-bit Windows Machine and it requires two arguments:

* **PROMETHEUS\_CONFIG\_PATH**: the path to the Prometheus configuration file.
* **NSSM\_PATH**: the path of nssm.exe

Before running the PowerShell script, make sure you have `NSSM` and `Prometheus` installed.

To run the PowerShell script, open an administrator PowerShell and run the following command:

{% file src="/files/Gb45CheCjqdcfq5vNJLW" %}
Powershell Script to install Redis Exporter
{% endfile %}

```
.\redis-exporter-installer.ps1 -NSSM_PATH "<NSSM-path>" -PROMETHEUS_CONFIG_PATH "<Prometheus-configuration-path>"
```

> Make sure that the script finishes running successfully and the NSSM was able to start the service successfully in the end. If not, then please check the indentation in the `prometheus.yml` file.

After you are done running the script, we have to add a code block in the prometheus.yml file, and we have to restart the prometheus service using NSSM.

This code block will rename all the outgoing `redis_...` metrics to `cli_redis_...`.

```yaml
    - action: replace
      source_labels: [__name__]
      regex: 'redis_(.*)'
      target_label: __name__
      replacement: cli_redis_${1}
```

After adding this script your remote\_write section must look like this.

> NOTE: Please edit the \<APICA\_ENDPOINT> and \<HOSTNAME>.

```yaml
remote_write:
  - url: https://<APICA_ENDPOINT>/v1/receive/prometheus   # has to be replaced with APICA_ENDPOINT
    tls_config:
        insecure_skip_verify: true

    write_relabel_configs:
    - action: replace
      source_labels: [__name__]
      regex: 'redis_(.*)'
      target_label: __name__
      replacement: cli_redis_${1}

    - action: replace
      source_labels: [__name__]
      regex: (.*)
      target_label: instance
      replacement: '<HOSTNAME>'    # has to be replaced with machine hostname
```

> NOTE: Please make sure that replace `redis_(.*)` code block is placed before the `(.*)` regex code block.

Make sure that the script finishes running successfully and the NSSM was able to start the service successfully in the end. If not, then please check the indentation in the `prometheus.yml` file.

To restart the prometheus service, navigate to the directory where `nssm.exe` file is located.\
Restart the prometheus service using these 2 commands:

```powershell
> $promServiceName = (Get-Service | Where-Object {$_.Name -like "prom*"}).Name
> nssm.exe restart $promServiceName
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apica.io/observe/prometheus/windows-redis-monitoring.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
