snap plugin for collecting free space metrics from df linux tool
Plugin collects specified metrics in-band on OS level.
- Linux system with df command
All OSs currently supported by snap:
- Linux/amd64
You can get the pre-built binaries for your OS and architecture at snap's Github Releases page.
Fork https://github.com/intelsdi-x/snap-plugin-collector-df
Clone repo into $GOPATH/src/github/intelsdi-x/
:
$ git clone https://github.com/<yourGithubID>/snap-plugin-collector-df
Build the plugin by running make in repo:
$ make
This builds the plugin in /build/rootfs
- Set up the snap framework.
- Load the plugin and create a task, see example in Examples.
List of collected metrics is described in METRICS.md.
Example running snap-plugin-collector-df plugin and writing data to a file.
Make sure that your $SNAP_PATH
is set, if not:
$ export SNAP_PATH=<snapDirectoryPath>/build
Other paths to files should be set according to your configuration, using a file you should indicate where it is located.
In one terminal window, open the snap daemon (in this case with logging set to 1, trust disabled):
$ $SNAP_PATH/bin/snapd -l 1 -t 0
In another terminal window:
Load snap-plugin-collector-df plugin:
$ $SNAP_PATH/bin/snapctl plugin load snap-plugin-collector-df
Load file plugin for publishing:
$ $SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-publisher-file
See available metrics:
$ $SNAP_PATH/bin/snapctl metric list
Create a task manifest file to use snap-plugin-collector-df plugin (exemplary file in [examples/task/] (https://github.com/intelsdi-x/snap-plugin-collector-df/blob/master/examples/task/)):
{
"version": 1,
"schedule": {
"type": "simple",
"interval": "5s"
},
"workflow": {
"collect": {
"metrics": {
"/intel/procfs/filesystem/rootfs/space_free": {},
"/intel/procfs/filesystem/rootfs/space_reserved": {},
"/intel/procfs/filesystem/rootfs/inodes_percent_free": {},
"/intel/procfs/filesystem/rootfs/inodes_percent_used": {},
"/intel/procfs/filesystem/rootfs/device_name": {},
"/intel/procfs/filesystem/sys_fs_cgroup/inodes_used": {}
},
"config": {
},
"process": null,
"publish": [
{
"plugin_name": "file",
"config": {
"file": "/tmp/published_df"
}
}
]
}
}
}
Create a task:
$ $SNAP_PATH/bin/snapctl task create -t df-file.json
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 or visit snap Gitter channel.
We love contributions!
There's more than one way to give back, from examples to blogs to code updates. See our recommended process in CONTRIBUTING.md.
And thank you! Your contribution, through code and participation, is incredibly important to us.
snap, along with this plugin, is an Open Source software released under the Apache 2.0 License.
- Author: Patryk Matyjasek
- Author: Marcin Krolik