Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
| 3 | |
| 4 | Installation |
| 5 | ============ |
| 6 | |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 7 | An environment suitable for running docker containers is recommended. |
| 8 | If that is not available, SNMPTRAP source can be downloaded and run |
| 9 | in a VM or on baremetal. |
| 10 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 11 | Both scenarios are documented below. |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 12 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 13 | As a docker container |
| 14 | --------------------- |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 15 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 16 | **trapd** is delivered as a docker container based on python 3.6. The |
| 17 | host or VM that will run this container must have the docker application |
| 18 | loaded and available to the userID that will be running the SNMPTRAP container. |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 19 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 20 | If running from a docker container, it is assumed that *Config |
| 21 | Binding Service* has been installed and is successfully providing valid |
| 22 | configuration assets to instantiated containers as needed. |
| 23 | |
| 24 | Also required is a working DMAAP/MR environment. trapd |
| 25 | publishes traps to DMAAP/MR as JSON messages and expects the host |
| 26 | resources and publishing credentials to be included in the *Config Binding Service* |
| 27 | config. |
| 28 | |
| 29 | Installation |
| 30 | ^^^^^^^^^^^^ |
| 31 | |
| 32 | The following command will download the latest trapd container from |
| 33 | nexus and launch it in the container named "trapd": |
| 34 | |
| 35 | ``docker run --detach -t --rm -p 162:6162/udp -P --name=trapd nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.snmptrap ./bin/snmptrapd.sh start`` |
| 36 | |
| 37 | Running an instance of **trapd** will result in arriving traps being published |
| 38 | to the topic specified by Config Binding Services. |
| 39 | |
| 40 | Standalone |
| 41 | ---------- |
| 42 | |
| 43 | **trapd** can also be run outside of a container environment, without CBS interactions. |
| 44 | If CBS is not present, SNMPTRAP will look for a JSON configuration file specified via the |
| 45 | environment variable CBS_SIM_JSON at startup. Location of this file should be specified |
| 46 | as a relative path from the <SNMPTRAP base directory>/bin directory. E.g. |
| 47 | |
| 48 | Installation |
| 49 | ^^^^^^^^^^^^ |
| 50 | |
| 51 | Prerequisites |
| 52 | """"""""""""" |
| 53 | |
| 54 | trapd requires the following to run in a non-docker environment: |
| 55 | |
| 56 | - Python 3.6+ |
| 57 | - Python module “pysnmp” 4.4.5 |
| 58 | - Python module “requests” 2.18.3 |
| 59 | |
| 60 | To install prerequisites: |
| 61 | |
| 62 | ``export PATH=<path to Python 3.6 binary>:$PATH`` |
| 63 | |
| 64 | ``pip3 install requests==2.18.3`` |
| 65 | |
| 66 | ``pip3 install pysnmp==4.4.5`` |
| 67 | |
| 68 | Download latest trapd version from Gerrit |
| 69 | """"""""""""""""""""""""""""""""""""""""" |
| 70 | |
| 71 | Download a copy of the latest trapd image from gerrit in it's standard runtime location: |
| 72 | |
| 73 | ``cd /opt/app`` |
| 74 | |
| 75 | ``git clone ssh://<your linux foundation id>@gerrit.onap.org:29418/dcaegen2/collectors/snmptrap snmptrap`` |
| 76 | |
| 77 | "Un-dockerize" |
| 78 | """""""""""""" |
| 79 | |
| 80 | ``mv /opt/app/snmptrap/snmptrap /opt/app/snmptrap/bin`` |
| 81 | |
| 82 | Configure for your environment |
| 83 | """""""""""""""""""""""""""""" |
| 84 | |
| 85 | In a non-docker environment, ONAP trapd is controlled by a locally hosted JSON configuration file. It is |
| 86 | referenced in the trapd startup script as: |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 87 | |
| 88 | .. code-block:: bash |
| 89 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 90 | CBS_SIM_JSON=../etc/snmptrapd.json |
| 91 | |
| 92 | |
| 93 | This file should be in the exact same format is the response from CBS in a fully implemented container/controller environment. A sample file is included with source/container images, at: |
| 94 | |
| 95 | .. code-block:: bash |
| 96 | |
| 97 | /opt/app/snmptrap/etc/snmptrapd.json |
| 98 | |
| 99 | Make applicable changes to this file - typically things that will need to change include: |
| 100 | |
| 101 | .. code-block:: bash |
| 102 | |
| 103 | "topic_url": "http://localhost:3904/events/ONAP-COLLECTOR-SNMPTRAP" |
| 104 | |
| 105 | Action: Change 'localhost' and topic name (ONAP-COLLECTOR-SNMPTRAP) to desired values in your environment. |
| 106 | |
| 107 | .. code-block:: bash |
| 108 | |
| 109 | "snmpv3_config" (needed only when SNMPv3 agents are present) |
| 110 | |
| 111 | Action: Add/delete/modify entries as needed to align with SNMP agent configurations in a SNMPv3 environment. |
| 112 | |
| 113 | Start the application |
| 114 | """"""""""""""""""""" |
| 115 | |
| 116 | ``nohup /opt/app/snmptrap/bin/snmptrapd.sh start > /opt/app/snmptrap/logs/snmptrapd.out 2>&1 &`` |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 117 | |