This plugin collects metrics from /proc/meminfo kernel interface about distribution and utilization of memory.
It's used in the snap framework.
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-meminfo
Clone repo into $GOPATH/src/github.com/intelsdi-x/
:
$ git clone https://github.com/<yourGithubID>/snap-plugin-collector-meminfo.git
Build the plugin by running make within the cloned repo:
$ make
This builds the plugin in /build/rootfs/
-
Set up the snap framework
-
Ensure
$SNAP_PATH
is exported
export SNAP_PATH=$GOPATH/src/github.com/intelsdi-x/snap/build
-
If /proc resides in a different directory, say for example by mounting host /proc inside a container at /hostproc, a proc_path configuration item can be added to snapd global config or as part of the task manifest for the metrics to be collected.
As part of snapd global config
---
control:
plugins:
collector:
meminfo:
all:
proc_path: /hostproc
Or as part of the task manifest
{
...
"workflow": {
"collect": {
"metrics": {
"/intel/procfs/meminfo/mem_total": {}
},
"config": {
"/intel/procfs": {
"proc_path": "/hostproc"
}
},
...
},
},
...
- Load the plugin and create a task, see example in Examples.
List of collected metrics is described in METRICS.md.
Example running meminfo, passthru processor, 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.
This is done from the snap directory.
In one terminal window, open the snap daemon (in this case with logging set to 1 and trust disabled):
$ $SNAP_PATH/bin/snapd -l 1 -t 0
In another terminal window: Load meminfo plugin:
$ $SNAP_PATH/bin/snapctl plugin load snap-plugin-collector-meminfo
See available metrics for your system
$ $SNAP_PATH/bin/snapctl metric list
Create a task manifest file (exemplary files in [examples/tasks/] (https://github.com/intelsdi-x/snap-plugin-collector-meminfo/blob/master/examples/tasks/)):
{
"version": 1,
"schedule": {
"type": "simple",
"interval": "1s"
},
"workflow": {
"collect": {
"metrics": {
"/intel/procfs/meminfo/mem_free": {},
"/intel/procfs/meminfo/mem_available": {},
"/intel/procfs/meminfo/mem_total": {},
"/intel/procfs/meminfo/mem_used": {}
},
"config": {},
"process": null,
"publish": [
{
"plugin_name": "file",
"config": {
"file": "/tmp/published_meminfo.log"
}
}
]
}
}
}
Load file plugin for publishing:
$ $SNAP_PATH/bin/snapctl plugin load build/plugin/snap-publisher-file
Plugin loaded
Name: file
Version: 3
Type: publisher
Signed: false
Loaded Time: Fri, 20 Nov 2015 11:41:39 PST
Create task:
$ $SNAP_PATH/bin/snapctl task create -t examples/tasks/mem-file.json
Using task manifest to create task
Task created
ID: 02dd7ff4-8106-47e9-8b86-70067cd0a850
Name: Task-02dd7ff4-8106-47e9-8b86-70067cd0a850
State: Running
Stop task:
$ $SNAP_PATH/bin/snapctl 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 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: Marcin Krolik