blob: d91a46b30fa9a910e352fc9f19b08ac0ef1cc75a [file] [log] [blame]
Rich Bennett98476312018-08-25 10:43:15 -04001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
3
4Installation
5============
6
Rich Bennett98476312018-08-25 10:43:15 -04007An environment suitable for running docker containers is recommended.
8If that is not available, SNMPTRAP source can be downloaded and run
9in a VM or on baremetal.
10
Ladue, David (dl3158)bb896892018-10-16 16:29:58 -040011Both scenarios are documented below.
Rich Bennett98476312018-08-25 10:43:15 -040012
Ladue, David (dl3158)bb896892018-10-16 16:29:58 -040013As a docker container
14---------------------
Rich Bennett98476312018-08-25 10:43:15 -040015
Ladue, David (dl3158)bb896892018-10-16 16:29:58 -040016**trapd** is delivered as a docker container based on python 3.6. The
17host or VM that will run this container must have the docker application
18loaded and available to the userID that will be running the SNMPTRAP container.
Rich Bennett98476312018-08-25 10:43:15 -040019
Ladue, David (dl3158)bb896892018-10-16 16:29:58 -040020If running from a docker container, it is assumed that *Config
21Binding Service* has been installed and is successfully providing valid
22configuration assets to instantiated containers as needed.
23
24Also required is a working DMAAP/MR environment. trapd
25publishes traps to DMAAP/MR as JSON messages and expects the host
26resources and publishing credentials to be included in the *Config Binding Service*
27config.
28
29Installation
30^^^^^^^^^^^^
31
32The following command will download the latest trapd container from
33nexus 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
37Running an instance of **trapd** will result in arriving traps being published
38to the topic specified by Config Binding Services.
39
40Standalone
41----------
42
43**trapd** can also be run outside of a container environment, without CBS interactions.
44If CBS is not present, SNMPTRAP will look for a JSON configuration file specified via the
45environment variable CBS_SIM_JSON at startup. Location of this file should be specified
46as a relative path from the <SNMPTRAP base directory>/bin directory. E.g.
47
48Installation
49^^^^^^^^^^^^
50
51Prerequisites
52"""""""""""""
53
54trapd 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
60To 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
68Download latest trapd version from Gerrit
69"""""""""""""""""""""""""""""""""""""""""
70
71Download 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
82Configure for your environment
83""""""""""""""""""""""""""""""
84
85In a non-docker environment, ONAP trapd is controlled by a locally hosted JSON configuration file. It is
86referenced in the trapd startup script as:
Rich Bennett98476312018-08-25 10:43:15 -040087
88.. code-block:: bash
89
Ladue, David (dl3158)bb896892018-10-16 16:29:58 -040090 CBS_SIM_JSON=../etc/snmptrapd.json
91
92
93This 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
99Make 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
105Action: 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
111Action: Add/delete/modify entries as needed to align with SNMP agent configurations in a SNMPv3 environment.
112
113Start the application
114"""""""""""""""""""""
115
116 ``nohup /opt/app/snmptrap/bin/snmptrapd.sh start > /opt/app/snmptrap/logs/snmptrapd.out 2>&1 &``
Rich Bennett98476312018-08-25 10:43:15 -0400117