Publishes snap metrics to PostreSQL
Clone or download
Pull request Compare This branch is 1 commit behind intelsdi-x:master.
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.
.github
examples
postgresql
scripts
.gitignore
.pluginsync.yml
.sync.yml
.travis.yml
CONTRIBUTING.md
LICENSE
Makefile
README.md
glide.lock
glide.yaml
main.go
main_test.go

README.md

Snap publisher plugin - PostgreSQL

Build Status Go Report Card

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

Getting Started

System Requirements

Installation

Run PostgreSQL server.

docker run --name postgres_server -p 5432:5432 --env 'DB_USER=snap' \
--env 'DB_PASS=snap' -d sameersbn/postgresql:9.4-8

Download File plugin binary:

You can get the pre-built binaries for your OS and architecture at plugin's GitHub Releases page.

To build the plugin binary:

Fork https://github.com/intelsdi-x/snap-plugin-publisher-postgresql

Clone repo into $GOPATH/src/github.com/intelsdi-x/:

$ git clone https://github.com/<yourGithubID>/snap-plugin-publisher-postgresql.git

Build the plugin by running make within the cloned repo:

$ make

This builds the plugin in ./build

Configuration and Usage

Documentation

Task Manifest Config

In task manifest, the config section of PostgreSQL publisher describes how to establish a connection to the PostgreSQL server.

Name | Data Type | Description ----------|-----------|---------------|------------- hostname | string | the host of PostgreSQL service port | number | the port number of PostgreSQL service username | string | the name of user password | string | the password of user database | string | the name of database table_name | string | the name of table

Examples

Example of running psutil collector plugin and publishing data to PostgreSQL database.

Set up the Snap framework

Ensure Snap daemon is running:

  • initd: service snap-telemetry start
  • systemd: systemctl start snap-telemetry
  • command line: sudo snapteld -l 1 -t 0 &

Download and load Snap plugins (paths to binary files for Linux/amd64):

$ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-postgresql/latest/linux/x86_64/snap-plugin-publisher-postgresql
$ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-collector-psutil/latest/linux/x86_64/snap-plugin-collector-psutil
$ snaptel plugin load snap-plugin-publisher-postgresql
$ snaptel plugin load snap-plugin-collector-psutil

Create a task manifest (see exemplary tasks), for example psutil-postgresql.json with following content:

{
  "version": 1,
  "schedule": {
    "type": "simple",
    "interval": "10s"
  },
  "workflow": {
    "collect": {
      "metrics": {
        "/intel/psutil/load/load1": {},
        "/intel/psutil/load/load15": {}
      },
      "publish": [
        {
          "plugin_name": "postgresql",
          "config": {
            "hostname": "localhost",
            "port": 5432,
            "username": "snap",
            "table_name": "snap",
            "database": "snap",
            "password": "snap"
          }
        }
      ]
    }
  }
}

Create a task:

$ snaptel task create -t psutil-postgresql.json

Watch created task:

$ snaptel task watch <task_id>

To stop previously created task:

$ snaptel task stop <task_id>

Example postgresql table

time_posted key_column value_column
2015-09-24 10:06:15+00 intel.psutil.load.load1 1.58
2015-09-24 10:06:15+00 intel.psutil.load.load15 2.43

Roadmap

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.

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 blogs 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.

This software has been contributed by MIKELANGELO, a Horizon 2020 project co-funded by the European Union. https://www.mikelangelo-project.eu/