---
layout: docs
title: OMD Multisite
---

How to setup Multisite with OMD
===============================

== Introduction

=== What is OMD?
The OMD Labs-Edition is a monitoring platform and a new concept of how to install,
maintain and update a monitoring system built on Nagios. It contains most monitoring
related components from labs.consol.de and others useful addons from companioned authors.
It is not another linux distribution, instead it integrates well in your current
system in form of a single rpm or deb package.

=== What use is a multisite?

If you are a service provider that monitors hosts and services for several clients, you
can host each clients' monitoring site on a single server. With OMD you can easily manipulate
several aspects of each clients' site without affect the site of another client. This also
allows you to create accounts for the client user without having to expose data for
organizations that they do not belong to.

=== What will this article cover?

This article will cover the bare-minimal basics of installing OMD on CentOS 7, creating a
"master" Thruk site, two client sites, and creating read-only users for those sites.
PLEASE NOTE: This is not meant to be an all-inclusive guide to using OMD, Thruk, or guide
for best practices in this given scenario. This is simply meant to share one of many solutions
to the commonly asked question: "How do I expose Thruk to a client without exposing data
belonging to other clients?"


== Installing and configuring OMD on CentOS 7

=== Installation

The installation instructions for OMD are straight forward:

[source,bash]
----
# OMD requires some dependencies found in EPEL
yum -y install epel-release
# Install the OMD repo
rpm -Uvh "https://labs.consol.de/repo/stable/rhel7/i386/labs-consol-stable.rhel7.noarch.rpm"
# Install OMD
yum -y install omd
# Thruk will not work with SELinux, so we will go ahead and disable it
setenforce 0
sed -i.bak 's/enforcing/disabled/' /etc/selinux.config
----

=== Creating and starting sites

We will effortlessly create three OMD sites -- one for the "master" site, and two client sites.
We will call the master site `ABCmsp` and the clients will be called `ClientA` and `ClientB`.

[source,bash]
omd create abcmsp
omd create clienta
omd create clientb

This will create 3 sites for us:
`https://localhost/abcmsp`
`https://localhost/clienta`
`https://localhost/clientb`

Before navigating to the sites, we will need to start them:
[source,bash]
omd start abcmsp
omd start clienta
omd start clientb

When navigating to the site, substitute `localhost` for the IP or hostname of your OMD server.

=== Logging into an OMD site for the first time

From the site, you can log in with:
user: `omdadmin`
password: `omd`

PLEASE CHANGE THE DEFAULT PASSWORD!

=== Creating simple service checks

Creatin service checks is beyond the scope of this article, but we will want proof that this works.
We will log into Thruk on each site and create service check for the localhost.

Within Thruk:

`Config Tool > Object Settings > Create a new host > `
Using the following as an example, create a simple check for each site.
Be sure to hit `apply` and then `save & reload` when you are finished.

[source]
save to: /hosts.cfg
host_name: ClientAHost
alias: ClientAHost
address: 127.0.0.1
use: check_mk_host
contact_groups: check_mk

=== Configuring the Livestatus Backends

By default, OMD does not enable the Livestatus backends on a given site. We can easily enable the backends
with the `omd config` command, but we will first need to stop our sites.

[source,bash]
omd stop abcmsp
omd stop clienta
omd stop clientb

Afterwards, we will need to use `omd config [sitename]` TUI utility to enable Livestatus. However, it is
worth noting that for two of the sites, you will need to specify non-standard TCP ports for Livestatus.

For each site, use `omd config [sitename], go to `Distributed Monitoring`,`LIVESTATUS_TCP` (accept the
warning and stop the site if prompted), and specify the `LIVESTATUS_TCP_PORT`. Exit the config tool.

After we restart our sites, we can use the Thruk UI to add the backends to our `abcmsp` site:
Go to `Config Tool` > `Backend / Sites` > `add new connection`.
For the `name` and `section` fields, use the client name. Leave the `type` as livestatus,
and for the connection use `127.0.0.1:6558` and `127.0.0.1:6559` -- or whichever ports you
opted to use -- and then save the changes.

=== Creating Read-Only Users for Thruk

We can create our Apache users and Thruk authorized users within Thruk:

`Config Tool` > `User settings` > type a new username in the `username` field > specify a password,
and leave all authorization settings to `no` and click `save`.

Next, we can change the `Configuration Type` in the drop-down at the top-right of the page to
`CGI & Access`. Under the `authorized_for_read_only` field, select the new user and click the
`>>` button to move them to the `selected` field.

== Conclusion

In this article, we covered some basics of OMD and Thruk to get a multi-site environment going.
It is worthing noting again: THIS IS NOT AN ALL INCLUSIVE GUIDE FOR CONFIGURING THRUK AND/OR OMD.
It is also worth noting that there are other ways to answer the question: "How do I expose Thruk
to a client without exposing data belonging to other clients?"

Containers, coupled with livestatus backends can solve this problem. Additionally, you can export
a given dashboard as a PNG file to display on a web page:
https://github.com/sni/thruk/blob/master/support/panorama2img
