This plugin collects log messages partially for each collection run. Log file reading is limited by time.
It's used in the Snap framework.
- golang 1.7+ (needed only for building)
All OSs currently supported by snap:
- Linux/amd64
- Darwin/amd64
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/
- Set up the Snap framework
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" |
This plugin has the ability to gather the following metrics:
Namespace | Description |
---|---|
/intel/csvreader/[index]/[source]/message | Single column metric |
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
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.
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
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.
Snap, along with this plugin, is an Open Source software released under the Apache 2.0 License.
- Author: @cuongquay
And thank you! Your contribution, through code and participation, is incredibly important to us.