---
title: "Identify hosts monitored by a collector cluster"
description: "Identifying hosts monitored by a specific collector cluster in Opsview can be done using the API query, orchestratorclusterhosts script, or a database query. The FAQ provides detailed steps for each method, including prerequisites and cautions for direct database access."
url: "https://docs.itrsgroup.com/docs/faq/opsview/4921255647261-opsview-identify-hosts-monitored-by-a-collector-cluster/index.html"
---
There are three different methods to identify all the hosts monitored by a particular [collector cluster](https://docs.itrsgroup.com/docs/faq/opsview/4920301079581-opsview-collector-cluster/index.html):

- [API query](#api-query)
- [orchestratorclusterhosts script](#orchestratorclusterhosts-script)
- [Database query](#database-query)

## API query

**Learn to use Opsview's API**

For more information about using Opsview's REST API, refer to the [Opsview API documentation](https://docs.itrsgroup.com/docs/opsview/current/rest-api/rest-api-background/api-introduction/index.html).

You can query the `monitoringcluster` endpoint to see a list of hosts assigned to a given collector cluster. This method returns both the monitored host’s name and configuration endpoint in the API, e.g.

```
{
  "name": "de-db-1000",
  "ref": "/rest/config/host/9"
}
```

### Prerequisites

- `jq` is installed

### Process

Run the following API query and pipe its output to `jq`:

```
GET 'config/monitoringcluster?s.name=<cluster_name>' | jq '.list[].monitors[]'
```

Replace `<cluster_name>` with the name of the collector cluster.

E.g. On your [orchestrator](https://docs.itrsgroup.com/docs/faq/opsview/4920429084957-opsview-orchestrator/index.html):

```
 /opt/opsview/coreutils/bin/opsview_rest --username=admin --password=initial GET 'config/monitoringcluster?s.name=<cluster_name>' | jq '.list[].monitors[]'
```

Replace `<cluster_name>` with the name of the collector cluster.

## orchestratorclusterhosts script

The `orchestratorclusterhosts` script lists monitored hosts by the collectors and clusters that monitor them. If you want to only see hosts monitored by a specific cluster, you will need to filter the script’s output.

### Prerequisites

- None

### Process

1. Log in to your [orchestrator](https://docs.itrsgroup.com/docs/faq/opsview/4920429084957-opsview-orchestrator/index.html) as `root`.
2. Run the `orchestratorclusterhosts` script

```
/opt/opsview/orchestrator/bin/orchestratorclusterhosts
```

## Database query

**Proceed with caution**

We do not recommend making any direct changes to the Opsview databases. Wherever possible, you should use the API instead.

Changes to the Opsview databases can irreparably damage your Opsview installation.

Always take appropriate backup precautions before making any direct changes to the Opsview databases.

### Prerequisites

- None

### Process

1. [Access the opsview database with the MySQL console](https://docs.itrsgroup.com/docs/faq/opsview/4921146151453-opsview-access-the-opsview-databases/index.html).
2. Run the following query to see all hosts and the clusters that monitor them:

```
SELECT hosts.name AS 'Name', hosts.ip AS 'Address', monitoringclusters.name AS 'Monitored by' FROM hosts LEFT JOIN monitoringclusters ON hosts.monitored_by = monitoringclusters.id;
```

You could extend this query to see only hosts monitored by a given cluster like this:

```
SELECT hosts.name AS 'Name', hosts.ip AS 'Address', monitoringclusters.name AS 'Monitored by' FROM hosts LEFT JOIN monitoringclusters ON hosts.monitored_by = monitoringclusters.id WHERE monitoringclusters.name = "<cluster_name>";
```

Replace `<cluster_name>` with the name of the collector cluster.


