CLI utility that queries SQL database and posts results to StatsD.
Project description
# sql2statsd
`sql2statsd` is a CLI utility that queries SQL database and posts results to
[StatsD](https://github.com/etsy/statsd)
based on a provided YAML config file and a job name.
## Installation
`virtualenv` recommended.
- From Github:
```
pip install -e git+https://github.com/Suenweek/sql2statsd#egg=sql2statsd
```
## Usage
`sql2statsd` is intended to be run as a scheduled task (e.g. a `cron` job).
1. Create a YAML config file based on a config schema provided below.
2. Run `sql2statsd --config-file <CONFIG_FILE> <JOB_NAME>` where:
- `<CONFIG_FILE>` is a path to your config.
- `<JOB_NAME>` is a key in a `config["jobs"]` section.
Passing config file path as a parameter each time is tedious, so you may want
to specify `SQL2STATSD_CONFIG_FILE` env var instead.
## Config schema
```yaml
db_servers:
<str>: # Database server name
host: <str>
port: <int>
user: <str>
password: <str>
stats_servers:
<str>: # Stats server name
host: <str>
port: <int>
jobs:
<str>: # Job name
db_server: <str> # Database server name
db_name: <str>
stats_server: <str> # Stats server name
stat: <str>
query: <str>
```
`sql2statsd` is a CLI utility that queries SQL database and posts results to
[StatsD](https://github.com/etsy/statsd)
based on a provided YAML config file and a job name.
## Installation
`virtualenv` recommended.
- From Github:
```
pip install -e git+https://github.com/Suenweek/sql2statsd#egg=sql2statsd
```
## Usage
`sql2statsd` is intended to be run as a scheduled task (e.g. a `cron` job).
1. Create a YAML config file based on a config schema provided below.
2. Run `sql2statsd --config-file <CONFIG_FILE> <JOB_NAME>` where:
- `<CONFIG_FILE>` is a path to your config.
- `<JOB_NAME>` is a key in a `config["jobs"]` section.
Passing config file path as a parameter each time is tedious, so you may want
to specify `SQL2STATSD_CONFIG_FILE` env var instead.
## Config schema
```yaml
db_servers:
<str>: # Database server name
host: <str>
port: <int>
user: <str>
password: <str>
stats_servers:
<str>: # Stats server name
host: <str>
port: <int>
jobs:
<str>: # Job name
db_server: <str> # Database server name
db_name: <str>
stats_server: <str> # Stats server name
stat: <str>
query: <str>
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file sql2statsd-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: sql2statsd-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f0d0fc5f8df6048a417a73db6db3c65194525f384bf84dcf0eddc040c5f9322 |
|
MD5 | a5bad5552867c8d690da5bd908491467 |
|
BLAKE2b-256 | 6217c1eada5910826fa7c028fe9296a956dd0710280bf6fc0518c664d22a8ad7 |