Coder Social home page Coder Social logo

jpramos123 / eventing-integrations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from redhatinsights/eventing-integrations

0.0 1.0 0.0 234 KB

Eventing 3rd-party integrations backend

License: Apache License 2.0

Python 18.15% Groovy 2.03% Java 65.92% Shell 13.91%

eventing-integrations's Introduction

Eventing โ€“ 3rd-party Integrations

ConsoleDot events integrations with 3rd-party tools (such as Splunk) build together with Notifications.

Currently supported integrations:

  • Splunk
  • ServiceNow

Development

Prerequisites

Setup

Set HTTP Event Collector (HEC) on your (local) Splunk and copy the token. Ensure that the HEC has SSL disabled and that all tokens are enabled.

Container Image Build

$ cd splunk-quarkus
$ podman build -f Dockerfile.jvm -t quay.io/cloudservices/eventing-integrations-splunk ..

Running

Note: All integrations are connecting to Kafka defined within ACG_CONFIG listenting on platform.notifications.tocamel topic.

Switching between integrations is done through two application properties:

  • camel.main.javaRoutesIncludePattern -- selects Camel routes
    • always include **/MainRoutes*,**/ErrorHandlingRoutes*
    • and then append concrete integration selector (e.g. ,**/Splunk*)
  • integrations.component.name -- selects messages out of Kafka for this type
    • ingress route selects messages of Cloud Event type com.redhat.console.notification.toCamel.<integrations.component.name>

For specific property configuration per integration type see below.

Running Splunk Integration

Running within container:

podman run -it -e ACG_CONFIG=/cdapp/devel.json -v devel.json:/cdapp/devel.json quay.io/cloudservices/eventing-integrations-splunk

You might ommit the interative terminal options -it if you want to have it running in background (detached).

To run it locally with dev mode execute:

$ cd splunk-quarkus
$ ACG_CONFIG=./devel.json ../mvnw quarkus:dev -Dcamel.main.javaRoutesIncludePattern="**/MainRoutes*,**/ErrorHandlingRoutes*,**/Splunk*" -Dintegrations.component.name=splunk -Dquarkus.kafka.devservices.enabled=false

Running Service Now Integration

To run Service Now integration locally with dev mode execute:

$ cd splunk-quarkus
$ ACG_CONFIG=./devel.json ../mvnw quarkus:dev -Dcamel.main.javaRoutesIncludePattern="**/MainRoutes*,**/ErrorHandlingRoutes*,**/ServiceNow*" -Dintegrations.component.name=servicenow -Dquarkus.kafka.devservices.enabled=false

Trying it out

Generate a message on platform.notifications.tocamel Kafka topic.

Manually this can be achieved for example by producing a message using kafka-console-producer.sh tool from Kafka:

kafka-console-producer.sh --bootstrap-server localhost:9092 --topic platform.notifications.tocamel

Here are CloudEvent examples for testing:

Splunk event

{"specversion":"1.0","type":"com.redhat.console.notification.toCamel.splunk","source":"notifications","id":"9dc9a4b1-8868-4afc-a69d-e8723b20452c","time":"2022-02-02T14:09:55.532551Z","rh-account":"12345","data":"{\"notif-metadata\":{\"url\":\"http://localhost:8088\",\"X-Insight-Token\":\"TOKEN\",\"extras\":\"{}\"},\"account_id\":\"12345\",\"org_id\":\"67890\",\"application\":\"advisor\",\"bundle\":\"rhel\",\"context\":{},\"event_type\":\"new-recommendation\",\"timestamp\":\"2022-02-02T14:09:55.344612\",\"events\":[{\"some\":\"eventdata\"}]}"}

ServiceNow event

{"specversion":"1.0","type":"com.redhat.console.notification.toCamel.servicenow","source":"notifications","id":"9dc9a4b1-8868-4afc-a69d-e8723b20452c","time":"2022-02-02T14:09:55.532551Z","rh-account":"12345","data":"{\"notif-metadata\":{\"url\":\"http://localhost:8088\",\"X-Insight-Token\":\"TOKEN\",\"extras\":\"{}\"},\"account_id\":\"12345\",\"org_id\":\"67890\",\"application\":\"advisor\",\"bundle\":\"rhel\",\"context\":{},\"event_type\":\"new-recommendation\",\"timestamp\":\"2022-02-02T14:09:55.344612\",\"events\":[{\"some\":\"eventdata\"}]}"}

(don't forget to replace TOKEN with your token or password)

Within platform this can be achieved for example using the Drift service:

  • registering a system
  • creating a baseline out of the registered system
  • assigning the system to baseline
  • chaning a fact of the baseline (e.g. bios) or changing the system (updating a package)
  • running a system check-in from the system

Running unit tests

With local dev mode

$ cd splunk-quarkus
$ ACG_CONFIG=./devel.json ../mvnw quarkus:dev -Dquarkus.kafka.devservices.enabled=false

running tests are paused.

You can hit o to toggle test output and r key to resume testing and again r to re-run tests.

Alternatively you can run tests via

$ ACG_CONFIG=./devel.json ../mvnw quarkus:test -Dquarkus.kafka.devservices.enabled=false

and use r to re-run tests.

It is also possible to run tests one-time

$ ACG_CONFIG=./devel.json ../mvnw test -Dquarkus.kafka.devservices.enabled=false

Development Notes

Updating Java Dependencies

The best way how to update Java/Quarkus dependencies is to update Quarkus platform version. The platform version is mapped to a set of dependent packages of Camel provided by a BOM (Bill of Materials) package io.quarkus.platform:quarkus-camel-bom (available from quarkusio/quarkus-platform).

See also

Process

  1. Check version of quarkus.platform.version project property whether it matches the newest possible version as per quarkus-camel-bom.
    • Note: always use .Final versions.
  2. Increase the minor version of quarkus.platform.version project property by one.
  3. Read Quarkus Migration guide for the minor version.
  4. Compile code with mvnw clean compile (from the corresponding directory) and check for errors.
  5. Repeat to increase the minor version up to the highest possible.
  6. Test the app, e.g. by running mvnw quarkus:dev.

eventing-integrations's People

Contributors

codeheeler avatar fellipeh avatar jpramos123 avatar msager27 avatar petrblaho avatar vkrizan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.