nightingale icon indicating copy to clipboard operation
nightingale copied to clipboard

前端无法读取指snmp指标数据,但可以显示自动提示

Open ZhC0925 opened this issue 1 year ago • 4 comments

categraf部署在n9e主机中,在categraf中可以获取snmp数据,但在前端无法获取数据,promql也可以自动提示index,可以如何判断问题所在呢? image image

ZhC0925 avatar Apr 23 '24 15:04 ZhC0925

  • 上下两张图的截图没有对应上,信息量不够
  • Categraf的配置文件,最好贴出来
  • 下面查询不到数据的截图全面一点

laiwei avatar Apr 24 '24 02:04 laiwei

  • 上下两张图的截图没有对应上,信息量不够
  • Categraf的配置文件,最好贴出来
  • 下面查询不到数据的截图全面一点

配置文件如下:

interval = "10s" 

[mappings]
"udp://172.20.189.81:161" = {name = "AP08A36U81", region = "bj", role = "poe", floor = "8", u = "A36"}
省略一些主机

[[instances]]
agents = [
    "udp://172.20.189.81:161",
    ...
]

interval_times = 1

## config for each request.
timeout = "5s"
version = 2
community = "snmp"
agent_host_tag = "ip"
retries = 3
max_repetitions = 50

[[instances.table]]
oid = "IF-MIB::ifTable"
name = "interface"
index_as_tag = true
filters = ["A:ifDescr:^(10GE*|GE*|Eth-Trunk*)"]
filters_expression = "A"

# 描述
[[instances.table.field]]
oid = "IF-MIB::ifDescr"
name = "ifDescr"
is_tag = true

# 流入流量
[[instances.table.field]]
oid = "IF-MIB::ifHCInOctets"
name = "ifHCInOctets"
...

[[instances]]

agents = [
    "udp://172.20.189.81:161",
    ...
]

interval_times = 3 

## config for each request.
timeout = "5s"
version = 2
community = "snmp"
agent_host_tag = "ip"
retries = 3
max_repetitions = 50

# 光模块 
[[instances.table]]
oid = "HUAWEI-ENTITY-EXTENT-MIB::hwOpticalModuleInfoTable"
name = "optical"
index_as_tag = true
filters = ["B:hwEntityOpticalPortName:^(10GE*|GE*)", "C:hwEntityOpticalWaveLength:1310"]
filters_expression = "C&&B"

# 端口名称
[[instances.table.field]]
oid = "HUAWEI-ENTITY-EXTENT-MIB::hwEntityOpticalPortName"
name = "hwEntityOpticalPortName"
is_tag = true

# 波长 
[[instances.table.field]]
oid = "HUAWEI-ENTITY-EXTENT-MIB::hwEntityOpticalWaveLength"
name = "hwEntityOpticalWaveLength"
...

[[instances]]

agents = [
    "udp://172.20.189.81:161",
    ...
]

interval_times = 216

## config for each request.
timeout = "5s"
version = 2
community = "snmp"
agent_host_tag = "ip"
retries = 3
max_repetitions = 50

[[instances.table]]
# 此处是重复的instances.table,但是采集周期不同,所以是一个空表
name = "optical"
index_as_tag = true

[[instances.table.field]]
oid = "HUAWEI-ENTITY-EXTENT-MIB::hwEntityOpticalRxLowThreshold"
name = "hwEntityOpticalRxLowThreshold" 

[[instances.table.field]]
oid = "HUAWEI-ENTITY-EXTENT-MIB::hwEntityOpticalRxHighThreshold"
name = "hwEntityOpticalRxHighThreshold" 

通过 -test,可以获取到数据: image 但前端没有数据: image

是因为多个[[instances]]和interval_times造成的吗?

ZhC0925 avatar Apr 24 '24 04:04 ZhC0925

update一下,从图中好像是因为数据采集中断造成的,获取一些就会中断几分钟,interval写的是10s啊~这是为什么呢? image image

ZhC0925 avatar Apr 24 '24 04:04 ZhC0925

数据采集不符合预期可以提issue到 github.com/flashcatcloud/categraf 。interval_times确实会影响采集频率,interval的值乘以interval_times是最终的采集频率,categraf的文档里有写

UlricQin avatar Apr 28 '24 22:04 UlricQin

github.com/flashcatcloud/categraf 提交

ZhC0925 avatar Apr 29 '24 01:04 ZhC0925