# Backends

## General Information

The NagVis code is separated into several layers. One of these layers is the "data layer". The data layer is used to handle requests for information from third party sources like the Socket of MKLivestatus. We call this layer "backend" in general. There are some components inside NagVis to manage these backends which act as the glue between the single backends and the other layers.

## Default backend

At the moment there are four backends delivered with the NagVis core packages: the mklivestatus, ndomy, ndo2fs, merlinmy backend. All backend configuration parameters are described in detail below.

The ndomy backend has been the default backend from NagVis 1.0 to NagVis 1.5. It fetches Nagios information from the NDO MySQL database. Since NagVis 1.5 the default backend has been switched to MKLivestatus backend.

## Backend types

### mklivestatus backend

MKLivestatus is a very simple and smart Nagios eventbroker module. Livestatus is concepted and tuned to reduce disk, memory and cpu loads caused by live-data processing on the Nagios system. Just as NDO, Livestatus makes use of the Nagios Event Broker API and loads a binary module into the Nagios process. But other than the NDO, Livestatus does not actively write out data e.g. to the disk. Instead, it opens a socket for external applications to connect to and fetch the current status information from Nagios. For details about the new data access provider take a look at the official documentation.

Since the first NagVis 1.5 release the mklivestatus backend is included on delivery. It performs much better than all other existing backends and comes with less overhead than other backends. No additional database is needed to make this backend work.

Value | Default | Description
--- | --- | ---

socket

unix:/usr/local/nagios/var/rw/live

The socket to connect to can be a local unix socket and a tcp socket. You have to define the type at the beginning of the string. Set "unix:" for unix sockets and "tcp:" for tcp sockets.

In case of the unix socket you need to put the path of the livestatus unix socket to connect to.

When using a tcp socket you have to enter a hostaddress and a tcp port using the following scheme: <host>:<port>. The host address can be an IP-Address or a FQDN.

There are also some general parameters. You can read about them in main configuration format description.

### ndo2db MySQL backend (ndomy)

The ndo2db MySQL backend, in short ndomy backend, is used to fetch Nagios information like status and configuration data via a MySQL database. The Nagios addon called ndoutils stores all information which are present in a running Nagios in an MySQL database. This database is being queried by the NagVis ndomy backend.

You can use the following parameters to configure a ndomy backend:

Value | Default | Description
--- | --- | ---
dbhost | localhost | Hostname of the NDO Database
dbport | 3306 | Port of the NDO Database
dbname | db_nagios | Name of the NDO Database
dbuser | root | Username for Database Access (only needs read permissions)
dbpass | root | Password for Database Access (only needs read permissions)
dbprefix | nagios_ | Prefix of the tables in NDO Database (like defined in ndo2db.cfg)
dbinstancename | default | Name of the Nagios instance in NDO Database (like defined in ndomod.cfg)
maxtimewithoutupdate | 180 | Maximum delay in seconds after last update in NDO. NagVis will report Nagios is not running if the delay is reached

There are also some general parameters. You can read about them in main configuration format description.

### ndo2fs backend

Value | Default | Description
--- | --- | ---
path | /usr/local/ndo2fs/var | Path to the ndo2fs var directory. The files in this directory should be ndo2fs.pid, VOLATILE and PERSISTENT.
instancename | default | Name of the backend instance.
maxtimewithoutupdate | 180 | Maximum delay in seconds after last update in NDO. NagVis will report Nagios is not running if the delay is reached

There are also some general parameters. You can read about them in main configuration format description.

### Other backend types

FIXME: Hint to other backends (Create own, 3rd party backends, ...).

## Configuring backends

The backends are defined in the main configuration file. See main configuration format description on how to define backends.