Back to Opsview FAQ

Moving Hosts between Collector Clusters at the command line

It is possible to move one or more devices between Collector Clusters via the command line on the Orchestrator.

Note, it is usually quicker and easier to use the Bulk Edit option in UI => MenuBar => Configuration => Hosts

Prerequisites

Solution

## /opt/opsview/supportscripts/bin/move_device_between_servers [-h]
Usage:
    move_device_between_servers [-?hV] <FROM> <TO>  <device> [...]

Options:
    --help, -?, -h
        Display basic help

    --man
        Display man page

    --debug [0-9], --debug [--debug [...]]
        Enable debugging mode (using more than once increases verbosity, or
        specify a level explicitly to a maximum of level 8)

    --version, -V
        Show version information

Arguments:
    <FROM>
        Monitoring server to move the device from

    <TO>
        Monitoring server to move the device to

    <device> [...]
        One or more devices to move from "FROM" to "TO". Can use 'ALL' to
        move everything

Why would I use this?

NOTE:Apply Changes must be run after the move to ensure that the Collection Plan files for each collector are updated and monitoring is not affected.

Working Example

View your host configuration:

## /opt/opsview/orchestrator/venv3/bin/orchestratorclusterhosts
Cluster 'Master Monitoring Server', Collector 'Master' (hosts=1)
  Host: opsview              id=1 object_id=3   last_update=3m:55s

Cluster 'collector-cluster-test-1', Collector 'col-1' (hosts=5)
  Host: host-example-1       id=2 object_id=142 last_update=3m:55s
  Host: host-example-2       id=3 object_id=184 last_update=6m:14s
  Host: host-example-3       id=6 object_id=238 last_update=40s
  Host: host-example-4       id=7 object_id=270 last_update=1m:48s
  Host: host-example-5       id=8 object_id=280 last_update=4m:0s

Cluster 'collector-cluster-test-2', Collector 'col-2' (hosts=1)
  Host: host-example-6       id=4 object_id=234 last_update=20s

Oldest host: host-example-2  id=3 last_update=6m:14s
Totals: hosts=7 clusters=3 collectors=3

From the above configuration, use the support script to move host host-example-5 from cluster collector-cluster-test-1 to collector-cluster-test-2

## /opt/opsview/supportscripts/bin/move_device_between_servers "collector-cluster-test-1" "collector-cluster-test-2" host-example-5
WARN - Amended host-example-5 to be monitored by collector-cluster-test-2

Update the config and validate the changes (command line example):

# sudo -iu opsview rc.opsview gen_config
{'success': True, 'message': 'Finished'}
## /opt/opsview/orchestrator/venv3/bin/orchestratorclusterhosts
Cluster 'Master Monitoring Server', Collector 'Master' (hosts=1)
  Host: opsview              id=1 object_id=3   last_update=3m:55s

Cluster 'collector-cluster-test-1', Collector 'col-1' (hosts=4)
  Host: host-example-1       id=2 object_id=142 last_update=3m:55s
  Host: host-example-2       id=3 object_id=184 last_update=6m:14s
  Host: host-example-3       id=6 object_id=238 last_update=40s
  Host: host-example-4       id=7 object_id=270 last_update=1m:48s

Cluster 'collector-cluster-test-2', Collector 'col-2' (hosts=2)
  Host: host-example-5       id=8 object_id=280 last_update=4m:0s
  Host: host-example-6       id=4 object_id=234 last_update=20s

Oldest host: host-example-2  id=3 last_update=6m:14s
Totals: hosts=7 clusters=3 collectors=3

It is also possible to move all hosts of a single cluster by using the ALL option.

## /opt/opsview/supportscripts/bin/move_device_between_servers "collector-cluster-test-1" "collector-cluster-test-2" ALL
["Geneos"] ["FAQ"]

Was this topic helpful?