-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to new architecture. Handle ceilometer metrics/events and co…
…llectd metrics/events (#22) * Refactor to new architecture. Handle ceilometer metrics/events and collectd metrics/events Co-authored-by: pleimer <pleimer@redhat.com> Co-authored-by: Leif Madsen <leif@leifmadsen.com> Co-authored-by: Martin Magr <mmagr@redhat.com>
- Loading branch information
1 parent
ec31fcb
commit 18edc86
Showing
70 changed files
with
4,529 additions
and
6,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Coveralls Badge | ||
on: pull_request | ||
|
||
jobs: | ||
coveralls_badge: | ||
name: Coveralls Badge | ||
# if: | | ||
# ( | ||
# (github.event.issue.author_association == 'OWNER') || | ||
# (github.event.issue.author_association == 'COLLABORATOR') || | ||
# (github.event.issue.author_association == 'CONTRIBUTOR') || | ||
# (github.event.issue.author_association == 'MEMBER') | ||
# ) | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: update PR with coveralls badge | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var BRANCH_NAME = process.env.BRANCH_NAME; | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `[![Coverage Status](https://coveralls.io/repos/github/${context.repo.owner}/${context.repo.repo}/badge.svg?branch=${BRANCH_NAME})](https://coveralls.io/github/${context.repo.owner}/${context.repo.repo}?branch=${BRANCH_NAME})` | ||
}) | ||
env: | ||
BRANCH_NAME: ${{ github.event.pull_request.head.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,111 @@ | ||
# SA-Benchmark and prototype | ||
[![Coverage Status](https://coveralls.io/repos/github/infrawatch/sg-core/badge.svg?branch=master)](https://coveralls.io/github/infrawatch/sg-core?branch=master) | ||
|
||
## GOLANG Server | ||
# Plugins | ||
Default plugins exist in /plugins. Plugins can also be hosted as separate projects. | ||
|
||
UDP / Unix Socket gateway | ||
## Types | ||
### Transport | ||
Transports listen on an external protocol for incoming messages. | ||
|
||
### Build | ||
### Handler | ||
Handlers receive message blobs from a transport plugin and parse them | ||
to be placed on the internal metrics or events bus. A handler can either be a | ||
metric or event handler, but not both. | ||
|
||
|
||
### Application | ||
Applications receive both metrics and events and decide what to do | ||
with them. Most application plugins interact with a storage backend such as | ||
Prometheus. | ||
|
||
# Build | ||
```bash | ||
go build cmd/server/server.go | ||
# build sg-core and plugins. Places plugin binaries in ./bin | ||
./build.sh | ||
``` | ||
|
||
### Usage | ||
# Configuration | ||
Administrators must specify 3 sections in the yaml config: | ||
|
||
```bash | ||
./server net -port 30000 | ||
1. Sg-core configuration options | ||
2. Transport plugins and configurations | ||
3. Application plugins and configurations | ||
|
||
``` yaml | ||
#1 sg-core configs | ||
plugindir: | ||
loglevel: | ||
|
||
#2 Transports | ||
transports: | ||
- name: <transport-0> | ||
handlers: | ||
- <handler-0> | ||
[...] | ||
- <handler-n> | ||
config: | ||
# plugin specific configuration | ||
[...] | ||
|
||
- name: <transport-n> | ||
handlers: | ||
[...] | ||
config: | ||
|
||
#3 Applications | ||
applications: | ||
- name: <application-0> | ||
config: | ||
# application plugin specific configurations | ||
[...] | ||
|
||
- name: <application-n> | ||
config: | ||
``` | ||
Section one describes sg-core specific configurations. | ||
Section two describes any number of transport plugins that should be configured | ||
in a list. Each transport plugin can bind any number of message handlers to itself. | ||
Keep in mind that at this time, all handlers receive every message arriving on | ||
the transport. Thus, it is generally only viable to bind either all metric handlers | ||
or all event handlers to any one transport. The `config` block is specific to | ||
the plugin being described. For example, TCP transport may require an address to | ||
be specified here. | ||
|
||
Section three describes application plugins. Just like the transport, more than | ||
one application can be configured to run. Each application block contains a | ||
config block specific to that plugin. | ||
|
||
## Example Configuration | ||
This configuration assumes both a QPID Dispatch Router and Prometheus instance | ||
are running on the localhost and listens for incoming messages on a unix socket | ||
at `/tmp/smartgateway`. The setup expects incoming messages to be collectd | ||
metrics, as can be seen by the type of handler bound to the socket transport. | ||
|
||
```yaml | ||
plugindir: bin/ | ||
loglevel: debug | ||
transports: | ||
- name: socket | ||
handlers: | ||
- collectd-metrics | ||
config: | ||
address: /tmp/smartgateway | ||
applications: | ||
- name: prometheus | ||
config: | ||
host: localhost | ||
port: 8081 | ||
withtimestamp: false | ||
``` | ||
|
||
## Run | ||
`./sg-core -config <path to config>` | ||
|
||
## Docker/Podman | ||
Build: | ||
`podman build -t sg-core -f build/Dockerfile .` | ||
|
||
Run: | ||
`podman run -d -v /path/to/sg-core.conf.yaml:/etc/sg-core.conf.yaml:z --name sg-core sg-core` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
base=$(pwd) | ||
|
||
PLUGIN_DIR=${PLUGIN_DIR:-"/tmp/plugins/"} | ||
CONTAINER_BUILD=${CONTAINER_BUILD:-false} | ||
|
||
for i in plugins/transport/*; do | ||
cd "$base/$i" | ||
echo "building $(basename $i).so" | ||
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin | ||
done | ||
cd "$base" | ||
for i in plugins/handler/*; do | ||
cd "$base/$i" | ||
echo "building $(basename $i).so" | ||
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin | ||
done | ||
cd "$base" | ||
for i in plugins/application/*; do | ||
cd "$base/$i" | ||
echo "building $(basename $i).so" | ||
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin | ||
done | ||
cd "$base" | ||
|
||
if $CONTAINER_BUILD; then | ||
echo "building sg-core for container" | ||
go build -o /tmp/sg-core cmd/*.go | ||
else | ||
go build -o sg-core cmd/*.go | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.