Fuel plugin to collect Logging Monitoring and Alerting metrics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller.pp 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. # Copyright 2015 Mirantis, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. notice('fuel-plugin-lma-collector: controller.pp')
  15. $ceilometer = hiera_hash('ceilometer', {})
  16. $lma_collector = hiera_hash('lma_collector')
  17. $rabbit = hiera_hash('rabbit')
  18. $storage_options = hiera_hash('storage', {})
  19. $murano = hiera_hash('murano')
  20. $sahara = hiera_hash('sahara')
  21. if $ceilometer['enabled'] {
  22. $notification_topics = ['notifications', 'lma_notifications']
  23. }
  24. else {
  25. $notification_topics = ['lma_notifications']
  26. }
  27. # Make sure the Log and Metric collector services are configured with the
  28. # "pacemaker" provider
  29. Service<| title == 'log_collector' |> {
  30. provider => 'pacemaker'
  31. }
  32. Service<| title == 'metric_collector' |> {
  33. provider => 'pacemaker'
  34. }
  35. # OpenStack logs and notifications are useful for deriving metrics, so we enable
  36. # them even if Elasticsearch is disabled.
  37. if hiera('lma::collector::elasticsearch::server', false) or hiera('lma::collector::influxdb::server', false){
  38. # Sahara notifications
  39. if $sahara['enabled'] {
  40. include sahara::params
  41. $sahara_api_service = $::sahara::params::api_service_name
  42. $sahara_engine_service = $::sahara::params::engine_service_name
  43. sahara_config { 'DEFAULT/enable_notifications':
  44. value => true,
  45. notify => Service[$sahara_api_service, $sahara_engine_service],
  46. }
  47. sahara_config { 'DEFAULT/notification_topics':
  48. value => $notification_topics,
  49. notify => Service[$sahara_api_service, $sahara_engine_service],
  50. }
  51. sahara_config { 'DEFAULT/notification_driver':
  52. value => 'messaging',
  53. notify => Service[$sahara_api_service, $sahara_engine_service],
  54. }
  55. service { [$sahara_api_service, $sahara_engine_service]:
  56. hasstatus => true,
  57. hasrestart => true,
  58. }
  59. }
  60. # Nova notifications
  61. include nova::params
  62. $nova_api_service = $::nova::params::api_service_name
  63. $nova_conductor_service = $::nova::params::conductor_service_name
  64. $nova_scheduler_service = $::nova::params::scheduler_service_name
  65. nova_config { 'DEFAULT/notification_topics':
  66. value => $notification_topics,
  67. notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
  68. }
  69. nova_config { 'DEFAULT/notification_driver':
  70. value => 'messaging',
  71. notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
  72. }
  73. nova_config { 'DEFAULT/notify_on_state_change':
  74. value => 'vm_and_task_state',
  75. notify => Service[$nova_api_service, $nova_conductor_service, $nova_scheduler_service],
  76. }
  77. service { [$nova_api_service, $nova_conductor_service, $nova_scheduler_service]:
  78. hasstatus => true,
  79. hasrestart => true,
  80. }
  81. # Cinder notifications
  82. include cinder::params
  83. $cinder_api_service = $::cinder::params::api_service
  84. $cinder_scheduler_service = $::cinder::params::scheduler_service
  85. $cinder_volume_service = $::cinder::params::volume_service
  86. if $storage_options['volumes_ceph'] {
  87. # In this case, cinder-volume runs on controller node
  88. $cinder_services = [$cinder_api_service, $cinder_scheduler_service, $cinder_volume_service]
  89. } else {
  90. $cinder_services = [$cinder_api_service, $cinder_scheduler_service]
  91. }
  92. cinder_config { 'DEFAULT/notification_topics':
  93. value => $notification_topics,
  94. notify => Service[$cinder_services],
  95. }
  96. cinder_config { 'DEFAULT/notification_driver':
  97. value => 'messaging',
  98. notify => Service[$cinder_services],
  99. }
  100. service { $cinder_services:
  101. hasstatus => true,
  102. hasrestart => true,
  103. }
  104. # Keystone notifications
  105. # Keystone is executed as a WSGI application inside Apache so the Apache
  106. # service needs to be restarted if necessary
  107. include apache::params
  108. include apache::service
  109. keystone_config { 'DEFAULT/notification_topics':
  110. value => $notification_topics,
  111. notify => Class['apache::service'],
  112. }
  113. keystone_config { 'DEFAULT/notification_driver':
  114. value => 'messaging',
  115. notify => Class['apache::service'],
  116. }
  117. # Neutron notifications
  118. include neutron::params
  119. neutron_config { 'DEFAULT/notification_topics':
  120. value => $notification_topics,
  121. notify => Service[$::neutron::params::server_service],
  122. }
  123. neutron_config { 'DEFAULT/notification_driver':
  124. value => 'messaging',
  125. notify => Service[$::neutron::params::server_service],
  126. }
  127. # Enable pagination for Neutron
  128. neutron_config { 'DEFAULT/allow_pagination':
  129. value => true,
  130. notify => Service[$::neutron::params::server_service],
  131. }
  132. neutron_config { 'DEFAULT/pagination_max_limit':
  133. value => '100',
  134. notify => Service[$::neutron::params::server_service],
  135. }
  136. service { $::neutron::params::server_service:
  137. hasstatus => true,
  138. hasrestart => true,
  139. }
  140. # Glance notifications
  141. include glance::params
  142. $glance_api_service = $::glance::params::api_service_name
  143. $glance_registry_service = $::glance::params::registry_service_name
  144. # Default value is 'image.localhost' for Glance
  145. $glance_publisher_id = "image.${::hostname}"
  146. glance_api_config { 'DEFAULT/notification_topics':
  147. value => $notification_topics,
  148. notify => Service[$glance_api_service],
  149. }
  150. glance_api_config { 'DEFAULT/notification_driver':
  151. value => 'messaging',
  152. notify => Service[$glance_api_service],
  153. }
  154. glance_api_config { 'DEFAULT/default_publisher_id':
  155. value => $glance_publisher_id,
  156. notify => Service[$glance_api_service],
  157. }
  158. glance_registry_config { 'DEFAULT/notification_topics':
  159. value => $notification_topics,
  160. notify => Service[$glance_registry_service],
  161. }
  162. glance_registry_config { 'DEFAULT/notification_driver':
  163. value => 'messaging',
  164. notify => Service[$glance_registry_service],
  165. }
  166. glance_registry_config { 'DEFAULT/default_publisher_id':
  167. value => $glance_publisher_id,
  168. notify => Service[$glance_registry_service],
  169. }
  170. service { [$glance_api_service, $glance_registry_service]:
  171. hasstatus => true,
  172. hasrestart => true,
  173. }
  174. # Heat notifications
  175. include heat::params
  176. $heat_api_service = $::heat::params::api_service_name
  177. $heat_engine_service = $::heat::params::engine_service_name
  178. heat_config { 'DEFAULT/notification_topics':
  179. value => $notification_topics,
  180. notify => Service[$heat_api_service, $heat_engine_service],
  181. }
  182. heat_config { 'DEFAULT/notification_driver':
  183. value => 'messaging',
  184. notify => Service[$heat_api_service, $heat_engine_service],
  185. }
  186. service { $heat_api_service:
  187. hasstatus => true,
  188. hasrestart => true,
  189. }
  190. # The heat-engine service is managed by Pacemaker.
  191. service { $heat_engine_service:
  192. hasstatus => true,
  193. hasrestart => true,
  194. provider => 'pacemaker',
  195. }
  196. lma_collector::logs::openstack { 'nova': }
  197. # For every virtual network that exists, Neutron spawns one metadata proxy
  198. # service that will log to a separate file in the Neutron log directory.
  199. # Eventually it may be hundreds of these files and Heka will have trouble
  200. # coping with the situation. See bug #1547402 for details.
  201. lma_collector::logs::openstack { 'neutron':
  202. service_match => '(dhcp-agent|l3-agent|metadata-agent|neutron-netns-cleanup|openvswitch-agent|server)',
  203. }
  204. lma_collector::logs::openstack { 'cinder': }
  205. lma_collector::logs::openstack { 'glance': }
  206. lma_collector::logs::openstack { 'heat': }
  207. lma_collector::logs::openstack { 'keystone': }
  208. class {'lma_collector::logs::keystone_wsgi': }
  209. lma_collector::logs::openstack { 'horizon': }
  210. if $murano['enabled'] {
  211. lma_collector::logs::openstack { 'murano': }
  212. }
  213. if $sahara['enabled'] {
  214. lma_collector::logs::openstack { 'sahara': }
  215. }
  216. if ! $storage_options['objects_ceph'] {
  217. class { 'lma_collector::logs::swift':
  218. file_match => 'swift-all\.log\.?(?P<Seq>\d*)$',
  219. priority => '["^Seq"]',
  220. }
  221. }
  222. class { 'lma_collector::logs::pacemaker': }
  223. }
  224. # Metrics
  225. if hiera('lma::collector::influxdb::server', false) {
  226. class { 'lma_collector::logs::counter':
  227. hostname => $::hostname,
  228. }
  229. # TODO(all): This class is still called to ensure the sandbox deletion
  230. # when upgrading the plugin. Can be removed for next release after 0.10.0.
  231. class { 'lma_collector::logs::http_metrics': }
  232. class { 'lma_collector::logs::aggregated_http_metrics': }
  233. }
  234. if hiera('lma::collector::infrastructure_alerting::server', false) {
  235. $deployment_id = hiera('deployment_id')
  236. lma_collector::gse_nagios { 'global':
  237. openstack_deployment_name => $deployment_id,
  238. server => hiera('lma::collector::infrastructure_alerting::server'),
  239. http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
  240. http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
  241. user => hiera('lma::collector::infrastructure_alerting::user'),
  242. password => hiera('lma::collector::infrastructure_alerting::password'),
  243. message_type => $lma_collector['gse_cluster_global']['output_message_type'],
  244. # Following parameter must match the lma_infrastructure_alerting::params::nagios_global_vhostname_prefix
  245. virtual_hostname => '00-global-clusters',
  246. }
  247. lma_collector::gse_nagios { 'nodes':
  248. openstack_deployment_name => $deployment_id,
  249. server => hiera('lma::collector::infrastructure_alerting::server'),
  250. http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
  251. http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
  252. user => hiera('lma::collector::infrastructure_alerting::user'),
  253. password => hiera('lma::collector::infrastructure_alerting::password'),
  254. message_type => $lma_collector['gse_cluster_node']['output_message_type'],
  255. # Following parameter must match the lma_infrastructure_alerting::params::nagios_node_vhostname_prefix
  256. virtual_hostname => '00-node-clusters',
  257. }
  258. # Purge remaining files from previous 0.10.x version
  259. $toml_metric_collector_to_purge = prefix([
  260. 'filter-afd_api_backends.toml', 'filter-afd_api_endpoints.toml',
  261. 'filter-afd_service_rabbitmq_disk.toml',
  262. 'filter-afd_service_rabbitmq_memory.toml',
  263. 'filter-afd_service_rabbitmq_queue.toml',
  264. 'filter-afd_workers.toml',
  265. 'filter-service_heartbeat.toml',
  266. 'encoder-nagios_gse_global_clusters.toml',
  267. 'encoder-nagios_gse_node_clusters.toml',
  268. 'output-nagios_gse_global_clusters.toml',
  269. 'output-nagios_gse_node_clusters.toml',
  270. ], '/etc/metric_collector/')
  271. file { $toml_metric_collector_to_purge:
  272. ensure => absent,
  273. } ->
  274. lma_collector::gse_nagios { 'services':
  275. openstack_deployment_name => $deployment_id,
  276. server => hiera('lma::collector::infrastructure_alerting::server'),
  277. http_port => hiera('lma::collector::infrastructure_alerting::http_port'),
  278. http_path => hiera('lma::collector::infrastructure_alerting::http_path'),
  279. user => hiera('lma::collector::infrastructure_alerting::user'),
  280. password => hiera('lma::collector::infrastructure_alerting::password'),
  281. message_type => $lma_collector['gse_cluster_service']['output_message_type'],
  282. # Following parameter must match the lma_infrastructure_alerting::params::nagios_node_vhostname_prefix
  283. virtual_hostname => '00-service-clusters',
  284. }
  285. }