Snap collector for snap task metrics to be able to monitor Snap.
Go Shell
Latest commit da0f00d Dec 21, 2016 @daniellee daniellee fixes leaking http connections
The http client does not reuse
connections if recreated for every
collect metrics call.

snap collector plugin - snapstats

This plugin collects metrics from Snap itself. It is quite simple so far and just collects some counts for all tasks.

It's used in the snap framework.

  1. Getting Started
  2. Documentation
  3. License
  4. Acknowledgements

Getting Started

System Requirements


To build the plugin binary:

Fork Clone repo into $GOPATH/src/

$ git clone<yourGithubID>/snap-plugin-collector-snapstats.git

Build the plugin by running make within the cloned repo:

$ make

This builds the plugin in /build/

Uses govendor to manage dependencies.

Configuration and Usage

  • Set up the snap framework
  • Ensure $SNAP_PATH is exported export SNAP_PATH=$GOPATH/src/


Collected Metrics

This plugin has the ability to gather the following metrics:

Namespace Description (optional)
/grafanalabs/snapstats/tasks/state/Disabled/count Total number of disabled Snap tasks
/grafanalabs/snapstats/tasks/state/Running/count Total number of Running Snap tasks
/grafanalabs/snapstats/tasks/state/Stopped/count Total number of Stopped Snap tasks
/grafanalabs/snapstats/tasks/hitcount Total sum of the all the snap tasks' hit counts
/grafanalabs/snapstats/tasks/failedcount Total sum of the all the snap tasks' failed counts


There is an example task in the examples directory.

It has one config variable that is required - snap-url

For most users, this value should be http://localhost:8181. It is mandatory that the url starts with the http or https protocol.


Hopefully, Intel will be releasing a more complete lib that will make this obsolete.


This plugin is released under the Apache 2.0 License.