我们在使用check_snmp_int.pl来抓取网卡流量信息时,会发现有时指定一个接口名,却列出多个,例如
[root@Centos libexec]# ./check_snmp_int.pl -H 59.42.155.98 -C kpelle -n FastEthernet-1
FastEthernet-1:UP, FastEthernet-12:UP, FastEthernet-10:UP:3 UP: OK
因为默认check_snmp_int.pl不是完全匹配,所以把包含有FastEthernet-1的接口都列出来了,
 
这样的话,不能监控起一个接口来,是很麻烦的事情,可以通过使用^和$来实现监控起一个接口。如下
[root@Centos libexec]# ./check_snmp_int.pl -H 59.42.155.98 -C kpelle -n '^FastEthernet-1$'
FastEthernet-1:UP:1 UP: OK
使用^来匹配开头,再使用$来匹配结尾,这样就能使接口名监控到了。