File Synchronisation

Introduction

There is limited support for synchronising files between peers, and between masters and pollers.

For example, when a new user has been added in OP5 Monitor on one of your masters, this function can be used to automatically synchronise the user database files on all other peers and pollers.

Prerequisites

Make sure you have already set up a either a Load-Balanced Monitoring or Distributed Monitoring environment (or a combination of which).

The configuration

Although the setup is the same configuration-wise, there are two common but different ways of synchronisation:

  • Peered masters synchronising files with one another (two-way). 
  • Masters synchronising files to pollers (one-way).

The example and the described procedure below applies to both of these cases. However, it is recommended to repeat the procedure for all peers in case of file synchronisation between peers.

Configuring the sync directive

In this example, the master will synchronise files to its poller called poller01.

The following files will be synchronised:

  • /etc/op5/auth_users.yml
  • /etc/op5/auth_groups.yml

The contents of the following directory will also be synchronised.

  • /opt/plugins/custom/

Configuration procedure

  1. Log on to the source node via SSH (in this case the master), as root.
  2. Edit the file /opt/monitor/op5/merlin/merlin.conf using a text editor:

    nano /opt/monitor/op5/merlin/merlin.conf

  3. Find the configuration block related to the destination node (in this case poller01). Within this block, a newsync sub-block is inserted.

    poller poller01 {
    hostgroup = se-gbg
    address = 192.0.2.50
    port = 15551
    takeover = no
    sync {
    /etc/op5/auth_users.yml
    /etc/op5/auth_groups.yml
    /opt/plugins/custom/
    }
    }

    The trailing slash at the end of /opt/plugins/custom/ in the example above indicates that the contents of the directory should be synchronised, rather than the directory itself. This is the recommended way of synchronising directories.

Permission limitations

The files will be synchronised using the monitor system user ? not root. This means that:

  • Files and directories set up for synchronisation must be readable and owned by the monitor user. For instance, root-only readable files cannot be synchronised.
  • All file paths and their corresponding directories, must be writable by the monitor user on the destination node.

Triggering the synchronisation

The file and directory synchronisation occurs during a configuration push, which is triggered as a new configuration is saved in the web interface. For instance, adding a new host in Monitor and then saving the configuration will trigger this.

A configuration push to pollers is only triggered if the new configuration affects objects on the poller. A manual configuration push can be triggered using the command: asmonitor mon oconf push