[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-09 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/metron/pull/1152


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-09 Thread justinleet
Github user justinleet commented on a diff in the pull request:

https://github.com/apache/metron/pull/1152#discussion_r208932022
  
--- Diff: metron-sensors/pycapa/README.md ---
@@ -76,8 +79,83 @@ General notes on the installation of Pycapa.
 python setup.py install
 ```
 
+### Centos 6
+
+* These instructions can be used directly on CentOS 6 - useful for 
developers using the Full Dev Vagrant test box.
+* Older distributions, like CentOS 6, that come with Python 2.6 installed, 
should install Python 2.7 within a virtual environment and then run Pycapa from 
within the virtual environment.
+
+1. Set up a couple environment variables.
+
+```
+PYCAPA_HOME=/opt/pycapa
+PYTHON27_HOME=/opt/rh/python27/root
+```
+
+1. Install required packages.
+
+```
+for item in epel-release centos-release-scl "@Development tools" 
python27 python27-scldevel python27-python-virtualenv libpcap-devel 
libselinux-python; do yum install -y $item; done
+```
+
+1. Setup Pycapa directory.
+
+```
+mkdir $PYCAPA_HOME && chmod 755 $PYCAPA_HOME
+```
+
+1. Create the virtualenv.
+
+```
+export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64"
+cd $PYCAPA_HOME
+${PYTHON27_HOME}/usr/bin/virtualenv pycapa-venv
+```
+
+1. Install Librdkafka at your chosen $PREFIX.
+
+```
+export PREFIX=/usr
+wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz   
-O - | tar -xz
--- End diff --

Yeah, that's exactly what I was looking for.

I did see the FAIL/ERROR messages, but I had the same experience where it 
ran as expected. I suspected it was due to initial connection setup, because 
once it started writing, it worked as expected.


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-08 Thread mmiklavc
Github user mmiklavc commented on a diff in the pull request:

https://github.com/apache/metron/pull/1152#discussion_r208745344
  
--- Diff: metron-sensors/pycapa/README.md ---
@@ -76,8 +79,83 @@ General notes on the installation of Pycapa.
 python setup.py install
 ```
 
+### Centos 6
+
+* These instructions can be used directly on CentOS 6 - useful for 
developers using the Full Dev Vagrant test box.
+* Older distributions, like CentOS 6, that come with Python 2.6 installed, 
should install Python 2.7 within a virtual environment and then run Pycapa from 
within the virtual environment.
+
+1. Set up a couple environment variables.
+
+```
+PYCAPA_HOME=/opt/pycapa
+PYTHON27_HOME=/opt/rh/python27/root
+```
+
+1. Install required packages.
+
+```
+for item in epel-release centos-release-scl "@Development tools" 
python27 python27-scldevel python27-python-virtualenv libpcap-devel 
libselinux-python; do yum install -y $item; done
+```
+
+1. Setup Pycapa directory.
+
+```
+mkdir $PYCAPA_HOME && chmod 755 $PYCAPA_HOME
+```
+
+1. Create the virtualenv.
+
+```
+export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64"
+cd $PYCAPA_HOME
+${PYTHON27_HOME}/usr/bin/virtualenv pycapa-venv
+```
+
+1. Install Librdkafka at your chosen $PREFIX.
+
+```
+export PREFIX=/usr
+wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz   
-O - | tar -xz
--- End diff --

@justinleet Let me know what you think of the most recent update. That 
should set the versions in requirements.txt. When I run it I get the following 
output:

```
(pycapa-venv)[root@node1(127.0.0.1 192.168.66.121): /opt/pycapa/pycapa]
# pip install -r requirements.txt
You are using pip version 7.1.0, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting confluent-kafka==0.11.5 (from -r requirements.txt (line 1))
Collecting pcapy==0.11.4 (from -r requirements.txt (line 2))
Collecting argparse==1.4.0 (from -r requirements.txt (line 3))
  Using cached 
https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): futures in 
/opt/pycapa/pycapa-venv/lib/python2.7/site-packages (from 
confluent-kafka==0.11.5->-r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): enum34 in 
/opt/pycapa/pycapa-venv/lib/python2.7/site-packages (from 
confluent-kafka==0.11.5->-r requirements.txt (line 1))
Installing collected packages: confluent-kafka, pcapy, argparse
Successfully installed argparse-1.4.0 confluent-kafka-0.11.5 pcapy-0.11.4

(pycapa-venv)[root@node1(127.0.0.1 192.168.66.121): 
/opt/pycapa/pycapa-venv/bin]
# pycapa --producer --kafka-topic pcap --interface eth1 --kafka-broker 
$BROKERLIST
INFO:root:Connecting to Kafka; {'bootstrap.servers': 'node1:6667', 
'group.id': 'TAAAIEXWVROR'}
INFO:root:Starting packet capture
%3|1533038296.388|FAIL|rdkafka#producer-1| [thrd:node1:6667/bootstrap]: 
node1:6667/bootstrap: Connect to ipv4#192.168.66.121:6667 failed: Connection 
refused
%3|1533038296.388|ERROR|rdkafka#producer-1| [thrd:node1:6667/bootstrap]: 
node1:6667/bootstrap: Connect to ipv4#192.168.66.121:6667 failed: Connection 
refused
%3|1533038296.388|ERROR|rdkafka#producer-1| [thrd:node1:6667/bootstrap]: 
1/1 brokers are down

^CINFO:root:Clean shutdown process started
INFO:root:Waiting for '0' message(s) to flush
INFO:root:'35' packet(s) in, '35' packet(s) out
```

I'm not sure if anyone else gets the FAIL/ERROR messages when they run 
pycapa, but it still runs as expected in spite of these errors.


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-08 Thread mmiklavc
Github user mmiklavc commented on a diff in the pull request:

https://github.com/apache/metron/pull/1152#discussion_r208742519
  
--- Diff: metron-sensors/pycapa/README.md ---
@@ -76,8 +79,83 @@ General notes on the installation of Pycapa.
 python setup.py install
 ```
 
+### Centos 6
+
+* These instructions can be used directly on CentOS 6 - useful for 
developers using the Full Dev Vagrant test box.
+* Older distributions, like CentOS 6, that come with Python 2.6 installed, 
should install Python 2.7 within a virtual environment and then run Pycapa from 
within the virtual environment.
+
+1. Set up a couple environment variables.
+
+```
+PYCAPA_HOME=/opt/pycapa
+PYTHON27_HOME=/opt/rh/python27/root
+```
+
+1. Install required packages.
+
+```
+for item in epel-release centos-release-scl "@Development tools" 
python27 python27-scldevel python27-python-virtualenv libpcap-devel 
libselinux-python; do yum install -y $item; done
+```
+
+1. Setup Pycapa directory.
+
+```
+mkdir $PYCAPA_HOME && chmod 755 $PYCAPA_HOME
+```
+
+1. Create the virtualenv.
+
+```
+export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64"
+cd $PYCAPA_HOME
+${PYTHON27_HOME}/usr/bin/virtualenv pycapa-venv
+```
+
+1. Install Librdkafka at your chosen $PREFIX.
+
+```
+export PREFIX=/usr
+wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz   
-O - | tar -xz
--- End diff --

I'm going to set the versions accordingly for these 3 in requirements.txt:

confluent_kafka
pcapy
argparse

```
# pip freeze
You are using pip version 7.1.0, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
confluent-kafka==0.11.5
enum34==1.1.6
futures==3.2.0
pcapy==0.11.4
pycapa==0.1
wheel==0.24.0
```

i.e.
```
confluent-kafka==0.11.5
pcapy==0.11.4
argparse==1.4.0
```


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-08 Thread mmiklavc
Github user mmiklavc commented on a diff in the pull request:

https://github.com/apache/metron/pull/1152#discussion_r208683126
  
--- Diff: metron-sensors/pycapa/README.md ---
@@ -76,8 +79,83 @@ General notes on the installation of Pycapa.
 python setup.py install
 ```
 
+### Centos 6
+
+* These instructions can be used directly on CentOS 6 - useful for 
developers using the Full Dev Vagrant test box.
+* Older distributions, like CentOS 6, that come with Python 2.6 installed, 
should install Python 2.7 within a virtual environment and then run Pycapa from 
within the virtual environment.
+
+1. Set up a couple environment variables.
+
+```
+PYCAPA_HOME=/opt/pycapa
+PYTHON27_HOME=/opt/rh/python27/root
+```
+
+1. Install required packages.
+
+```
+for item in epel-release centos-release-scl "@Development tools" 
python27 python27-scldevel python27-python-virtualenv libpcap-devel 
libselinux-python; do yum install -y $item; done
+```
+
+1. Setup Pycapa directory.
+
+```
+mkdir $PYCAPA_HOME && chmod 755 $PYCAPA_HOME
+```
+
+1. Create the virtualenv.
+
+```
+export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64"
+cd $PYCAPA_HOME
+${PYTHON27_HOME}/usr/bin/virtualenv pycapa-venv
+```
+
+1. Install Librdkafka at your chosen $PREFIX.
+
+```
+export PREFIX=/usr
+wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz   
-O - | tar -xz
--- End diff --

@justinleet was that as simple as using the current version of the deps and 
declaring it as `mydep==x.y.z` in requirements.txt?


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-08 Thread justinleet
Github user justinleet commented on a diff in the pull request:

https://github.com/apache/metron/pull/1152#discussion_r208657384
  
--- Diff: metron-sensors/pycapa/README.md ---
@@ -76,8 +79,83 @@ General notes on the installation of Pycapa.
 python setup.py install
 ```
 
+### Centos 6
+
+* These instructions can be used directly on CentOS 6 - useful for 
developers using the Full Dev Vagrant test box.
+* Older distributions, like CentOS 6, that come with Python 2.6 installed, 
should install Python 2.7 within a virtual environment and then run Pycapa from 
within the virtual environment.
+
+1. Set up a couple environment variables.
+
+```
+PYCAPA_HOME=/opt/pycapa
+PYTHON27_HOME=/opt/rh/python27/root
+```
+
+1. Install required packages.
+
+```
+for item in epel-release centos-release-scl "@Development tools" 
python27 python27-scldevel python27-python-virtualenv libpcap-devel 
libselinux-python; do yum install -y $item; done
+```
+
+1. Setup Pycapa directory.
+
+```
+mkdir $PYCAPA_HOME && chmod 755 $PYCAPA_HOME
+```
+
+1. Create the virtualenv.
+
+```
+export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64"
+cd $PYCAPA_HOME
+${PYTHON27_HOME}/usr/bin/virtualenv pycapa-venv
+```
+
+1. Install Librdkafka at your chosen $PREFIX.
+
+```
+export PREFIX=/usr
+wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz   
-O - | tar -xz
--- End diff --

A problem I had recently setting this up was that librdkafka had stayed the 
same, but the deps in dependencies.txt had been updated. Should we update the 
requirements.txt to avoid this getting out of sync again?


---


[GitHub] metron pull request #1152: METRON-1730: Update steps to run pycapa on Centos...

2018-08-07 Thread mmiklavc
GitHub user mmiklavc opened a pull request:

https://github.com/apache/metron/pull/1152

METRON-1730: Update steps to run pycapa on Centos 6

## Contributor Comments

https://issues.apache.org/jira/browse/METRON-1730

This is piggybacking off of the Kerberos work in 
https://github.com/apache/metron/pull/1136.  I took the steps I outlined in 
https://github.com/apache/metron/pull/1130#issuecomment-407653513, as needed 
for testing PCAP, and added them to the Pycapa README. I also fixed some href 
links that weren't working in the docbook version of the site.

To test, run through the install procedure installed in the README. Run the 
sample command provided for producing pcap data to kafka and verify records are 
being written.

## Pull Request Checklist

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
  ```
  mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [x] Have you verified the basic functionality of the build by building 
and running locally with Vagrant full-dev environment or the equivalent?

### For documentation related changes:
- [x] Have you ensured that format looks appropriate for the output in 
which it is rendered by building and verifying the site-book? If not then run 
the following commands and the verify changes via 
`site-book/target/site/index.html`:

  ```
  cd site-book
  mvn site
  ```

 Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mmiklavc/metron update-pycapa-docs

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1152.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1152


commit a1da6763b44540173718224699e8dc5b928ed072
Author: Michael Miklavcic 
Date:   2018-08-08T01:23:06Z

Update pycapa docs for Centos 6




---