openfalcon客户端自定义push 传输到transfer

Posted fengjian1585

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openfalcon客户端自定义push 传输到transfer相关的知识,希望对你有一定的参考价值。

1. linux客户端部署agent
2. 编写脚本,比如:

#!/usr/bin/env python
#!-*- coding:utf8 -*-

import requests
import time
import json
import random
import os


while True:
    time.sleep(20)
    payload_list = []
    ts = int(time.time())
    print ts
    endpoint = os.popen(echo $HOSTNAME).read().strip()
    value = random.randint(1,100)
    temp_dict = {
        "endpoint": endpoint,
        "metric": "feng-count",
        "timestamp": ts,
        "step": 60,
        "value":value ,
        "counterType": "GAUGE",
        "tags": "idc_test",
    }
    payload_list.append(temp_dict)
    requests.post("http://127.0.0.1:1988/v1/push", data=json.dumps(payload_list))

注释:
       必须按照 temp_dict 字典中的格式书写。

3.查看agent值是否传输到query中
cd /data/query/script/
./query "endpoint" "counter(就是metric)"

 

以上是关于openfalcon客户端自定义push 传输到transfer的主要内容,如果未能解决你的问题,请参考以下文章

WCF c#中自定义类的传输问题

git push 后 链接总是灰色点击没有反应

:自定义push notification sound

企业告警平台示设计图及自定义数据说明

具有 basicHttpBinding、传输安全性和基本客户端凭据类型的自定义 WCF 凭据验证器

云原生架构-监控告警从openfalcon到Prometheus