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

Conversation

@ottobackwards
Copy link
Contributor

@ottobackwards ottobackwards commented May 10, 2017

Contributor Comments

METRON-777 introduces metron extensions and metron parser extensions. The existing parsers have been moved to be packaged and loaded as extensions.
A maven archetype for creating parser extensions has also been created.

What is missing however is the ability to install a parser extension created outside the metron tree by the archetype into a metron system.
This PR introduces a REST api to accomplish this.

Along with that, this PR introduces a parser extension configuration type, for zookeeper that serves as a registry for installed extensions
and their default configurations. The idea being that in a follow on effort, the management UI will create a new 'instance' of a parser type
through cloning, editing and deploying these configurations. The included configurations are indexing, enrichment, parser, and elasticsearch.
There may be multiple of these configurations, as each parser extension library can contain more than one parser.

NOTE: the elasticsearch template is NOT deployed to elasticsearch at this time. Any parser created will still need a separate step for this.

One outstanding question for feedback -> The configuration tracks the parsers created out of the extension, initially. In the future this list should
have new parsers added to it when they are cloned. This would mean we would want new rest endpoints to edit the configuration ( most likely api to add parser to config {name} ) added

This PR is built on top of METRON-777, and should not be merged until METRON-777 is in, and this branched is rebased on to master.

This PR also addresses METRON-947, adding Management Stellar function support for the extension configurations

USAGE

For usage, I'll cover creating a parser and deploying it... and deleting it using the rest api.

Preparation

In order to build the parser, we need to build and install the maven plugin to build the bundles, as well as the maven archetype itself.
At this time, since they are not published to apache maven, this will be a requirement.

  • Build the bundle plugin
cd bundles-maven-plugin && mvn -q install && cd ..
  • Build the archetype
cd metron-maven-archetypes/metron-maven-parser-extension-archetype
mvn install
cd ../..

Create and build a new parser extension

  • Make a directory and cd into it
  • Create from archetype
mvn -U archetype:generate -DarchetypeCatalog=local
  • choose the org.apache.metron:metron-maven-parser-extension-archetype (Apache Maven Parser Extension Archetype for Metron) option
  • Fill out the information (information on the parameters is in the README for the archetype)
  • NOTE: at this time, the version must match the metronVersion. Maven is using version in the parent pom chain, and messing up the plugin dependency [ THIS HAS BEEN RESOLVED]
  • cd into the created directory and build the parser extension
mvn package

This will result in the tar.gz being created inside the {NAME}-parser-assembly project/target directory

start full_dev

  • run vagrant up from metron-deployment/vagrant/full_dev_platform

add a slot to storm

Open swagger

  • log into ambari on http://node1:8080
  • go into the metron service | quicklinks
  • start swagger with user | password

Install your parser

In swagger, using the parser-extension-controller

  • drop down the POST method
  • use the file selector to select the created .tar.gz
  • execute
    The extension should now be installed:
  • you should be able to use the other GET methods to review the generated configuration.
    • the configuration will have the extensionID to use for the other {name} operations
  • you should be able to view the installed files in hdfs/apps/metron/patterns/{parsername}, hdfs/apps/metron/extensions_alt_lib/

Start the parser using rest

Still in swagger

  • Use the Kafka Controller and the Storm Controller to create a {parserName} topic, and start a storm job for {parserName}
  • In the storm UI you should see the storm instance for the parser
    You should be able to verify using the rest api and the various controllers that the configurations are there and the topics exist and the storm jobs as well

Uninstall your parser

  • STOP and DELETE the Storm topology and Kafka Topic

In swagger, using the parser-extension-controller

  • drop down the DELETE method
  • fill in the name parameter with the extensionID from the config
  • exectute

When complete you should see that the various configurations are all gone, along with the patterns and other things from hdfs

Because this is on METRON-777 the changed file list remains huge.
The main changes here are those in the metron-interface directories
As well as those in the metron-common configuration

In github, select all changes from 2f9cf0d onwards.

Testing Stellar

  • create and install an extension as above then:

Run Stellar

[vagrant@node1 ~]$ /usr/metron/0.4.1/bin/stellar  -z node1:2181

Run the command:

CONFIG_GET('PARSER_EXTENSION', 'metron-parser-nice-assembly-0_4_1')

verify that the configuration return matches what you would see in the rest client
if you executed Parser Extension Controller : get /api/v1/ext/parsers/{name} -> name = metron-parser-nice-assembly-0_4_1

Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.
Please refer to our Development Guidelines for the complete guide to follow for contributions.
Please refer also to our Build Verification Guidelines 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.
  • [ 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 written or updated unit tests and or integration tests to verify your changes?

  • [x ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

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

Based on Apache Nifi Nars

NAR changes
* new lib , rebrand to bundles from NAR
* port to VFS/FileObject from File based
* ability to set property values
* Rework FileUtils so that you can derive and override
* added initializers to set 'classes' that we care about instead of hard coding them, still needs defaults
* added components nec. for integration tests ( do not want dep. on metron-* )
* VFSClassloader for NarClassLoader
* Hdfs based integration test version of unpacknars tests
* HDFS ( filesystem ) based fileutilities to cover for writes to hdfs, since VFS is currently R/O HDFS
* modified plugin to support configuration of outputs
* use class index not service loader ( both subclass and annotated supported )

Archetype
* Parser Extension archetyp
* incudes all configuration
* creates tar.gz with bundle and configuration
* class index support ( automatic generation )

Extensions
* new extensions modules
* parser
* archetype built module for each parser type
* support for configuration only parsers with tests

Parsers
* moved all but json, csv, grok to extensions
* Bolt now loads from bundle properties

Deployment
* rpms for parsers
* create extension directories
* ambari initializes zookeeper per parser
* amabri creates hdfs directories
* ISSUE: Writing to hdfs

Rest-API
* only test against parsers in metron-parsers
* still needs integration
… it is when running from archetype, causing the extension versio to be used for this dependency
…n, including bundle information

The goal is to have enough information to fill out a configuration object that is in zk, that will allow
for some kind of removal/uninstall of a parser
Needs more tests, but this should allow implmementation of delete()
At this time, the location of the hdfs grok directory is hard coded to the default
If it is changed in ambari, this will not work.
fixed bug where we were calling wrong function in ConfigurationUtils
change ConfigurationType to allow changing zookeeper root
generate a new extension name, must not have 0.0.0 version at end...
will be the archive.tar.gz file name, with . -> _ and dropping the archive.tar.gz
this foo-0.4.0-archive.tar.gz -> foo-0_5_0  as the extension name
the call works, but I cannot get the jsonpath verification right
a single statement works in a verification tool, but not here
…pattern dir for hdfs

Be sure to rollback on install exception, and delete grok dir for installed parsers
…en out in master.

Instead - do not delete kafka topic or storm topology, since this service doesn't create
them.
…om METRON-947, no reason to maintain two prs
@ottobackwards
Copy link
Contributor Author

I am closing this in preparation for feature branch

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