---
title: "Moving Hosts between Collector Clusters at the command line"
description: "Moving hosts between Collector Clusters can be done via the command line on the Opsview Orchestrator using the move\\device\\between\\servers script. After moving hosts, run Apply Changes to update Collection Plan files and ensure monitoring continuity."
url: "https://docs.itrsgroup.com/docs/faq/opsview/12835700144925-opsview-moving-hosts-between-collector-clusters-at-the-command-line/index.html"
---
It is possible to move one or more devices between Collector Clusters via the command line on the Orchestrator.

- Script name: move\_device\_between\_servers

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

**Prerequisites**

- Opsview support scripts must be installed on the orchestrator: `[Opsview - Install support scripts](https://docs.itrsgroup.com/docs/faq/opsview/4922901644445-opsview-install-support-scripts/index.html)`

- Ensure these are up-to-date: `[Opsview - Update support scripts](https://docs.itrsgroup.com/docs/faq/opsview/4922932284445-opsview-update-support-scripts/index.html)`

**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?**

- Potentially failing over to a dormant collector cluster you may have in another site, but on the same orchestrator/installation of Opsview.

**NOTE:**[Apply Changes](https://docs.itrsgroup.com/docs/faq/opsview/4920514560797-opsview-apply-changes/index.html) must be run after the move to ensure that the [Collection Plan](https://docs.itrsgroup.com/docs/faq/opsview/4920348519197-opsview-collection-plan/index.html) 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
```


