Event Console - archive events to MongoDB

Hello,

I hit problem with MongoDB configuration.

I am using Check Mk Raw 1.6.0p9. I am trying to add MongoDB as an archive type.
I am using Centos8.

Till now:

  1. I installed MongoDB - version 4.2
    1.1 Installation is checked, the service is working
    1.2 systemctl; - mongod.service loaded active running MongoDB Database Server
    1.3 tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 2049/mongod

  2. I added the html code in - /omd/sites/tncoper/lib/python/cmk/gui/wato/mkeventd.py

Added by GBozhinov > 22/04/2020

@config_variable_registry.register
class ConfigVariableEventConsoleArchiveMode(ConfigVariable):
def group(self):
return ConfigVariableGroupEventConsoleGeneric

def domain(self):
    return ConfigDomainEventConsole

def ident(self):
    # You should find home dir of this file. For now you do not have such file.
    return "archive_mode"

def valuespec(self):
    return DropdownChoice(
        title=_("Event Console Archive Mode"),
        help=_("Storage method of EC archived events."
                 "For large amount of events (more than 1K per day) it is better to use MongoDB."
                 "Otherwise, 'the mkeventd' daemon timed out on event history search."
                 "For small instillations with a less than 1k events per day, "
                 "it is better to use default option - File"),
         choices = [('file', _("File")), ('mongodb' , _("MongoDB"))],

    )
  1. The button appeared in Event Console Settings menu. I tested changing the type, file and mongodb.
    The tests were ok.
    After I change it from the button the value is replaced in - /opt/omd/sites/tncoper/etc/check_mk/mkeventd.d/wato/global.mk

This is the variable: archive_mode = ‘mongodb’

My problem is that I got this message - The Event Console is currently not running. It is generated by
/omd/sites/tncoper/lib/python/cmk/ec/history.py

That is the function:
def _connect_mongodb(settings, mongodb):
if Connection is None:
raise Exception(‘Could not initialize MongoDB (Python-Modules are missing)’)
mongodb.connection = Connection(*_mongodb_local_connection_opts(settings))
mongodb.db = mongodb.connection.getitem(os.environ[‘OMD_SITE’])

The problem is that cannot connect with the MongoDB.

I have two working instances (1.2.8p21) where MongoDB is added manually and it is working.

mongod.conf

mongod.conf

for documentation of all options, see:

http://docs.mongodb.org/manual/reference/configuration-options/

where to write logging data.

systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log

Where and how to store data.

storage:
dbPath: /opt/omd/sites/tncoper/var/mongodb
journal:
enabled: true

engine:

wiredTiger:
engineConfig:
cacheSizeGB: 2

how the process runs

processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo

network interfaces

net:
port: 27017
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

#security:

#operationProfiling:

#replication:

#sharding:

Enterprise-Only Options

#auditLog:

#snmp:

Of course this is the error from the log file - omd/sites/tncoper/var/mkevetd.log
2020-05-07 11:59:55,328 [40] [cmk.mkeventd] FATAL ERROR: Traceback (most recent call last):
File “/omd/sites/tncoper/lib/python/cmk/ec/main.py”, line 4073, in main
StatusTableHistory.columns)
File “/omd/sites/tncoper/lib/python/cmk/ec/history.py”, line 52, in init
self.reload_configuration(config)
File “/omd/sites/tncoper/lib/python/cmk/ec/history.py”, line 57, in reload_configuration
_reload_configuration_mongodb(self)
File “/omd/sites/tncoper/lib/python/cmk/ec/history.py”, line 116, in _reload_configuration_mongodb
_update_mongodb_indexes(history._settings, history._mongodb)
File “/omd/sites/tncoper/lib/python/cmk/ec/history.py”, line 155, in _update_mongodb_indexes
_connect_mongodb(settings, mongodb)
File “/omd/sites/tncoper/lib/python/cmk/ec/history.py”, line 126, in _connect_mongodb
raise Exception(‘Could not initialize MongoDB (Python-Modules are missing)’)
Exception: Could not initialize MongoDB (Python-Modules are missing)

Can anyone help me?

I told that I fixed the problem but appeared again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.