-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
154 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
|
||
SNMP collector through an Asyncio event loop | ||
============================================ | ||
|
||
Setup using docker | ||
------------------ | ||
|
||
Up and build docker container: | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: bash | ||
docker-compose up --build -d | ||
Without docker: | ||
--------------- | ||
|
||
Install requirements: | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: bash | ||
pip install -r requirements.txt | ||
Run by downloading or cloning the repository: | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: bash | ||
python __main__.py | ||
Config your desire OID(s) and metrics: | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: bash | ||
nano config/cofig.json | ||
Setup through ``pip`` | ||
------------------------- | ||
|
||
.. code-block:: bash | ||
pip install simple-snmp-collector pyserial easydict pysnmp==4.4.9 async-timeout uvloop | ||
Configuration | ||
^^^^^^^^^^^^^ | ||
|
||
Create a json config file with the following format: | ||
|
||
.. code-block:: | ||
[ | ||
{ | ||
"isEnable": true, | ||
"name": "snmp-model-1", | ||
"address": "192.168.1.120", | ||
"port": 161, | ||
"timeout": 1, | ||
"retries": 3, | ||
"version": 2, | ||
"sleep_time": 5, | ||
"community": "public", | ||
"metrics": [ | ||
{ | ||
"isEnable": true, | ||
"tag_name": "a-sample", | ||
"oid": "1.3.6.13.4.1.3.1112" | ||
} | ||
], | ||
"meta_data": [{'key': 'value'}] | ||
} | ||
] | ||
Run | ||
^^^ | ||
|
||
.. code-block:: bash | ||
python -m snmp_collector --config=<path-to-your-config-file.json> | ||
---- | ||
|
||
[\ **NOTE**\ ]: | ||
|
||
|
||
* If you are a Windows user and you don't want to use docker, comment out the ``uvloop`` package form ``requirements.txt`` | ||
* The value of ``-8555`` means a problem is occurred during reading data over SNMP or in connection. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
#!/usr/bin/env python | ||
|
||
from event_loop.event_loop import EventLoop | ||
from snmp_collector.event_loop import run | ||
|
||
__author__ = 'aGn' | ||
__copyright__ = "Copyright 2018, Planet Earth" | ||
|
||
|
||
if __name__ == "__main__": | ||
print('SNMP Begins') | ||
run() | ||
|
||
try: | ||
EventLoop().run_forever() | ||
|
||
except KeyboardInterrupt: | ||
import sys | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[metadata] | ||
description-file = README.md | ||
description-file = README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .event_loop import * | ||
|
||
__version__ = '1.0.0rc3' | ||
__version__ = '1.0.0' | ||
__author__ = 'aGn' | ||
__copyright__ = "Copyright 2018, Planet Earth" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python | ||
|
||
from .event_loop import run | ||
|
||
__author__ = 'aGn' | ||
__copyright__ = "Copyright 2018, Planet Earth" | ||
|
||
|
||
if __name__ == "__main__": | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters