Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Conversation

@mmiklavc
Copy link
Contributor

@mmiklavc mmiklavc commented Aug 8, 2018

Contributor Comments

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

This is piggybacking off of the Kerberos work in #1136. I took the steps I outlined in #1130 (comment), 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:

  • Is there a JIRA ticket associated with this PR? If not one needs to be created at Metron Jira.
  • Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
  • Has your PR been rebased against the latest commit within the target branch (typically master)?

For code changes:

  • Have you included steps to reproduce the behavior or problem that is being changed or addressed?

  • Have you included steps or a guide to how the change may be verified and tested manually?

  • 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 
    
  • 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:

  • 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 is set up for your personal repository such that your branches are built there before submitting a pull request.


```
export PREFIX=/usr
wget https://github.com/edenhill/librdkafka/archive/v0.11.5.tar.gz -O - | tar -xz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@justinleet
Copy link
Contributor

+1, thanks for cleaning this up, it's super helpful to have this cleanly working again, especially as the PCAP UI has been shaping up.

@asfgit asfgit closed this in 2b0060b Aug 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants