Skip to content

Instantly share code, notes, and snippets.

@jcooklin
Last active October 9, 2021 12:27
Show Gist options
  • Save jcooklin/5d81a20b852dec2c2e9250030bf7ba68 to your computer and use it in GitHub Desktop.
Save jcooklin/5d81a20b852dec2c2e9250030bf7ba68 to your computer and use it in GitHub Desktop.

Revisions

  1. jcooklin revised this gist Jun 2, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ This compose file makes the following assumptions.

    * You are using GVM to manage go environments
    * You have checked out the branch jcooklin:fb/enables-streaming of https://github.com/intelsdi-x/snap-plugin-lib-go
    * You have checked out the branch jcooklin:fb/enables-streaming of https://github.com/intelsdi-x/snap
    * You have checked out the branch kjlyon:relay-plugin of https://github.com/intelsdi-x/snap-relay
    * You have built the relay for linux
    * To build the plugin run `GOOS=linux go build -o snap-relay main.go` from the top level of the snap-relay repo
  2. jcooklin revised this gist Jun 1, 2017. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    This compose file demonstrates the snap-relay, a stand-alone streaming plugin.
    The compose file will start a container for snap, the relay, collectd and
    influxdb. A short lived 'init' container is started which loads the plugins
    and starts the task.

    This compose file makes the following assumptions.

    * You are using GVM to manage go environments
    * You have checked out the branch jcooklin:fb/enables-streaming of https://github.com/intelsdi-x/snap-plugin-lib-go
    * You have checked out the branch kjlyon:relay-plugin of https://github.com/intelsdi-x/snap-relay
    * You have built the relay for linux
    * To build the plugin run `GOOS=linux go build -o snap-relay main.go` from the top level of the snap-relay repo

    ![img](https://cloud.githubusercontent.com/assets/862968/26699028/1bdc9fde-46cd-11e7-9c5c-e82360c18fcb.gif)
  3. jcooklin revised this gist Jun 1, 2017. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ services:
    container_name: snap
    image: intelsdi/snap:alpine_test
    volumes:
    # Note: SNAP_PATH needs to be set and valid so that we can map the binaries
    # into the container.
    - ${SNAP_PATH}/linux/x86_64:/opt/snap/bin
    - ${SNAP_PATH}/linux/x86_64:/opt/snap/sbin
    ports:
    @@ -36,6 +38,10 @@ services:
    container_name: relay
    image: alpine
    volumes:
    # Note - please ensure the following:
    # - That the path below is to the snap-relay
    # - That the plugin has been built for Linux and that the binary exists at
    # the top level of the project directory
    - ${GVM_ROOT}/pkgsets/${gvm_go_name}/${gvm_pkgset_name}/src/github.com/intelsdi-x/snap-relay:/usr/local/bin
    ports:
    - 8182:8182
    @@ -61,14 +67,14 @@ services:
    - snap
    - relay
    - influxdb
    entrypoint:
    entrypoint:
    - /bin/ash
    - -c
    - "apk add --update curl; \
    curl -i -XPOST http://influxdb:8086/query --data-urlencode \"q=CREATE DATABASE snap\"; \
    curl -o /tmp/snap-plugin-publisher-influxdb http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-influxdb/latest/linux/x86_64/snap-plugin-publisher-influxdb; \
    curl -o /tmp/collectd.yml https://gist.github.com/jcooklin/5d81a20b852dec2c2e9250030bf7ba68/raw/56bd13b49fc4e3697c873f1602745501656ef216/collectd.yml; \
    snaptel -u http://snap:8181 plugin load /tmp/snap-plugin-publisher-influxdb \
    snaptel -u http://snap:8181 plugin load /tmp/snap-plugin-publisher-influxdb; \
    snaptel -u http://snap:8181 plugin load http://relay:8182; \
    snaptel -u http://snap:8181 task create -t /tmp/collectd.yml"
    depends_on:
  4. jcooklin revised this gist Jun 1, 2017. 1 changed file with 78 additions and 0 deletions.
    78 changes: 78 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,78 @@
    version: '3'
    services:
    snap:
    container_name: snap
    image: intelsdi/snap:alpine_test
    volumes:
    - ${SNAP_PATH}/linux/x86_64:/opt/snap/bin
    - ${SNAP_PATH}/linux/x86_64:/opt/snap/sbin
    ports:
    - "8181:8181"
    depends_on:
    - collectd
    - influxdb
    - relay
    links:
    - relay
    - influxdb
    collectd:
    container_name: collectd
    image: revett/collectd
    environment:
    CONFIG_TYPE: graphite
    EP_HOST: relay
    EP_PORT: 6123
    links:
    - relay
    depends_on:
    - relay
    influxdb:
    container_name: influxdb
    image: influxdb
    ports:
    - 8086:8086
    - 8083:8083
    relay:
    container_name: relay
    image: alpine
    volumes:
    - ${GVM_ROOT}/pkgsets/${gvm_go_name}/${gvm_pkgset_name}/src/github.com/intelsdi-x/snap-relay:/usr/local/bin
    ports:
    - 8182:8182
    - 5801:5801
    - 6123:6123
    entrypoint:
    - snap-relay
    - --stand-alone
    - --stand-alone-port
    - "8182"
    - --port
    - "5801"
    - --addr
    - relay
    - --graphite-tcp
    - "relay:6123"
    init:
    container_name: init
    image: alpine
    volumes:
    - ${SNAP_PATH}/linux/x86_64:/usr/local/bin
    links:
    - snap
    - relay
    - influxdb
    entrypoint:
    - /bin/ash
    - -c
    - "apk add --update curl; \
    curl -i -XPOST http://influxdb:8086/query --data-urlencode \"q=CREATE DATABASE snap\"; \
    curl -o /tmp/snap-plugin-publisher-influxdb http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-influxdb/latest/linux/x86_64/snap-plugin-publisher-influxdb; \
    curl -o /tmp/collectd.yml https://gist.github.com/jcooklin/5d81a20b852dec2c2e9250030bf7ba68/raw/56bd13b49fc4e3697c873f1602745501656ef216/collectd.yml; \
    snaptel -u http://snap:8181 plugin load /tmp/snap-plugin-publisher-influxdb \
    snaptel -u http://snap:8181 plugin load http://relay:8182; \
    snaptel -u http://snap:8181 task create -t /tmp/collectd.yml"
    depends_on:
    - snap
    - relay
    - influxdb

  5. jcooklin created this gist Jun 1, 2017.
    17 changes: 17 additions & 0 deletions collectd.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    ---
    version: 1
    schedule:
    type: "streaming"
    workflow:
    collect:
    metrics:
    /relay/collectd: {}
    publish:
    -
    plugin_name: "influxdb"
    config:
    host: influxdb
    port: 8086
    database: "snap"
    user: "admin"
    password: "admin"