Installing manual - Pavel-Polyakov/trapharvester GitHub Wiki
-
$ yum -y install net-snmp net-snmp-utils $ yum -y install mysql $ yum -y install epel-release $ yum -y install rabbitmq-server $ yum -y install -y python-pip $ pip install sqlalchemy $ pip install pymysql $ pip install celery
-
-
$ mysql
-
MariaDB [(none)]> create database traps;
-
MariaDB [(none)]> CREATE USER 'flap'@'localhost' IDENTIFIED BY 'flapmyport'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . traps TO 'flap'@'localhost'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON `traps`.* TO `flap`@`localhost`; MariaDB [(none)]> FLUSH PRIVILEGES;
-
-
- Copy https://github.com/celery/celery/blob/3.1/extra/generic-init.d/celeryd into /etc/init.d/celeryd
- Make it executable
$ chmod +x /etc/init.d/celeryd
- Create /etc/default/celeryd as in example
CELERYD_NODES="worker" CELERY_BIN="/usr/local/bin/celery" CELERYD_CHDIR="/path/to/folder/containing/tasks/" CELERYD_OPTS="--time-limit=3000 --concurrency=3 -A tasks" CELERYD_LOG_FILE="/var/log/celery/%N.log" CELERYD_PID_FILE="/var/run/celery/%N.pid" CELERYD_USER="celery" CELERYD_GROUP="celery" CELERY_CREATE_DIRS=1
- Create user celery
$ sudo useradd -N -M --system -s /bin/bash celery
- Create group celery
$ sudo groupadd celery
- Add user to the group
$ sudo usermod -g celery celery
-
-
disableAuthorization yes sqlMaxQueue 10 sqlSaveInterval 0 outputOption X traphandle default /usr/local/src/trapharvester/trap_handler.py
-
$ sudo snmptrapd -fnLo &
-
-
-
$ cd /usr/local/src $ git clone http://github.com/Pavel-Polyakov/trapharvester.git $ cd trapharvester
-
$ mv config_default.py config.py
-
-
Configure it for your mysql database.
- your_username: instead 'flap'
- your_server: instead 'localhost'
- your_database: instead 'traps'
DB_URL = 'mysql+pymysql://flap:flapmyport@localhost/traps'
-
Change from and to mail-adresses
MAIL_FROM = '[email protected]' MAIL_TO = ['[email protected]','[email protected]']
-
Configure SNMP_COMMUNITY — it's needed for getting description of interface and hostname of device
SNMP_COMMUNITY = 'your_SNMP_community'
-
This parameter change only if you understand what you do
Flapping interface flaps more then FLAP_THR_COUNT in the last FLAP_THR_MINUTES
FLAP_THR_MINUTES = 15 FLAP_THR_COUNT = 20
-
Set this variable to True for receive mails in Russian
TRANSLATE = False
-
Configure it for your mysql database.
-
-
$ sudo service rabbitmq-server start $ sudo service celeryd start
Or without service just
$ /usr/bin/python /bin/celery -A tasks worker