categraf/inputs/switch_legacy/README.md

39 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# switch_legacy
交换机监控插件fork 自 [https://github.com/gaochao1/swcollector](https://github.com/gaochao1/swcollector) 可以自动探测网络设备型号,获取 CPU、内存使用率当然还有各个网口的监控数据这是通用的 oid
## Configuration
最核心的配置就是指定 IP 列表,有三种写法:
```toml
[[instances]]
ips = [
"172.16.2.1",
"172.16.4/24",
"192.168.56.102-192.168.56.120"
]
```
该插件只支持 SNMP v2c所以认证信息就是一个 community 字符串
## 唯一标识标签
网络设备的监控数据,默认都会带有 ip 标签,指定监控数据来源于哪个设备,如果想把监控数据当做夜莺里的监控对象,让网络设备自动出现在夜莺的监控对象表格里,只需要把 switch_id_label 设置为 ident 即可,这样一来,网络设备的 IP 信息会作为 ident 标签的值上报,夜莺会自动读取 ident 标签的值入库
## 名称映射
有时,我们看到网络设备的 IP无法分辨是具体哪个设备此时可以给 IP 一个映射名称:
```ini
[mappings]
"192.168.88.160" = "switch001.bj"
"192.168.88.161" = "switch002.bj"
```
这样一来,上报的监控数据就不用 IP 做标识了,而是使用 switch001.bj 这样的字符串做标识,更易读一些
## 自定义 oid
`[[instances.customs]]` 部分可以配置多个,表示自定义 oid默认情况下该插件采集的都是设备各个网口的监控数据以及CPU和内存的使用率如果要采集别的 oid就需要使用这个自定义功能