腾讯云TDP-使用netdata的nodejs环境 snmp插件 监控mikrotik设备带宽

腾讯云TDP-使用netdata的nodejs环境 snmp插件 监控mikrotik设备带宽

官方参考文档

https://learn.netdata.cloud/docs/agent/collectors/node.d.plugin/snmp#testing-the-configuration

1.在netdata设备上创建一个配置文件

代码语言:javascript
复制
touch /etc/netdata/node.d/snmp.conf

2.写入详细配置信息

代码语言:javascript
复制
{
    "enable_autodetect": false,
    "update_every": 5,
    "max_request_size": 100,
    "servers": [
        {
            "hostname": "64.227.127.154",
            "community": "public",
            "update_every": 1,
            "max_request_size": 500,
            "options": {
                "timeout": 10000
            },
            "charts": {
                "snmp_switch.bandwidth_port1": {
                    "title": "Switch Bandwidth for port 1",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.1",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.1",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                },
                "snmp_switch.bandwidth_port2": {
                    "title": "Switch Bandwidth for port 2",
                    "units": "kilobits/s",
                    "type": "area",
                    "priority": 1,
                    "family": "ports",
                    "dimensions": {
                        "in": {
                            "oid": "1.3.6.1.2.1.2.2.1.10.2",
                            "algorithm": "incremental",
                            "multiplier": 8,
                            "divisor": 1024,
                            "offset": 0
                        },
                        "out": {
                            "oid": "1.3.6.1.2.1.2.2.1.16.2",
                            "algorithm": "incremental",
                            "multiplier": -8,
                            "divisor": 1024,
                            "offset": 0
                        }
                    }
                }
            }
        }
    ]
}

3.重启netdata服务

代码语言:javascript
复制
systemctl restart netdata

4.展示效果

注意事项1

netdata设备上需要安装部分软件

代码语言:javascript
复制
apt install nodejs npm snmpd snmp

注意事项2

记得自己先测试通不通

代码语言:javascript
复制
root@azure-1f7af551-in1:/etc/netdata/node.d# snmpwalk -v1 -c public 64.227.127.154 1.3.6.1.2.1.2.2.1.10.1
iso.3.6.1.2.1.2.2.1.10.1 = Counter32: 1109278671
root@azure-1f7af551-in1:/etc/netdata/node.d# snmpwalk -v1 -c public 64.227.127.154 1.3.6.1.2.1.2.2.1.16.1
iso.3.6.1.2.1.2.2.1.16.1 = Counter32: 2291806277
root@azure-1f7af551-in1:/etc/netdata/node.d# 

注意事项3

mikrotik设备记得打开snmp服务

代码语言:javascript
复制
[admin@MikroTik] > snmp/set enabled=yes
[admin@MikroTik] > snmp/print 
          enabled: yes
          contact: 
         location: 
        engine-id: 
      src-address: ::
      trap-target: 
   trap-community: public
     trap-version: 1
  trap-generators: temp-exception
[admin@MikroTik] >