neofob / pp-code-metrics

Sending metrics from pp-code sensor to InfluxDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pp-code-metrics

Sending metrics from a pp-code sensor to InfluxDB to be visualized by Grafana

Default Environment Settings

URI Pattern to retrieve metrics from a websever

# From get_metrics.py
uri = protocol + host + ':' + str(port) + '/' + key + endpoint

Sample returned json from a pp-code sensor

{
  "API": {
    "Version": "200"
  },
  "Stats": {
    "Temp": "74.34F",
    "Humi": "55.29%",
    "Press (inHg)": "29.63"
  }
}

Build docker image

make docker
# or,
docker-compose build

Workflow

First, we need to have InfluxDB and Grafana run from this compose-monitor docker-compose.

1.Running from commandline

nohup ./run_get_metrics.sh my_settings.yml 2>&1 > /dev/null &

2.Running as a docker service

Switch to virtual env with docker-compose installed. All settings are in my_settings.yml file.

workon metrics
docker-compose up -d

author: tuan t. pham

Note: The work of generalizing the endpoint, key, and Transformation is sponsored by Greenfly SAU LLC.

About

Sending metrics from pp-code sensor to InfluxDB

License:MIT License


Languages

Language:Python 48.2%Language:Jinja 23.9%Language:Dockerfile 15.2%Language:Shell 9.7%Language:Makefile 3.1%