python prometheus客户端。
prometheus的Python项目详细描述
普罗米修斯python客户端
====
[prometheus]的python 3客户端库(http://prometheus.io),它可以
向普罗米修斯提供数据(文本和protobuf格式),并将数据
推送到pushgateway。
[![循环](https://circleci.com/gh/slok/prometheus-python.png?style=shield&;circle token=:circle token)(https://circleci.com/gh/slok/prometheus python)
[![覆盖状态](https://coveralls.io/repos/slok/prometheus-python/badge.svg?branch=master)](https://coveralls.io/r/slok/prometheus-python?分支=主)
[![PYPI版本](https://badge.fury.io/py/prometheus.svg)(http://badge.fury.io/py/prometheus)
**目录**
-[prometheus python client](35;)
-[status]()
-[install]()
-[为什么是python 3而不是python 2?]
-[用法](35;)
-[服务数据]()
-[推送数据(推送数据(推送数据(推送数据(推送数据(推送数据(推送数据(推送网关))(;)
-[量度/采集器](;)
-[计数器](;)
-[量表](;)
-[摘要](;)
-[量表](;)
-[量表](;)
-[量表]
-[汇总](;)
-[量表]
-[量表](;)
-[量表](;;)
-[示例]()
-[举例]()
-[量表]()
-[摘要]()
-[如何使用示例]()
-[推送网关示例]()
-[量表]()
-[如何使用示例]()
-[测试]()
-[待办事项]()
-[作者]()
-[许可证]()
--------
py3.
同时维护一个版本的代码也很困难,假设2…容易出错,更新速度较慢…
所以,不要使用python 2,而要开始使用python 3!
用法
----
**kwargs):
prometheusmetrichandler(注册表,*args,**kwargs)
server.serve_forever()
````
server.serve总计","文件总上载。")
上载metric.inc({'type':"png",})
`````
```gauge
``python
```
``python
``python
我是说,i)标签定义了普罗米修斯的多维魔法。要将度量添加到收集器中,可以使用标签来标识,例如,我们有一个收集器,它存储消耗的内存:
``python
ram度量=gauge("内存使用量","内存使用量(字节)")
```
,然后添加ram用户mbs:
``python
ram度量。set({'type':"virtual",},100)
``
利用多维容量,我们可以在同一度量中存储系统的
交换所消耗的内存:
``python
ram度量集({type':"swap",},100)
```
const labels
----
当您创建一个"collector"时,您可以放置到非collector常量标签,
这些常量标签将应用于该collector从我们放置的那些标签中收集的所有度量。例如,这个没有常量标签的示例
`` python
ram度量=gauge("内存使用量字节","内存使用量字节"。)
ram度量。set({'type':"virtual","host":host},100)
ram度量。set({'type':"swap","host":host},100)
````
一个带有常量标签:
``python
ram公制=gauge("内存使用量""字节数","内存使用量"。{'host':host})
ram公制。set({'type':"virtual",},100)
ram公制。set({'type':"swap",},100)
````
35 35 35 35 35 35 \ \35 \35 \35 \\ \\35 \35 \ \\\ \\ \35 \\\摘要
*[磁盘写入IO计时](examples/timing_u write_io_u example.py)
例如[timing_write_io_example.py](examples/timing_write_io_example.py)
python./examples/timing_write_io_example.py
所有示例都在端口"4444"上运行。您可以这样将prometheus conf指向
指向以下示例之一:
job:{
name:"python client test"
scrape_interval:"1s"
target_group:{
target:"http://xxx.xxx.xxx:4444/metrics"
}
curl提供的不同格式:
default(文本0.0.4):
curl'http://127.0.0.1:4444/metrics'-h'accept:text/plain;版本=0.0.4'
protobuf调试(0.0.4):
protobuf(0.0.4):
pushgateway示例
*[输入数字](示例/input_example.py)
如何使用示例
例如,使用docker:
docker run--rm-p 9091:9091 prom/push gateway
"http://172.17.42.1:9091/metrics"
}
}
` curl`
测试
----
$pip install-r requirements\u test.txt
$./运行\u tests.sh
todo
----
*moaaar示例
*实现方便的实用程序
----
[xabier(slok)Larrakoetxea)(http://xlarakoetxea.org)
许可证
----
[见许可证](/license)
====
[prometheus]的python 3客户端库(http://prometheus.io),它可以
向普罗米修斯提供数据(文本和protobuf格式),并将数据
推送到pushgateway。
[![循环](https://circleci.com/gh/slok/prometheus-python.png?style=shield&;circle token=:circle token)(https://circleci.com/gh/slok/prometheus python)
[![覆盖状态](https://coveralls.io/repos/slok/prometheus-python/badge.svg?branch=master)](https://coveralls.io/r/slok/prometheus-python?分支=主)
[![PYPI版本](https://badge.fury.io/py/prometheus.svg)(http://badge.fury.io/py/prometheus)
**目录**
-[prometheus python client](35;)
-[status]()
-[install]()
-[为什么是python 3而不是python 2?]
-[用法](35;)
-[服务数据]()
-[推送数据(推送数据(推送数据(推送数据(推送数据(推送数据(推送数据(推送网关))(;)
-[量度/采集器](;)
-[计数器](;)
-[量表](;)
-[摘要](;)
-[量表](;)
-[量表](;)
-[量表]
-[汇总](;)
-[量表]
-[量表](;)
-[量表](;;)
-[示例]()
-[举例]()
-[量表]()
-[摘要]()
-[如何使用示例]()
-[推送网关示例]()
-[量表]()
-[如何使用示例]()
-[测试]()
-[待办事项]()
-[作者]()
-[许可证]()
--------
py3.
同时维护一个版本的代码也很困难,假设2…容易出错,更新速度较慢…
所以,不要使用python 2,而要开始使用python 3!
用法
----
**kwargs):
prometheusmetrichandler(注册表,*args,**kwargs)
````
server.serve总计","文件总上载。")
上载metric.inc({'type':"png",})
`````
```gauge
``python
```
``python
``python
我是说,i)标签定义了普罗米修斯的多维魔法。要将度量添加到收集器中,可以使用标签来标识,例如,我们有一个收集器,它存储消耗的内存:
``python
ram度量=gauge("内存使用量","内存使用量(字节)")
```
,然后添加ram用户mbs:
``python
ram度量。set({'type':"virtual",},100)
``
利用多维容量,我们可以在同一度量中存储系统的
交换所消耗的内存:
``python
ram度量集({type':"swap",},100)
```
const labels
----
当您创建一个"collector"时,您可以放置到非collector常量标签,
这些常量标签将应用于该collector从我们放置的那些标签中收集的所有度量。例如,这个没有常量标签的示例
`` python
ram度量=gauge("内存使用量字节","内存使用量字节"。)
ram度量。set({'type':"virtual","host":host},100)
ram度量。set({'type':"swap","host":host},100)
````
一个带有常量标签:
``python
ram公制=gauge("内存使用量""字节数","内存使用量"。{'host':host})
ram公制。set({'type':"virtual",},100)
ram公制。set({'type':"swap",},100)
````
35 35 35 35 35 35 \ \35 \35 \35 \\ \\35 \35 \ \\\ \\ \35 \\\摘要
*[磁盘写入IO计时](examples/timing_u write_io_u example.py)
例如[timing_write_io_example.py](examples/timing_write_io_example.py)
python./examples/timing_write_io_example.py
所有示例都在端口"4444"上运行。您可以这样将prometheus conf指向
指向以下示例之一:
job:{
name:"python client test"
scrape_interval:"1s"
target_group:{
target:"http://xxx.xxx.xxx:4444/metrics"
}
curl提供的不同格式:
default(文本0.0.4):
curl'http://127.0.0.1:4444/metrics'-h'accept:text/plain;版本=0.0.4'
protobuf调试(0.0.4):
protobuf(0.0.4):
pushgateway示例
*[输入数字](示例/input_example.py)
如何使用示例
例如,使用docker:
docker run--rm-p 9091:9091 prom/push gateway
"http://172.17.42.1:9091/metrics"
}
}
` curl`
测试
----
$pip install-r requirements\u test.txt
$./运行\u tests.sh
todo
----
*moaaar示例
*实现方便的实用程序
[xabier(slok)Larrakoetxea)(http://xlarakoetxea.org)
许可证
----
[见许可证](/license)