readme

来自「监控软件rrdtools」· 代码 · 共 44 行

TXT
44
字号
SNMPstats.pl is a moderately simple and quick perl SNMP poller for simpleinterface traffic and other counters. It's written with flexible and easyhacking in mind, and is commented appropriately.It requires Net::SNMP version 2, available from CPAN.For the sake of simplicity, device names, IPs, and SNMP read strings arehard coded, but this can be easily substituted with something moredynamic. Structure for the devices hash is:$devices{<Canonical device name>}{'ip_address'} = <target ip address>				 {'snmp_read'}  = <SNMP read community>SNMP objects are stored in %oids. SNMP objects polled during device sweepsare stored in @poll_int, using named references to the object names usedas key variables in %oids.Interface stats are only collected for interfaces that have anifAdminStatus of 1. This cuts down on SNMP load quite a bit, given devicesare properly managed. Your mileage will vary based on device policies.RRDs are only created for interfaces with ifAdminStatus of 1. This givesyou some amount of scale control. Interfaces are checked for an existingRRD on each collection pass, and RRDs created as needed. They are NOTremoved if you admin down an interface, so stale RRD cleanup is yourproblem.One caveat to note is that RRDs are created with upper limits based onifSpeed. For autosensing 10/100 switches, this is a problem. In an effortto keep this utility simple, I formally declare it to be 'yourproblem'.This utility runs as a recurring loop, so it's meant to be run in thebackground like a daemon. You can strip the while/sleep sets and stuff itin cron, if you're so inclined. YMMV. The script itself is heavily commented, explaining what I do as I go. Be agood user, read the code before you run it. It's simple andstraightforward, and it's a good idea to understand how it works,especially if you're a novice user.Bill Nashbilln@billn.net / billn@gblx.net

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?