Package: p3exporter
Python programmable Prometheus exporterp3exporter will help any DevOps to quickstart its Prometheus exporter development. It is completly written in python and provides a facility for pluggable metric collectors.
The exporter comes with real life exporters to illustrate how it works but is also intended to use as a framework for completely custom collectors.The included collectors were only tested on linux systems. Other *nix derivates are not supported by us but you are welcome to contribute to bring this exporter to a broader audience.Installation and RunningThere are different ways to run the exporter on your system. Our exporter listen on tcp/5876 by default. You can change this by adding--portor-poption with the port of your choice.Running exporter as docker containerThe simplest way will is to start it as docker container.
The container image is hosted onquay.ioanddockerhuband thelatesttag represent thedevelopbranch of the github repository.
If you want to use a given version you can us the verson string (e.g.v1.0.0) as tag instead.docker run -d --net="host" --pid="host" -v "/:/host:ro,rslave" codeaffen/p3exporter:latestInstalling from pypi.orgWe also release all versions onpypiso you can usepipto install the exporter and run it locally.pip install p3exporterThis will install the exporter and all of its dependencies. Now you can start it as every other program. You need to add--configor-coption with path to yourp3.ymlfile.$ curl --silent https://raw.githubusercontent.com/codeaffen/p3exporter/develop/p3.yml --output ~/tmp/p3.yml
$ p3exporter --config ~/tmp/p3.yml
INFO:root:Collector 'example' was loaded and registred successfully
INFO:root:Collector 'loadavg' was loaded and registred successfully
INFO:root:Collector 'netdev' was loaded and registred successfully
INFO:root:Start exporter, listen on 5876Install from repositoryThe last option to install and run p3exporter is to install it from a local clone of ourgithub repository.$ git clone https://github.com/codeaffen/p3exporter.git
Cloning into 'p3exporter'...
remote: Enumerating objects: 158, done.
remote: Counting objects: 100% (158/158), done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 158 (delta 63), reused 101 (delta 28), pack-reused 0
Receiving objects: 100% (158/158), 188.37 KiB | 1.08 MiB/s, done.
Resolving deltas: 100% (63/63), done.
$ cd p3exporter
$ pip install -e .From now you can run it with:$ p3exporter
INFO:root:Collector 'example' was loaded and registred successfully
INFO:root:Collector 'loadavg' was loaded and registred successfully
INFO:root:Collector 'netdev' was loaded and registred successfully
INFO:root:Start exporter, listen on 5876Building your own container imageTo build your own container image you can use the dockerfile which is delivered in our github repository.
This file is also used to create our images on quay.io or dockerhub.$ docker build -t p3exporter .
Sending build context to Docker daemon  181.8kB
...
Successfully built a6bdf60489f5
Successfully tagged p3exporter:latestNow you can start the container. Here you can use the command from above. You have just to use your imagedocker run -d --net="host" --pid="host" -v "/:/host:ro,rslave" p3exporter:latestCollectorsNameDescriptionexampleexample collector that actually does nothing but show how long a function has been executedloadavgcollects average load in 1, 5 and 15 minutes intervalnetdevcollects netword device information and statisticsActivation and Deactivation of collectorsTo activate or deactive collectors you have to configure it inp3.ymlwithin thecollectorslist. All collectors listed in this list will be activated a start time of p3exporter. If there are any issues e.g. collector can't be found or has failures in code a warning will be shown and it will not be activated.exporter_name:"PythonprammablePrometheusexporter"collectors:-example-loadavg-netdevcollector_opts:netdev:whitelist:blacklist:-docker0-lo