Package ZenModel :: Module identify
[hide private]
[frames] | no frames]

Source Code for Module ZenModel.identify

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
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