Collect from CSV file's column as an intelsdi-x snap metric.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
csvreader
examples/tasks
scripts
.gitignore
.pluginsync.yml
.sync.yml
.travis.yml
CONTRIBUTING.md
EXAMPLE_OUTPUT.md
LICENSE
Makefile
README.md
_config.yml
glide.lock
glide.yaml
main.go
main_test.go
metadata.yaml

README.md

Snap collector plugin - csvreader

This plugin collects log messages partially for each collection run. Log file reading is limited by time.

Build Status

It's used in the Snap framework.

  1. Getting Started
  1. Documentation
  1. Community Support
  2. Contributing
  3. License
  4. Acknowledgements

Getting Started

System Requirements

Operating systems

All OSs currently supported by snap:

  • Linux/amd64
  • Darwin/amd64

Installation

To build the plugin binary:

Fork https://github.com/cuongquay/snap-plugin-collector-csvreader

Clone repo into $GOPATH/src/github.com/cuongquay/:

$ git clone https://github.com/<yourGithubID>/snap-plugin-collector-csvreader.git

Build the plugin by running make within the cloned repo:

$ make

This builds the plugin in ./build/

Configuration and Usage

Task manifest configuration options

Option Description Default value
"source" Declaration of full path file name, in CSV format "opt/snap/files/metrics.csv"
"attrs" Defines the list of column indexes that want to collect, separated by comma "0,1"
"units" The units corresponding to the indexes of each metric "date,amps"

Documentation

Collected Metrics

This plugin has the ability to gather the following metrics:

Namespace Description
/intel/csvreader/[index]/[source]/message Single column metric

Examples

This is an example running csvreader collector and writing data to a file. It is assumed that you are using the latest Snap binary and plugins.

The example is run from a directory which includes snaptel, snapteld, along with the plugins and task file.

In one terminal window, open the Snap daemon (in this case with logging set to 1 and trust disabled):

$ snapteld -l 1 -t 0

In another terminal window:

Download csvreader collector plugin:

$ wget -O snap-plugin-collector-csvreader https://github.com/cuongquay/snap-plugin-collector-csvreader/releases/download/v1.1/snap-plugin-collector-csvreader_linux_x86_64

Load csvreader plugin

$ snaptel plugin load snap-plugin-collector-csvreader
Plugin loaded
Name: csvreader
Version: 1
Type: collector
Signed: false
Loaded Time: Thu, 05 Jan 2017 11:58:11 CET

See available metrics for your system

$ snaptel metric list

Create a task manifest file (e.g. task-csvreader.json):

{
    "version": 1,
    "schedule": {
        "type": "simple",
        "interval": "3s"
    },
    "workflow": {
        "collect": {
            "metrics": {
                "/intel/csvreader/*": {}
            },
            "config": {
                "/intel/csvreader": {
                    "source": "/opt/snap/files/test.csv",
                    "attrs": "0,1",
                    "unit": "u1,u2"
                }
            },
            "publish": [
                {
                    "plugin_name": "file",
                    "config": {
                        "file": "/tmp/published_csvreader"
                    }
                }
            ]
        }
    }
}

Download file publisher plugin:

$ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-file/latest/linux/x86_64/snap-plugin-publisher-file

Load file plugin for publishing:

$ snaptel plugin load snap-plugin-publisher-file
Plugin loaded
Name: file
Version: 3
Type: publisher
Signed: false
Loaded Time: Fri, 20 Nov 2015 11:41:39 PST

Create task:

$ snaptel task create -t task-csvreader.json
Using task manifest to create task
Task created
ID: 02dd7ff4-8106-47e9-8b86-70067cd0a850
Name: Task-02dd7ff4-8106-47e9-8b86-70067cd0a850
State: Running

See file output (this is just single collection output with default collection_time of 300ms): EXAMPLE_OUTPUT.md

Stop task:

$ snaptel task stop 02dd7ff4-8106-47e9-8b86-70067cd0a850
Task stopped:
ID: 02dd7ff4-8106-47e9-8b86-70067cd0a850

Roadmap

There isn't a current roadmap for this plugin, but it is in active development. As we launch this plugin, we do not have any outstanding requirements for the next release. If you have a feature request, please add it as an issue and/or submit a pull request.

Community Support

This repository is one of many plugins in Snap, a powerful telemetry framework. See the full project at http://github.com/intelsdi-x/snap To reach out to other users, head to the main framework

Contributing

We love contributions!

There's more than one way to give back, from examples to csvreader to code updates. See our recommended process in CONTRIBUTING.md.

License

Snap, along with this plugin, is an Open Source software released under the Apache 2.0 License.

Acknowledgements

And thank you! Your contribution, through code and participation, is incredibly important to us.