1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""identify
15
16 identify what type a device is
17
18 $Id: identify.py,v 1.1 2002/09/17 19:47:32 edahl Exp $"""
19
20 __version__ = "$Revision: 1.1 $"[11:-2]
21
22 from Products.SnmpCollector import SnmpSession
23 import sys
24
25 if __name__ == '__main__':
26 filename = sys.argv[1]
27 community = sys.argv[2]
28 if len(sys.argv) > 3:
29 port = sys.argv[3] or 161
30 lines = open(filename).readlines()
31 lineNumber = 0
32 for line in lines:
33 lineNumber += 1
34 dev = line.strip()
35 sess = SnmpSession(dev, community, timeout=1, retries=1)
36 print "device", dev,
37 try:
38 print "descr =", sess.get('.1.3.6.1.2.1.1.1.0').values()[0]
39 except:
40 print "problem with device", dev
41