1.su - shinken
shinken install livestatus
shinekn install logstore_mongodb
shinken install monodb
2.在/etc/shinken/modules中
livestatus.cfg
modules logstore-mongodb
logstore-mongodb.cfg
database shinken
collection logs
max_logs_age 3m
3. /etc/shinken/brokers/broker-master.cfg中
modules webui2,livestatus
4.systemctl restart shinken
5.在/var/log/shinken/brokerd.log中查看日志:
报错:
[1490174770] WARNING: [broker-master] Cannot import logstore-mongodb..module : cannot import name Connection
[1490174770] WARNING: [broker-master] Trying to load '/var/lib/shinken/modules/logstore-mongodb' as an (very-)old-style shinken "module" : by adding its path to sys.path. This can be (very) bad in case of name conflicts within the files part of /var/lib/shinken/modules/logstore-mongodb and others top-level python modules; I'll try to limit that.
[1490174770] ERROR: [broker-master] Could not import bare 'module.py' from /var/lib/shinken/modules/logstore-mongodb : cannot import name Connection
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Shinken-2.4.3-py2.7.egg/shinken/modulesmanager.py", line 114, in try_very_bad_load
return importlib.import_module('module')
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/var/lib/shinken/modules/logstore-mongodb/module.py", line 51, in <module>
from pymongo import Connection
ImportError: cannot import name Connection
经过搜索,结果是pymongo版本太低:升级
sudo pip install pymongo==2.7.2
and it worked!