Back to Opsview FAQ

Move all hosts monitored by a cluster to another cluster

This article explains how to move all the hosts monitored by a collector cluster to another collector cluster.

You may want to do this when removing a collector cluster.

API query Copied

Learn to use Opsview’s API

For more information about using Opsview’s REST API, refer to the Opsview API documentation.

Prerequisites Copied

Process Copied

  1. Log in to the orchestrator as root.
  2. Use opsview_rest to move all the hosts monitored by the original cluster to another cluster:
/opt/opsview/coreutils/bin/opsview_rest --username=<admin> --password=<password> --pretty --data-format=json get 'config/monitoringcluster?s.name=<original_cluster>' | jq '.list[].monitors[].ref' | xargs -I REF opsview_rest  --username=<admin> --password=<password> put REF --content-file=<( echo "{ monitored_by => {name => '<new_cluster>'} }")

Replace the variables in angle brackets (<>) according to the following table:

Variable Value
<admin> Username of an administrator user
<password> Administrator user’s password
<original_cluster> Name of the original collector cluster
<new_cluster> Name of the new collector cluster

This query works by getting the host configuration endpoints of all the hosts monitored by <original_cluster> and then updating them to be monitored by <new_cluster>.

  1. Apply Changes.

Database Copied

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 Copied

Process Copied

  1. Access the opsview database using the MySQL console.
  2. Identify the id of the cluster currently monitoring the hosts:
SELECT * FROM monitoringclusters where name = '<original_cluster_name>\G

Replace <original_cluster_name> with the name of the cluster currently monitoring the hosts.

  1. Identify the id of the cluster you want to move the hosts to:
SELECT * FROM monitoringclusters where name = '<new_cluster_name>\G

Replace <new_cluster_name> with the name of the cluster you want to monitor the hosts.

  1. Update the monitored_by field of the hosts so they are monitored by the new cluster:
UPDATE hosts SET monitored_by = <new_cluster_id> where monitored_by = <original_cluster_id>;

Replace <new_cluster_id> with the id of the new cluster. Replace <original_cluster_id> with the id of the original cluster.

  1. Apply Changes. You must Apply Changes even if you do not see a prompt to do so in the UI.
["Geneos"] ["FAQ"]

Was this topic helpful?