1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 __doc__="""cmdDeviceLoader.py
16
17 load devices from the command line by parsing a text file.
18
19 $Id: CmdDeviceLoader.py,v 1.1 2004/03/26 23:59:52 edahl Exp $"""
20
21 __version__ = "$Revision: 1.1 $"[11:-2]
22
23 from BasicDeviceLoader import BasicDeviceLoader
24 from Products.ZenUtils.BasicLoader import BasicLoader
25
27
31
32
33 - def loaderBody(self,line):
34 """loader body override to customize what will load"""
35 fqdn = line
36 self.log.info("Processing machine %s -- line %i" %
37 (fqdn,self.lineNumber))
38 dev = self.getDevice(fqdn)
39 self.getDeviceInterfaces(dev)
40 if self.options.system:
41 sys = self.getSystem(self.options.system)
42 dev.addRelation('system', sys)
43 self.getPerformanceMonitor(self.options.perfServer, dev)
44 self.getStatusMonitor(self.options.statusMonitor, dev)
45
46
48 BasicLoader.buildOptions(self)
49
50 self.parser.add_option('--devicePath',
51 dest='devicePath',
52 default=None,
53 help='default device path for devices being loaded')
54
55 self.parser.add_option('-N', '--noclassifier',
56 dest='useClassifier',
57 action="store_false",
58 default=1,
59 help='turn off the classifier during load')
60
61 self.parser.add_option('--systemPath',
62 dest='systemPath',
63 default=None,
64 help='System Path to device /Mail/MTA')
65
66 self.parser.add_option('--perfServer',
67 dest='perfServer',
68 default='',
69 help='Performance data collector with which to link Dmd devices')
70
71 self.parser.add_option('--status',
72 dest='statusMonitor',
73 default='Default',
74 help='Status Monitor with which to link Dmd devices')
75
76 self.parser.add_option('-c', '--snmpCommunity',
77 dest='snmpCommunity',
78 default='public',
79 help='SNMP community string')
80
81 self.parser.add_option('-P', '--snmpPort',
82 dest='snmpPort',
83 default=161,
84 type='int',
85 help='SNMP port')
86
87 self.parser.add_option('--manufacturer',
88 dest='manufacturer',
89 default='',
90 help='manufacturer of the device')
91
92 self.parser.add_option('--model',
93 dest='model',
94 default='',
95 help='model of the device')
96
97 self.parser.add_option('--groupPath',
98 dest='groupPath',
99 default='',
100 help='groupPath of the device')
101
102
103 if __name__ == "__main__":
104 loader = BasicDeviceLoader()
105 loader.loadDatabase()
106 print "Database Load is finished!"
107