forked from docc-lab/openstack-build-ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-compute-telemetry.sh
executable file
·182 lines (160 loc) · 6.7 KB
/
setup-compute-telemetry.sh
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/sh
##
## Setup a OpenStack compute node for Ceilometer.
##
set -x
# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "`dirname $0`/setup-lib.sh"
if [ "$HOSTNAME" = "$CONTROLLER" -o "$HOSTNAME" = "$NETWORKMANAGER" ]; then
exit 0;
fi
if [ -f $OURDIR/setup-compute-telemetry-done ]; then
exit 0
fi
logtstart "compute-telemetry"
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
if [ $OSVERSION -ge $OSMITAKA ]; then
PROJECT_DOMAIN_PARAM="project_domain_name"
USER_DOMAIN_PARAM="user_domain_name"
else
PROJECT_DOMAIN_PARAM="project_domain_id"
USER_DOMAIN_PARAM="user_domain_id"
fi
if [ $OSVERSION -ge $OSMITAKA ]; then
AUTH_TYPE_PARAM="auth_type"
else
AUTH_TYPE_PARAM="auth_plugin"
fi
maybe_install_packages ceilometer-agent-compute
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT auth_strategy keystone
crudini --set /etc/ceilometer/ceilometer.conf glance host $CONTROLLER
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT verbose $VERBOSE_LOGGING
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT debug $DEBUG_LOGGING
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT \
log_dir /var/log/ceilometer
if [ $OSVERSION -lt $OSKILO ]; then
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT rpc_backend rabbit
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT rabbit_host $CONTROLLER
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT rabbit_userid ${RABBIT_USER}
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT rabbit_password "${RABBIT_PASS}"
elif [ $OSVERSION -lt $OSNEWTON ]; then
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT rpc_backend rabbit
crudini --set /etc/ceilometer/ceilometer.conf oslo_messaging_rabbit \
rabbit_host $CONTROLLER
crudini --set /etc/ceilometer/ceilometer.conf oslo_messaging_rabbit \
rabbit_userid ${RABBIT_USER}
crudini --set /etc/ceilometer/ceilometer.conf oslo_messaging_rabbit \
rabbit_password "${RABBIT_PASS}"
else
crudini --set /etc/ceilometer/ceilometer.conf DEFAULT \
transport_url $RABBIT_URL
fi
if [ $OSVERSION -lt $OSKILO ]; then
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
auth_uri http://${CONTROLLER}:5000/${KAPISTR}
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
identity_uri http://${CONTROLLER}:${KADMINPORT}
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
admin_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
admin_user ceilometer
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
admin_password "${CEILOMETER_PASS}"
else
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
${AUTH_URI_KEY} http://${CONTROLLER}:5000
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
auth_url http://${CONTROLLER}:${KADMINPORT}
if [ $OSVERSION -ge $OSMITAKA -o $KEYSTONEUSEMEMCACHE -eq 1 ]; then
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
memcached_servers ${CONTROLLER}:11211
fi
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
${AUTH_TYPE_PARAM} password
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
${USER_DOMAIN_PARAM} default
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
project_name service
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
username ceilometer
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
password "$CEILOMETER_PASS"
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken \
region_name "$REGION"
fi
if [ $OSVERSION -lt $OSMITAKA ]; then
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_auth_url http://${CONTROLLER}:5000/${KAPISTR}
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_username ceilometer
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_password ${CEILOMETER_PASS}
if [ $OSVERSION -ge $OSKILO ]; then
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_endpoint_type internalURL
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
os_region_name $REGION
fi
else
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
${AUTH_TYPE_PARAM} password
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
auth_url http://${CONTROLLER}:5000/${KAPISTR}
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
username ceilometer
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
project_name service
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
password ${CEILOMETER_PASS}
if [ $OSVERSION -ge $OSKILO ]; then
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
interface internalURL
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
region_name $REGION
fi
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
${PROJECT_DOMAIN_PARAM} default
crudini --set /etc/ceilometer/ceilometer.conf service_credentials \
${USER_DOMAIN_PARAM} default
fi
crudini --set /etc/ceilometer/ceilometer.conf notification \
store_events true
crudini --set /etc/ceilometer/ceilometer.conf notification \
disable_non_metric_meters false
if [ $OSVERSION -le $OSJUNO ]; then
crudini --set /etc/ceilometer/ceilometer.conf publisher \
metering_secret ${CEILOMETER_SECRET}
else
crudini --set /etc/ceilometer/ceilometer.conf publisher \
telemetry_secret ${CEILOMETER_SECRET}
fi
crudini --del /etc/ceilometer/ceilometer.conf database connection
crudini --del /etc/ceilometer/ceilometer.conf DEFAULT auth_host
crudini --del /etc/ceilometer/ceilometer.conf DEFAULT auth_port
crudini --del /etc/ceilometer/ceilometer.conf DEFAULT auth_protocol
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit True
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour
crudini --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state
if [ $OSVERSION -lt $OSMITAKA ]; then
crudini --set /etc/nova/nova.conf DEFAULT notification_driver messagingv2
else
crudini --set /etc/nova/nova.conf oslo_messaging_notifications driver messagingv2
fi
service_restart ceilometer-agent-compute
service_enable ceilometer-agent-compute
service_restart nova-compute
service_restart ceilometer-agent-compute
touch $OURDIR/setup-compute-telemetry-done
logtend "compute-telemetry"
exit 0