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 | Administration |
| 5 | ============== |
| 6 | |
| 7 | Processes |
| 8 | --------- |
| 9 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 10 | **trapd** runs as a single (python) process inside (or outside) the container. You can monitor it using the commands documented below. |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 11 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 12 | *NOTE:* Familiarity with docker environments is assumed below - for example, if you stop a running instance of snmptrapd that was started using the default snmptrapd docker configuration, the container itself will exit. Similarly, if you start an instance of snmptrapd inside a container, it will not run in the background (this is a dependency/relationship between docker and the application -> if the command registered to run the service inside the container terminates, it is assumed that the application has failed and docker will terminate the container itself). |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 13 | |
| 14 | Actions |
| 15 | ------- |
| 16 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 17 | Starting snmptrapd |
| 18 | ^^^^^^^^^^^^^^^^^^ |
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 | The **trapd** service can be started by running the command: |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 21 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 22 | ``/opt/app/snmptrap/bin/snmptrapd.sh start`` |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 23 | |
| 24 | Output from this command will be two-fold. First will be the textual response: |
| 25 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 26 | .. code-block:: bash |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 27 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 28 | 2018-10-16T15:14:59,461 Starting snmptrapd... |
| 29 | 2018-10-16T19:15:01,966 ONAP controller not present, trying json config override via CBS_SIM_JSON env variable |
| 30 | 2018-10-16T19:15:01,966 ONAP controller override specified via CBS_SIM_JSON: ../etc/snmptrapd.json |
| 31 | 2018-10-16T19:15:01,973 ../etc/snmptrapd.json loaded and parsed successfully |
| 32 | 2018-10-16T19:15:02,038 load_all_configs|snmptrapd||||INFO|100||current config logged to : /opt/app/snmptrap/tmp/current_config.json |
| 33 | 2018-10-16T19:15:02,048 snmptrapd.py : ONAP SNMP Trap Receiver version 1.4.0 starting |
| 34 | 2018-10-16T19:15:02,049 arriving traps logged to: /opt/app/snmptrap/logs/snmptrapd_arriving_traps.log |
| 35 | 2018-10-16T19:15:02,050 published traps logged to: /opt/app/snmptrap/logs/DMAAP_unauthenticated.ONAP-COLLECTOR-SNMPTRAP.json |
| 36 | |
| 37 | *NOTE:* This command will remain in the foreground for reasons explained above. |
| 38 | |
| 39 | Checking Status |
| 40 | ^^^^^^^^^^^^^^^ |
| 41 | |
| 42 | The **trapd** container can be monitored for status by running this command from inside the container: |
| 43 | |
| 44 | ``/opt/app/snmptrap/bin/snmptrapd.sh status`` |
| 45 | |
| 46 | If **SNMPTRAPD** is present/running, output from this command will be: |
| 47 | |
| 48 | .. code-block:: bash |
| 49 | |
| 50 | 2018-10-16T15:01:47,705 Status: snmptrapd running |
| 51 | ucsnmp 16109 16090 0 Oct08 ? 00:07:16 python ./snmptrapd.py |
| 52 | |
| 53 | and the return code presented to the shell upon exit: |
| 54 | |
| 55 | 0 -> if command executed successfully and the process was found |
| 56 | 1 -> if the command failed, and/or the process is not running |
| 57 | |
| 58 | ``$ echo $?`` |
| 59 | |
| 60 | ``0`` |
| 61 | |
| 62 | If **trapd** is not present, output from this command will be: |
| 63 | |
| 64 | .. code-block:: bash |
| 65 | |
| 66 | 2018-10-16T15:10:47,815 PID file /opt/app/snmptrap/tmp/snmptrapd.py.pid does not exist or not readable - unable to check status of snmptrapd |
| 67 | 2018-10-16T15:10:47,816 Diagnose further at command line as needed. |
| 68 | |
| 69 | and the return code presented to the shell upon exit: |
| 70 | |
| 71 | ``$ echo $?`` |
| 72 | |
| 73 | ``1`` |
| 74 | |
| 75 | |
| 76 | Stopping trapd |
| 77 | ^^^^^^^^^^^^^^ |
| 78 | |
| 79 | **trapd** can be stopped by running the command: |
| 80 | |
| 81 | ``/opt/app/snmptrap/bin/snmptrapd.sh stop`` |
| 82 | |
| 83 | Output from this command will be two-fold. First will be the textual response: |
| 84 | |
| 85 | .. code-block:: bash |
| 86 | |
| 87 | 2018-10-16T15:10:07,808 Stopping snmptrapd PID 16109... |
| 88 | 2018-10-16T15:10:07,810 Stopped |
| 89 | |
| 90 | Second will be the return code presented to the shell upon exit: |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 91 | |
| 92 | 0 - if command executed successfully |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 93 | 1 - if the request to stop failed |
| 94 | |
| 95 | ``$ echo $?`` |
| 96 | |
| 97 | ``0`` |
Rich Bennett | 9847631 | 2018-08-25 10:43:15 -0400 | [diff] [blame] | 98 | |
| 99 | |
Ladue, David (dl3158) | bb89689 | 2018-10-16 16:29:58 -0400 | [diff] [blame] | 100 | Other commands of interest |
| 101 | -------------------------- |
| 102 | |
| 103 | Checking for snmptrapd inside a container |
| 104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 105 | |
| 106 | ``ps -ef | grep snmptrap.py | grep -v grep`` |
| 107 | |
| 108 | |
| 109 | Checking for snmptrapd outside the container |
| 110 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 111 | |
| 112 | ``docker exec -it <container name> ps -ef | grep snmptrap.py | grep -v grep`` |