Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pymongo3 + some fixes #19

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
597 changes: 597 additions & 0 deletions .pylintrc

Large diffs are not rendered by default.

34 changes: 23 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
language: python
python:
- "2.7"
- "2.6"

install:
- sudo apt-get update && sudo apt-get install -y python-pip libgnutls28-dev libssl-dev
- ./test/setup_module_test.sh
- pip install importlib # this is a requirement of shinken
- export PYTHONPATH=$PYTHONPATH:~/shinken # we need shinken..
- export PYTHONPATH=$PYTHONPATH:~/shinken/test
- export PYTHONPATH=$PYTHONPATH:~/mod-livestatus/test # we also need mock_livestatus from mod-livestatus..

script:
- mongodir=$(pwd)
# tests need to run from shinken test directory for access to test config files
# (as long as the test config files are referenced with a relative path)
- cd ~/shinken/test
- nosetests -vx --with-coverage --cover-package=modules $mongodir/test
# Unit tests
- cur_dir=$PWD
- echo "Current directory '$cur_dir' ..."
- export PYTHONPATH=$PYTHONPATH:$PWD
- export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken # we also need shinken test/modules...
- export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken/test # we also need shinken test/modules...
- export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken/test/modules/livestatus # we also need mock_livestatus from mod-livestatus..
- echo "Python path '$PYTHONPATH' ..."
- cd test/tmp/shinken/test
# - pytest -vv --durations=0 --no-print-logs --cov="$cur_dir"/module --cov-config "$cur_dir"/test/.coveragerc "$cur_dir"/test/test_*.py
- pytest -vv --durations=0 --no-print-logs --cov="$cur_dir"/module --cov-report=xml --cov-config "$cur_dir"/test/.coveragerc "$cur_dir"/test/test_*.py

# Static code analysis
- cd "$cur_dir"
# -- pycodestyle (former pep8)
# E731 do not assign a lambda expression, use a def
- pycodestyle --max-line-length=120 --ignore=E402,W503,E731 --exclude='*.pyc' module
# -- pylint
- pylint --rcfile=.pylintrc -r no module
# -- pep257
# - pep257 --select=D300 alignak

after_success:
coveralls
- bash <(curl -s https://codecov.io/bash) -f test/tmp/shinken/test/coverage.xml

notifications:
email: false
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ mod-logstore-mongodb
====================

Shinken module for exporting logs to mongodb from the Livestatus module

Version compatible with pymongo V3
17 changes: 13 additions & 4 deletions etc/modules/logstore_mongodb.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
define module {
module_name logstore-mongodb
module_type logstore_mongodb
mongodb_uri mongodb://localhost/?safe=false ; Set to your value
# If you are running a MongoDB cluster (called a “replica set” in MongoDB),
# you need to specify it's name here.

mongodb_uri mongodb://localhost ; Set to your value

# If you are running a MongoDB cluster (called a "replica set" in MongoDB),
# you need to specify it's name here.
# With this option set, you can also write the mongodb_uri as a comma-separated
# list of host:port items. (But one is enough, it will be used as a seed)
# list of host:port items. (But one is enough, it will be used as a "seed")
#replica_set

# The database name (defaults: shinken)
#database

# The collection name (defaults: ls-logs)
#collection

# Maximum log age (defaults: 365 days)
# <number>[d|w|m|y] or <number>
#max_logs_age
}
Loading