-
Notifications
You must be signed in to change notification settings - Fork 46
/
analytics.py
132 lines (112 loc) · 3.94 KB
/
analytics.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from fabfile.config import testbed
from fabfile.utils.fabos import detect_ostype, get_openstack_sku
from fabfile.utils.cluster import get_orchestrator
def get_collector_syslog_port():
env_obj = getattr(testbed, 'env')
rsyslog_dict = getattr(env_obj, 'rsyslog_params', None)
if ((rsyslog_dict is not None) and
(rsyslog_dict['status'].lower() == 'enable')):
if 'port' in rsyslog_dict:
return rsyslog_dict['port']
else:
return 19876 # default port number.
else:
return None
# end get_collector_syslog_port
def get_database_ttl():
return getattr(testbed, 'database_ttl', None)
#end get_database_ttl
def get_database_dir():
return getattr(testbed, 'database_dir', None)
def get_analytics_data_dir():
return getattr(testbed, 'analytics_data_dir',
'/var/lib/cassandra/data')
def get_ssd_data_dir():
return getattr(testbed, 'ssd_data_dir', None)
def get_redis_password():
return getattr(testbed, 'redis_password', None)
#end get_database_dir
def get_analytics_config_audit_ttl():
return getattr(testbed, 'analytics_config_audit_ttl', None)
#end get_analytics_config_audit_ttl
def get_analytics_statistics_ttl():
return getattr(testbed, 'analytics_statistics_ttl', None)
#end get_analytics_statistics_ttl
def get_analytics_flow_ttl():
return getattr(testbed, 'analytics_flow_ttl', None)
#end get_analytics_flow_ttl
def get_minimum_diskGB():
return getattr(testbed, 'minimum_diskGB', '256')
#end get_analytics_flow_ttl
def get_kafka_enabled():
return getattr(testbed, 'kafka_enabled', True)
def get_enable_ceilometer():
return getattr(testbed, 'enable_ceilometer', False)
#end get_enable_ceilometer
def is_ceilometer_supported(use_install_repo=False):
# Ceilometer should be enabled
enable_ceilometer = get_enable_ceilometer()
if not enable_ceilometer:
return False
# Orchestrator should be openstack
orchestrator = get_orchestrator()
if orchestrator != 'openstack':
return False
# Currently supported only on ubuntu icehouse
os_type = detect_ostype()
openstack_sku = get_openstack_sku(use_install_repo)
if os_type in ['redhat'] and \
openstack_sku in ['juno']:
return True
elif os_type in ['ubuntu'] and \
openstack_sku in ['juno']:
return True
else:
return False
#end is_ceilometer_supported
def is_ceilometer_install_supported(use_install_repo=False):
supported = is_ceilometer_supported(use_install_repo)
if not supported:
return False
# Not supported on redhat
os_type = detect_ostype()
if os_type == 'redhat':
return False
return supported
#end is_ceilometer_install_supported
def is_ceilometer_provision_supported(use_install_repo=False):
supported = is_ceilometer_supported(use_install_repo)
if not supported:
return False
# Not supported on redhat
os_type = detect_ostype()
if os_type == 'redhat':
return False
return supported
#end is_ceilometer_provision_supported
def is_ceilometer_contrail_plugin_install_supported():
return is_ceilometer_supported()
#end is_ceilometer_contrail_plugin_install_supported
def is_ceilometer_contrail_plugin_provision_supported():
return is_ceilometer_supported()
#end is_ceilometer_contrail_plugin_provision_supported
def is_ceilometer_compute_install_supported():
supported = is_ceilometer_supported()
if not supported:
return False
# Not supported on redhat
os_type = detect_ostype()
if os_type == 'redhat':
return False
return supported
#end is_ceilometer_compute_install_supported
def is_ceilometer_compute_provision_supported():
supported = is_ceilometer_supported()
if not supported:
return False
# Not supported on redhat
os_type = detect_ostype()
if os_type == 'redhat':
return False
return supported
#end is_ceilometer_compute_provision_supported