Architecture Overview

Energy Monitor runs as a set of components built around the Naemon monitoring core. Event broker modules, a message queue and several data stores connect them. This chapter describes what runs on a standard installation, what each component does and how data moves between them.

Read it before you size a deployment or debug a check that the core executes but the interface does not show.

Components

Component

Location

Role

Naemon core

/opt/naemon

Schedules and executes checks, evaluates states, sends notifications

Naemon Livestatus

/usr/lib64/naemon/naemon-livestatus/livestatus.so

Event broker module exposing the live state of the core over a socket

LMD

service lmd

Aggregates one or more Livestatus sources into a single endpoint for the interface

Merlin

service merlind

Distributes checks between nodes and replicates state in clustered installations

Statusengine broker

/opt/statusengine/lib/libstatusengine.so

Event broker module publishing every core event to Gearman

Gearman

service gearmand, bound to 127.0.0.1

Message queue between the broker module and the worker

Statusengine worker

/opt/statusengine/worker

Consumes the queue and writes events and metrics to MySQL and OpenSearch

OpenSearch

port 9200

Stores historical events and performance metrics

MariaDB

service mariadb

Stores configuration, interface state and Merlin data

Redis

service redis

Cache

Ninja

/opt/energy-monitor/ninja

Main web interface, PHP on the Kohana framework

Nacoma

/opt/energy-monitor/nacoma

Configuration interface, writes the Naemon object configuration

Monitor API

/opt/monitor_api

REST API, Laravel, documented with Swagger

PNP4Nagios

/opt/energy-monitor/pnp

Performance graphs based on RRD, fed through npcd and rrdcached

NagVis

/opt/energy-monitor/nagvis

Status maps

BPI

/opt/energy-monitor/business

Business process modelling and SLA thresholds

CMDB

/opt/energy-monitor/cmdb

Asset inventory and risk assignment, introduced in 1.6

Intelligence

installed by the intelligence package

Backend for AI Correlations

Geomap, Topology

separate packages

Geographic and topological views

Notify

package notify

Notification integrations, among others Microsoft Teams, Discord, Jira, Slack, Telegram

Agents

/opt/agents

Build environment for the Windows and Linux monitoring agents

Apache with php-fpm

services httpd, php-fpm

Serves every web component

Data flow

Check execution

Naemon schedules and executes checks according to the object configuration in /opt/naemon/etc. The core processes each result and decides on state changes and notifications.

From the core to the interface

The Livestatus broker module exposes the current state over a socket. LMD reads that socket and presents a single endpoint to Ninja, which queries it for host and service lists, dashboards and Monitor Wall.

In a distributed installation LMD aggregates several Livestatus sources, so the interface shows a combined view without querying each node separately.

Ninja translates its own query language into Livestatus queries. The lsfilter module parses the query into an abstract syntax tree and compiles it to one of several outputs: Livestatus, SQL, PgSQL, statistics or native PHP. The same mechanism serves list views, Monitor Wall and dashboard widgets.

From the core to history and metrics

The Statusengine broker module is loaded into Naemon through /opt/naemon/etc/naemon/module-conf.d/statusengine.cfg and publishes every core event to Gearman on 127.0.0.1. The Statusengine worker consumes that queue and writes to the statusengine database in MariaDB and to OpenSearch.

The interface reads historical events, the event log and performance metrics from OpenSearch. The core holds only the current state.

Performance graphs

Performance data also goes to RRD files through npcd and rrdcached, and PNP4Nagios renders them. The Livestatus module is configured with pnp_path=/opt/energy-monitor/pnp/perfdata, which lets the interface link a service directly to its graph.

Configuration

Nacoma keeps the configuration in MariaDB and generates Naemon object files from it. The interface collects changes and applies them when you save the configuration. This is why it shows a pending change counter and a changelog.

Monitor API writes to the same configuration store. It covers configuration CRUD, /config/change, BPI, commands and the filter endpoints. Reports, graphs, the event log, dashboards, maps, the scheduler, agents, integrations, AI, CMDB and permissions have no API equivalent and are available only through the interface.

Commands from the interface

The interface writes acknowledgements, downtimes and forced checks to the Naemon external command pipe. The core picks them up on its next command cycle, so they take effect with a short delay.

Databases

Database

Used by

Contents

monitor

Ninja

Interface state: dashboards, saved filters, reports, user settings

nacoma

Nacoma

Configuration objects and the change log

merlin

Merlin

Node and distribution data

statusengine

Statusengine worker

Event and check history

The statusengine database and its user are created during installation by repo/files/statusengine.sql.

Web layer

Apache serves every component from a single virtual host under separate aliases:

Alias /monitor              /opt/energy-monitor/ninja
Alias /ninja                /opt/energy-monitor/ninja
Alias /business             /opt/energy-monitor/business
Alias /cmdb                 /opt/energy-monitor/cmdb
Alias /new_api              /opt/energy-monitor/new_api
Alias /monitor/energy/nacoma /opt/energy-monitor/nacoma
Alias /monitor/energy/pnp   /opt/energy-monitor/pnp
Alias /monitor/images       /opt/monitor/share/images
Alias /reportsImg           /opt/energy-monitor/ninja/reportsImg

The main interface embeds several components in an iframe instead of rendering them itself: Nacoma configuration forms, CMDB and the agent builder. Such a component can return an error inside the frame while the surrounding page still returns HTTP 200.

Services

An installation enables the following units:

naemon          monitoring core
merlind         distribution and replication
lmd             Livestatus aggregation
gearmand        message queue, bound to 127.0.0.1
statusengine    event and metric worker
opensearch      event and metric storage
mariadb         databases
redis           cache
httpd, php-fpm  web layer
npcd, rrdcached RRD performance data
bpi-status      BPI status service
nachos          agent and scan services
sssd            directory integration
postfix         mail delivery for notifications

The installer also enables monitor-network-autoscan.timer, which drives scheduled network discovery.

Version notes

The Statusengine worker runs on PHP 7.2 from the Remi repository, installed under /opt/remi/php72, with the gearman, igbinary and redis extensions. It talks to OpenSearch through the Elasticsearch PHP client in the 7.11 line. The web interface runs on a different PHP version.