GitHub user justinleet opened a pull request:
https://github.com/apache/incubator-metron/pull/556
METRON-903: Create a connections report in Zeppelin
## Contributor Comments
The added Zeppelin dashboard is pretty straightforward.
For each of the sensors (Bro/Snort/Yaf) and for all three as a whole,
groups everything by (ip_src_addr,ip_dst_addr) for a given range, counts it all
up, and spits out tables.
The range is provided by two fields, start and end, which are dates that
can be formatted by a user provided formatting string. e.g.
```
2017-04-28 14:19:19 -> yyyy-MM-dd HH:mm:ss
2017-04-28 -> yyyy-MM-dd
```
## Test Plan
To test, spin up full-dev. Ensure data flows through for the sensors. For
Yaf, which is not enabled by default, it'll be necessary to start the
sensor-stub
```
service sensor-stubs start yaf
```
It'll also be necessary to add Yaf to the list of sensors run in Ambari. To
do so, stop Metron, edit "Metron Parsers" to include "yaf" (or if the other
sensors already have data output, feel free to just make it "yaf" only).
Let data flow through for a little while (enough so that we can reasonable
make range filters).
Once some data has gone through, we'll need to have an instance of
Zeppelin. Because of the size of the Vagrant instance, we'll want to shut down
unneeded services. Shutdown Metron, Kibana, Storm, Kafka, and HBase.
Install Zeppelin from "Actions - Add Service". It'll prompt you to install
Spark and Hive, do so. Configuration is pretty trivial, all that's necessary
is to set an arbitrary Hive database password. Let this run. The Hive service
check likes to fail on our Vagrant, but it's benign (some impersonation
configuration issue unrelated to actually running our queries). Ignore it and
accept the installation.
From Metron's "Service Actions", run the "Zeppelin Notebook Import", to
load our notebooks into Zeppelin. Use the quick links to navigate to the
Zeppelin UI.
Go into the "Metron - Connection Report" notebook.
Each service (and the aggregate) will have something similar to the
following:
<img width="1416" alt="screen shot 2017-04-28 at 11 53 17 am"
src="https://cloud.githubusercontent.com/assets/5077341/25536613/764888ea-2c09-11e7-876f-0779cf955ee7.png">
In my case, note the second row:
```
192.168.66.1 192.168.66.121 439
```
We want to validate this range, so we can check ES and see what a count
against the same range returns
```
curl -XPOST 'node1:9200/y*/_count?pretty' -H 'Content-Type:
application/json' -d'
{
"query": {
"filtered": {
"filter": {
"and": [
{
"bool": {
"must": [
{
"term": {
"ip_src_addr": "192.168.66.1"
}
},
{
"term": {
"ip_dst_addr": "192.168.66.121"
}
}
]
}
},
{
"range": {
"timestamp": {
"gte": 1493389159000,
"lt": 1493389859000
}
}
}
]
}
}
}
}
'
```
The result is:
```
{
"count" : 439,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
}
}
```
They're the same, so we're good.
Additionally, the dates and formatting can be changed and run as well.
This exercise can be repeated across the sensors.
## Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our [Development
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
for the complete guide to follow for contributions.
Please refer also to our [Build Verification
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow
these guidelines and ask you to double check the following:
### 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-XXXX where XXXX 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 incubating-metron folder via:
```
mvn -q clean integration-test install && 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?
#### 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/justinleet/incubator-metron zepp_conn_report
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-metron/pull/556.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 #556
----
commit 612f42a8a4d03ac5e0cef086af28b0c0c69bc76a
Author: justinjleet <[email protected]>
Date: 2017-04-28T13:15:23Z
Adding Zeppelin connection report and ensuring it gets deployed by the RPMs
commit 5f56f15e0181dc022b9118039185c3b709431334
Author: justinjleet <[email protected]>
Date: 2017-04-28T16:12:50Z
Formatting Fix
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---