5 Daemon configuration
5.1 Command line#
databbix [options]| Option | Description |
|---|---|
-h, --help |
Shows help and exits. |
-d, --daemon |
Runs in the background (daemon mode). Without this option, the log is also printed to the console. |
-n, --no-send-data |
Does not send data to the Zabbix server. Useful for testing. |
-c, --config-file f |
Global configuration file. Default: /etc/databbix/databbix.conf. |
-p, --config-path d |
Directory with the monitors’ .conf files. Default: /etc/databbix/dbs. |
-m, --module-path d |
Additional directories to search for modules. |
To try a new configuration without installing the service, the easiest way is to start the daemon in the foreground, without sending data and with a high log level (see chapter 15):
/opt/trustserver/sbin/databbix -n -c /etc/databbix/databbix.conf5.2 The databbix.conf file#
An INI file with two sections: [General] and [Log]. The values of the [Log] section and those of QueryFile and Environment are the defaults for all monitors, and each monitor can override them in its own file.
5.2.1 [General] section#
| Parameter | Description |
|---|---|
DaemonUser |
User (name or UID) the process switches to when started with -d. The process also takes that user’s supplementary groups. |
DaemonGroup |
Group (name or GID) the process switches to when started with -d. If not set, the primary group of DaemonUser is used. |
ConfigPath |
Directory of the monitor files. If present, it takes precedence over the -p option. |
QueryFile |
XML query file. The line can be repeated to load several files. Default: /etc/databbix/query.xml. |
ModulePath |
Additional module directories. Can be repeated. |
Environment |
Environment variable for the queries, of the form Name=Value. Can be repeated (see section 7.4). |
5.2.2 [Log] section#
| Parameter | Default | Description |
|---|---|---|
LogPath |
/var/log/databbix | Log directory. |
LogFile |
databbix.log | Log of the main process. |
LogLevel |
3 | Level of detail (see table 15.1). |
LogMaxSize |
0 | Maximum size in bytes before rotating. 0 disables internal rotation. |
LogMaxBackupCopies |
4 | Number of copies kept when rotating. |
MaxQueryExecTimeLog |
10 | If a query takes longer than this many seconds, a warning is logged. |
5.2.3 Example#
[General]
DaemonUser = databbix
DaemonGroup = databbix
QueryFile = /etc/databbix/query.xml
[Log]
LogPath = /var/log/databbix
LogLevel = 4
MaxQueryExecTimeLog = 10Warning. If DaemonUser is a numeric UID with no entry in /etc/passwd and DaemonGroup is not set, there is no primary group to use: the process keeps the group it was started with, which is root if it is launched as root. In that case always set DaemonGroup.
5.3 systemd service#
The bundled unit (databbix.service) starts the daemon in forking mode as the databbix user:
[Unit]
Description=Databbix Agent
After=network-online.target
Wants=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/databbix
Environment="LD_LIBRARY_PATH=/opt/trustserver/lib64"
PassEnvironment=TNS_ADMIN ODBCINI LD_LIBRARY_PATH
Type=forking
Restart=on-failure
KillMode=process
ExecStart=/opt/trustserver/sbin/databbix -c /etc/databbix/databbix.conf -d
RestartSec=10s
User=databbix
Group=databbix
[Install]
WantedBy=multi-user.targetCommon operations:
systemctl enable --now databbix # enable and start
systemctl restart databbix # apply configuration or XML changes
systemctl status databbixWarning. Databbix reads the .conf and XML files only at startup. To apply any change to them, restart the service.
5.4 Signals#
| Signal | Effect |
|---|---|
SIGTERM, SIGINT |
Orderly shutdown. Waits up to about 4 seconds for the monitors to finish. |
SIGHUP |
Reopens the log files. Used by logrotate. |
The bundled databbix.logrotate file sends SIGHUP after rotating:
/var/log/databbix/*.log
{
sharedscripts
postrotate
/usr/bin/killall -HUP databbix 2> /dev/null || true
endscript
}
When using logrotate, leave LogMaxSize = 0 so that logrotate and Databbix do not both rotate the logs.