记录到infloxdb的系统监视守护程序
metrics-collector的Python项目详细描述
#garena metrics collector
一个用于在[infloxdb]中记录服务器统计信息的系统监视守护进程(http://infloxdb.com/)。
\就像这样:
``sh
sudo pip安装garena_metrics_collector.zip
```
,然后您只需转到**/etc/garena_metrics_collector/**并编辑那里的**config.ini**文件,就应该准备好登录了。
假设您将配置文件重命名为**config.ini**,您可以继续运行以下命令:
``sh
garena_metrics_collector start
````
>守护进程将开始将所有内容记录到您指定的infloxdb服务器。
####Returns percentages of CPU allocation
|Key|Type|Description|
|---|----|-----------|
|**usage**|*int*|Percent used by user processes|
### **disk** - `system.disk`
#### Returns information about disk usage
|Key|Type|Description|
|---|----|-----------|
|**total**|*long*|Total available space *in 字节
<
<
<
返回系统负载information
|Key|Type|Description|
|---|----|-----------|
|**1m**|*int*|1 minute load average|
|**5m**|*int*|5 minute load average|
|**15m**|*int*|15 minute load average|
### **memory** - `system.memory`
#### Returns system memory allocations and usage
All of these values are calculated in *bytes*.
|Key|Type|Description|
|---|----|-----------|
|**total**|*long*|Total memory|
|**available**|*long*|Total uncached memory|
|**used**|*long*|Total cached memory|
### **net** - `system.net.*`
#### Returns network information seperated by interface
|Key|Type|Description|
|---|----|-----------|
|**bytes_tx**|*long*|Total bytes sent|
|**bytes_rx**|*long*|Total bytes received|
|**packets_rx**|*long*|Total packets received|
|**packets_tx**|*long*|Total packets sent|
|**errors_in**|*long*|Total incoming packet errors|
|**errors_out**|*long*|Total 传出数据包错误
**丢弃的数据包*long*传入的总丢弃的数据包
**丢弃的数据包*long*传出的总丢弃的数据包
自定义收集器
您可以继续并将收集器添加到**/etc/garena_metrics_collector/collectors/**中,我们将在周期中自动运行它们并报告它们值。
以下是一些示例:
**collectors/example.py**:
`` python
导入rand
类示例collector(collectorthread):
标识符='示例';这是必需的!
def collect(self,cache):
有状态缓存(跨集合)
如果最后一个不在缓存中:
reutrn[]
return[{
“measurement”:“your戋measurement”,
“fields”:{
“point”:rand.randint(0,100)-cache['last']
}
}
````
标记自动添加,包括服务器公共IP和主机名(可在主机名中配置)。
一个用于在[infloxdb]中记录服务器统计信息的系统监视守护进程(http://infloxdb.com/)。
\就像这样:
``sh
sudo pip安装garena_metrics_collector.zip
```
,然后您只需转到**/etc/garena_metrics_collector/**并编辑那里的**config.ini**文件,就应该准备好登录了。
假设您将配置文件重命名为**config.ini**,您可以继续运行以下命令:
``sh
garena_metrics_collector start
````
>守护进程将开始将所有内容记录到您指定的infloxdb服务器。
####Returns percentages of CPU allocation
|Key|Type|Description|
|---|----|-----------|
|**usage**|*int*|Percent used by user processes|
### **disk** - `system.disk`
#### Returns information about disk usage
|Key|Type|Description|
|---|----|-----------|
|**total**|*long*|Total available space *in 字节
<
<
<
返回系统负载information
|Key|Type|Description|
|---|----|-----------|
|**1m**|*int*|1 minute load average|
|**5m**|*int*|5 minute load average|
|**15m**|*int*|15 minute load average|
### **memory** - `system.memory`
#### Returns system memory allocations and usage
All of these values are calculated in *bytes*.
|Key|Type|Description|
|---|----|-----------|
|**total**|*long*|Total memory|
|**available**|*long*|Total uncached memory|
|**used**|*long*|Total cached memory|
### **net** - `system.net.*`
#### Returns network information seperated by interface
|Key|Type|Description|
|---|----|-----------|
|**bytes_tx**|*long*|Total bytes sent|
|**bytes_rx**|*long*|Total bytes received|
|**packets_rx**|*long*|Total packets received|
|**packets_tx**|*long*|Total packets sent|
|**errors_in**|*long*|Total incoming packet errors|
|**errors_out**|*long*|Total 传出数据包错误
**丢弃的数据包*long*传入的总丢弃的数据包
**丢弃的数据包*long*传出的总丢弃的数据包
自定义收集器
您可以继续并将收集器添加到**/etc/garena_metrics_collector/collectors/**中,我们将在周期中自动运行它们并报告它们值。
以下是一些示例:
**collectors/example.py**:
`` python
导入rand
类示例collector(collectorthread):
标识符='示例';这是必需的!
def collect(self,cache):
有状态缓存(跨集合)
如果最后一个不在缓存中:
reutrn[]
return[{
“measurement”:“your戋measurement”,
“fields”:{
“point”:rand.randint(0,100)-cache['last']
}
}
````
标记自动添加,包括服务器公共IP和主机名(可在主机名中配置)。