Skip to main content
grafilter
=========

Dashboards like [Grafana](http://grafana.org) are awesome, but sometimes they make it hard to look at all the metrics, without first spending time to configure a dashboard. Grafilter is meant to provide lightweight and easy access to your metrics. You can still customize visuals of course, but in a way that let's you store these customizations in a versioned config management system such as [Ansible](http://www.ansible.com), [BundleWrap](http://bundlewrap.org) or [Chef](https://www.chef.io/chef/) as opposed to a database like Grafana 2 does.

Grafilter supports InfluxDB 0.9.0 and onwards.

![PyPI downloads](http://img.shields.io/pypi/dm/grafilter.svg)   ![PyPI version](http://img.shields.io/pypi/v/grafilter.svg)   ![Python 3.x](http://img.shields.io/badge/Python-3.4-green.svg)   ![License](http://img.shields.io/badge/License-GPLv3-red.svg)

Install
-------

```
apt-get install python3-pip
pip3 install grafilter
```

Configure
---------

Create a file with these contents anywhere:

```python
CACHE_TIMEOUT = 300
CONFIG_DIR = "/var/lib/grafilter"
DEBUG = False
IGNORED_TAGS = ["_key"]
INFLUXDB_DB = "metrics"
INFLUXDB_URL = "http://user:pass@influxdb.example.com:8086"
```

Note that `INFLUXDB_URL` points to the HTTP API port of InfluxDB.

Run
---

```sh
GRAFILTER_SETTINGS=/path/to/grafilter.cfg grafilter
```

Customize
---------

You can customize the appearance of your individual metrics by placing files in the `metrics` subdirectory of your `CONFIG_DIR`. These files must have a `.json` extension and look like this:

```json
{
"pattern": "^load/",
"transform": "lambda x: math.floor(x)",
"type": "area"
}
```

Note that `pattern` is a regular expression that has to match the name of the metrics you want to customize. The name is formatted like this: `measurement/tag1:value1/tag2:value2`. Each metric will only be styled according to the first file with a matching `pattern`. All other options listed here are optional.

Option | Explanation
-------|------------
`max` | force highest value on y axis (int or float)
`merge` | a Python expression describing a function that takes two numeric values and the time interval between them and returns one numeric value. It can be used to calculate the difference between two sequential datapoints and use the result in your graph (useful for ever increasing counters, e.g. `lambda x, y, t: (y - x) / t`). You have access to the [math module from the Python standard library](https://docs.python.org/3/library/math.html). Applied before `transform`.
`min` | force lowest value on y axis (int or float)
`short_name` | a cosmetic name for this metric, e.g. "Load Average"
`stack` | set this to `true` if you want to stack values when selecting multiple metrics
`transform` | a Python expression describing a function that takes a numeric value and returns another. It can be used to perform conversions and other math on your metrics. You have access to the [math module from the Python standard library](https://docs.python.org/3/library/math.html). Applied after `merge`.
`type` | chart type: `area`, `area-spline`, `area-step`, `line`, `spline` or `step` (defaults to `line`)
`unit_format` | a [d3 format specifier](https://github.com/mbostock/d3/wiki/Formatting#d3_format) for your y axis (e.g. "s" to turn "1000" into "1K" and "1000000" into "1M")
`unit` | any string you want to be displayed next to your y axis

Release files for grafilter 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grafilter 0.4.0
File Size Uploaded
grafilter-0.4.0.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grafilter 0.4.0
File Interpreter ABI Platform
grafilter-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.0 kB

Release files / grafilter-0.4.0.tar.gz

Download URL grafilter-0.4.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
935eac6159b6ecdd3385a26085151bb287086278f3f57aaf5e93be67275ebc6b
BLAKE2b-256 checksum
How to use checksums
dab1d8c94371701b768ad8734da31efa9a4bd6870406e968f3e47f634fe797bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / grafilter-0.4.0-py3-none-any.whl

Download URL grafilter-0.4.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36533c1756d8c252c54936e97c49ec95a28af6ca71569a02555cea01078d1cc9
BLAKE2b-256 checksum
How to use checksums
6d967d7f6e9c0575eb2b0b75e5cc73f68619d02f6d8ac080eddef124c1634b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page