-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinfo.py
94 lines (76 loc) · 2.31 KB
/
info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2010, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################
from zope.interface import implements
from Products.Zuul.infos import ProxyProperty
from Products.Zuul.infos.template import RRDDataSourceInfo
from Products.Zuul.infos.component import ComponentInfo
from Products.Zuul.decorators import info
from ZenPacks.zenoss.ZenAWS.interfaces import ICWMonitorDataSourceInfo, \
IEC2InstanceInfo, \
IEC2InstanceTypeInfo
class CWMonitorDataSourceInfo(RRDDataSourceInfo):
implements(ICWMonitorDataSourceInfo)
timeout = ProxyProperty('timeout')
cycletime = ProxyProperty('cycletime')
@property
def testable(self):
"""
We can NOT test this datsource against a specific device
"""
return False
class EC2InstanceTypeInfo(ComponentInfo):
implements(IEC2InstanceTypeInfo)
@property
@info
def name(self):
return self._object.name()
class EC2InstanceInfo(ComponentInfo):
implements(IEC2InstanceInfo)
@property
@info
def instance_id(self):
return self._object.titleOrId()
@property
@info
def device(self):
return {
'uid': self._object.getDeviceLink(),
'name': self._object.getDeviceName()
}
@property
@info
def dns_name(self):
return self._object.dns_name
@property
@info
def aws_name(self):
return self._object.aws_name
@property
@info
def placement(self):
return self._object.placement
@property
@info
def instance_type(self):
return self._object.instance_type
@property
@info
def image_id(self):
return self._object.image_id
@property
@info
def state(self):
return self._object.state
@property
@info
def private_ip_addresses(self):
pv_ip = self._object.private_ip_addresses
if not pv_ip:
pv_ip = []
return pv_ip