# To enable Opensearch cluster monitoring using performance analyzer

**URL:** <https://forum.opensearch.org/t/to-enable-opensearch-cluster-monitoring-using-performance-analyzer/19669>\
**Category:** OpenSearch\
**Tags:** troubleshoot, configure\
**Created:** [June 3, 2024, 6:16am UTC](https://forum.opensearch.org/t/to-enable-opensearch-cluster-monitoring-using-performance-analyzer/19669 "2024-06-03T06:16:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mangesh.mathe.9](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@mangesh.mathe.9](https://forum.opensearch.org/u/mangesh.mathe.9)\
**Post date:** [June 3, 2024, 6:16am UTC](https://forum.opensearch.org/t/to-enable-opensearch-cluster-monitoring-using-performance-analyzer/19669/1 "2024-06-03T06:16:24Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
Opensearch 2.13.0

**Describe the issue** :

I’m trying to enable cluster monitoring using Performance analyzer.

I can see I have the opensearch-performance-analyzer plugin and service.  
Also , did change the performance-analyzer.properties and started opensearch-performance-analyzer.service (started)  
But could not be able to get the metrics using API

GET myhostname:9600/\_plugins/\_performanceanalyzer/metrics/units

could you please suggest If I missed something to configure.

**Configuration** :

```auto
# ======================== OpenSearch performance analyzer plugin config =========================

# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.

# Metrics data location
metrics-location = /dev/shm/performanceanalyzer/

# Metrics deletion interval (minutes) for metrics data.
# Interval should be between 1 to 60.
metrics-deletion-interval = 1

# If set to true, the system cleans up the files behind it. So at any point, we should expect only 2
# metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving
# the files and wouldn't like for them to be cleaned up.
cleanup-metrics-db-files = true

# WebService exposed by App's port
webservice-listener-port = 9600

# Port for RPC Communication
rpc-port = 9650

# Metric DB File Prefix Path location
metrics-db-file-prefix-path = /tmp/metricsdb_

https-enabled = true

# Setup the correct path for server certificates
#certificate-file-path = specify_path
#private-key-file-path = specify_path
#trusted-cas-file-path = specify_path

# Setup the correct path for client certificates (by default, the client will just use the server certificates)
#client-certificate-file-path = specify_path
#client-private-key-file-path = specify_path
#client-trusted-cas-file-path = specify_path

# WebService bind host; default only to local interface
webservice-bind-host = 0.0.0.0

# Plugin Stats Metadata file name, expected to be in the same location
plugin-stats-metadata = plugin-stats-metadata

# Agent Stats Metadata file name, expected to be in the same location
agent-stats-metadata = agent-stats-metadata

**Relevant Logs or Screenshots** :
```

---

<div class="post-metadata">

**Author:** ![mangesh.mathe.9](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@mangesh.mathe.9](https://forum.opensearch.org/u/mangesh.mathe.9)\
**Post date:** [June 4, 2024, 11:57am UTC](https://forum.opensearch.org/t/to-enable-opensearch-cluster-monitoring-using-performance-analyzer/19669/2 "2024-06-04T11:57:07Z")

</div>

Hello @community members , Can anyone help me to enable this?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [August 23, 2024, 12:54am UTC](https://forum.opensearch.org/t/to-enable-opensearch-cluster-monitoring-using-performance-analyzer/19669/3 "2024-08-23T00:54:23Z")

</div>

@mangesh.mathe.9 There is an issue with Performance Analyzer and has been already reported in GitHub.

> <https://github.com/opensearch-project/performance-analyzer-rca/issues/545>
>
> \*\*What is the bug?\*\*
> Opensearch performance analyzer app throws exception on st…artup and is not working.
> 
> \*\*How can one reproduce the bug?\*\*
> Steps to reproduce the behavior:
> 1. Run opensearch from docker image: opensearchproject/opensearch:2.12.0 expose port 9600
> 2. GET localhost:9600/\_plugins/\_performanceanalyzer/metrics
> 3. Hangs indefinitely (aka, no response is ever returned)
> 
> 
> \*\*What is the expected behavior?\*\*
> Expected is that the webserver API on port 9600 returns a response.
> 
> \*\*What is your host/environment?\*\*
> - OS: opensearchproject/opensearch:2.12.0 
> - Version 2.12.0
> - Plugins
> 
> \*\*Do you have any additional context?\*\*
> See logs/PerformanceAnalyzer.log and notice:
> \`\`\`
> Exception in thread "main" java.lang.IllegalArgumentException: cannot add context to list
> at jdk.httpserver/sun.net.httpserver.ContextList.add(ContextList.java:37)
> at jdk.httpserver/sun.net.httpserver.ServerImpl.createContext(ServerImpl.java:276)
> at jdk.httpserver/sun.net.httpserver.HttpServerImpl.createContext(HttpServerImpl.java:74)
> at jdk.httpserver/sun.net.httpserver.HttpServerImpl.createContext(HttpServerImpl.java:39)
> at org.opensearch.performanceanalyzer.PerformanceAnalyzerApp.createClientServers(PerformanceAnalyzerApp.java:354)
> at org.opensearch.performanceanalyzer.PerformanceAnalyzerApp.createClientServers(PerformanceAnalyzerApp.java:319)
> at org.opensearch.performanceanalyzer.PerformanceAnalyzerApp.main(PerformanceAnalyzerApp.java:112)
> \`\`\`
> Checking the source code it is clear that the same handler is added twice, so the createContext functions throws an exception on the second attempt.
> Code from PerformanceAnalyzerApp.java:
> \`\`\`
> httpServer.createContext(Util.METRICS\_QUERY\_URL, queryMetricsRequestHandler);
> httpServer.createContext(
> Util.LEGACY\_OPENDISTRO\_METRICS\_QUERY\_URL, queryMetricsRequestHandler);
> \`\`\`
> The Util.METRICS\_QUERY\_URL and Util.LEGACY\_OPENDISTRO\_METRICS\_QUERY\_URL are equal.
