flashcatcloud / categraf

one-stop telemetry collector for nightingale
https://flashcat.cloud/docs/
MIT License
824 stars 253 forks source link

input.aliyun agent._hostname标签主机名有“.”的情况被忽略了,不显示"." #957

Open nondevops opened 3 months ago

nondevops commented 3 months ago

Relevant config.toml

# # collect interval
# interval = 60
[[instances]]
# # endpoint region 参考 https://help.aliyun.com/document_detail/28616.html#section-72p-xhs-6qt
region="cn-beijing"
endpoint="metrics-vpc.cn-beijing.aliyuncs.com"
access_key_id="xx"
access_key_secret="xx"
interval_times=4
delay="10m"
period="60s"

# # namespace 参考 https://help.aliyun.com/document_detail/163515.htmspm=a2c4g.11186623.0.0.44d65c58mhgNw3
namespaces=["acs_ecs_dashboard"]
[[instances.metric_filters]]
# # metric name 参考 https://help.aliyun.com/document_detail/163515.htm?spm=a2c4g.11186623.0.0.401d15c73Z0dZh
# # 参考页面中的Metric Id 填入下面的metricName ,页面中包含中文的Metric Name对应接口中的Description
metric_names=["cpu_cores","cpu_idle","cpu_system","cpu_total","cpu_user","cpu_wait","vm.TcpCount"]
namespace=""
ratelimit=25
catch_ttl="1h"
timeout="10s"

Logs from categraf

10:29:45 aliyun_acs_ecs_dashboard_cpu_other_minimum agent_hostname=rocketmq-server0305048183xxf ...
10:29:45 aliyun_acs_ecs_dashboard_cpu_other_average agent_hostname=es-cluster-logs-hot0305058967xxf ...

System info

rocky.linux.8.5

Docker

No response

Steps to reproduce

修改input.aliyun相关配置 开启调试

Expected behavior

希望将"."显示出来,input.cpu 等默认采集对象是不会忽略"."的。

Actual behavior

input.aliyun agent._hostname标签主机名有“.”的情况被忽略了,不显示"."

Additional info

No response

nondevops commented 3 months ago

实际应该要显示: 10:29:45 aliyun_acs_ecs_dashboard_cpu_other_minimum agent_hostname=rocketmq-server.0305048183.xxf ... 10:29:45 aliyun_acs_ecs_dashboard_cpu_other_average agent_hostname=es-cluster-logs-hot.0305058967.xxf ...

kongfei605 commented 3 months ago

label处理中把 . 忽略了 。 下个版本,hostname 会保持原样上报

nondevops commented 3 months ago

@kongfei605 另外还发现一个BUG,已经指定了只获取北京地域的资源,但是从结果来看同时也把上海地域的资源也一起获取了。 相关参数: region="cn-beijing" endpoint="metrics-vpc.cn-beijing.aliyuncs.com"

image image

nondevops commented 3 months ago

@kongfei605 可否提个需求,能否将云服务器ECS的私有IP捕获出来,通过instance_id不好区分谁是谁,同时也希望像其他采集器一样支持hostname,这样就可以将ident组装成hostname-ip了,当前只能hostname.

kongfei605 commented 3 months ago

@kongfei605 另外还发现一个BUG,已经指定了只获取北京地域的资源,但是从结果来看同时也把上海地域的资源也一起获取了。 相关参数: region="cn-beijing" endpoint="metrics-vpc.cn-beijing.aliyuncs.com"

image image

阿里云的cms接口就是这样,请求一个region,返回全球的数据。

kongfei605 commented 3 months ago

@kongfei605 可否提个需求,能否将云服务器ECS的私有IP捕获出来,通过instance_id不好区分谁是谁,同时也希望像其他采集器一样支持hostname,这样就可以将ident组装成hostname-ip了,当前只能hostname.

私有IP获取了,就会有一个单独的label了,不用hostname-ip这种组装了。

私有IP获取可以支持,不过获取元信息都需要额外的权限,单靠一个文档说明未必够用。这个也是现在放到企业版先支持的原因,有专门的人员去配置。

kongfei605 commented 3 months ago

v0.3.70 已经去掉了hostname的snake case