I would like to share some expression about how to enable MongoDB as an archieve mode in Check Mk Raw Edition. That solution I think it is applicable also for the Enterprise.
That topic is continued of Event Console - archive events to MongoDB.
I tried many times to solve the errors from my previous topic and I did at the end.
I enable MongoDB as an archive mode on Check Mk Raw 1.6.0p18.
What you need?
- install MongoDB
- install pymongo
- add button in Event Console Settings (in the GUI) that allow you to decide what solution of archive mode you would like to use:
- change the code responsible for the connection to the MongoDB
In the official documentation of MongoDB is explained how to install it. I am using Centos8.
After the installation of MongoDB, check if it is working. I have small modification to the /etc/mongod.conf. Instead of the general path for storing the date I have changed it to - /omd/sites/instance_name/var/mongodb
And the file:
for documentation of all options, see:
where to write logging data.
Where and how to store data.
how the process runs
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
After you have installed the MongoDB, check if the service is working. Do not forget to check each file of the mongodb for the correct user and group.
The next step is to install pymongo. I did it through pip.
Next step is to add the button in Event Console Settings as it is explained in the topic attached in the beggining. After you do these 3 steps, go to the EC > Settings and select MongoDB as an archive mode, restart the instance. Most probably you will get the error that it is also visible in the attached topic and it is located in - /omd/sites/instance_name/var/log/mkeventd.log. Probably the error will - cannot connect to the MongoDB.
The next step is to change the code responsible to connect to the MongoDB.
That code is located in - /omd/sites/instance_name/lib/python/cmk/ec
And the changes you need to do:
When you are ready with that change, you can restart again the instance. If the result is the same, copy the pymongo packages to that folder - /omd/sites/instance_name/lib/python2.7/site-packages
Restart the instance again and it should work.