20171024000002_check_mk_integration2.rb 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class CheckMkIntegration2 < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Setting.create_if_not_exists(
  7. title: 'Check_MK integration',
  8. name: 'check_mk_integration',
  9. area: 'Integration::Switch',
  10. description: 'Defines if Check_MK (http://mathias-kettner.com/check_mk.html) is enabled or not.',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: true,
  16. name: 'check_mk_integration',
  17. tag: 'boolean',
  18. options: {
  19. true => 'yes',
  20. false => 'no',
  21. },
  22. },
  23. ],
  24. },
  25. state: false,
  26. preferences: {
  27. prio: 1,
  28. permission: ['admin.integration'],
  29. },
  30. frontend: false
  31. )
  32. Setting.create_if_not_exists(
  33. title: 'Sender',
  34. name: 'check_mk_sender',
  35. area: 'Integration::CheckMK',
  36. description: 'Defines the sender email address of the service emails.',
  37. options: {
  38. form: [
  39. {
  40. display: '',
  41. null: false,
  42. name: 'check_mk_sender',
  43. tag: 'input',
  44. placeholder: 'check_mk@monitoring.example.com',
  45. },
  46. ],
  47. },
  48. state: 'check_mk@monitoring.example.com',
  49. preferences: {
  50. prio: 2,
  51. permission: ['admin.integration'],
  52. },
  53. frontend: false,
  54. )
  55. Setting.create_if_not_exists(
  56. title: 'Group',
  57. name: 'check_mk_group_id',
  58. area: 'Integration::CheckMK',
  59. description: 'Defines the group of created tickets.',
  60. options: {
  61. form: [
  62. {
  63. display: '',
  64. null: false,
  65. name: 'check_mk_group_id',
  66. tag: 'select',
  67. relation: 'Group',
  68. },
  69. ],
  70. },
  71. state: 1,
  72. preferences: {
  73. prio: 3,
  74. permission: ['admin.integration'],
  75. },
  76. frontend: false
  77. )
  78. Setting.create_if_not_exists(
  79. title: 'Auto close',
  80. name: 'check_mk_auto_close',
  81. area: 'Integration::CheckMK',
  82. description: 'Defines if tickets should be closed if service is recovered.',
  83. options: {
  84. form: [
  85. {
  86. display: '',
  87. null: true,
  88. name: 'check_mk_auto_close',
  89. tag: 'boolean',
  90. options: {
  91. true => 'yes',
  92. false => 'no',
  93. },
  94. translate: true,
  95. },
  96. ],
  97. },
  98. state: true,
  99. preferences: {
  100. prio: 4,
  101. permission: ['admin.integration'],
  102. },
  103. frontend: false
  104. )
  105. Setting.create_if_not_exists(
  106. title: 'Auto close state',
  107. name: 'check_mk_auto_close_state_id',
  108. area: 'Integration::CheckMK',
  109. description: 'Defines the state of auto closed tickets.',
  110. options: {
  111. form: [
  112. {
  113. display: '',
  114. null: false,
  115. name: 'check_mk_auto_close_state_id',
  116. tag: 'select',
  117. relation: 'TicketState',
  118. translate: true,
  119. },
  120. ],
  121. },
  122. state: 4,
  123. preferences: {
  124. prio: 5,
  125. permission: ['admin.integration'],
  126. },
  127. frontend: false
  128. )
  129. Setting.create_if_not_exists(
  130. title: 'Check_MK tolen',
  131. name: 'check_mk_token',
  132. area: 'Core',
  133. description: 'Defines the Check_MK token for allowing updates.',
  134. options: {},
  135. state: SecureRandom.hex(16),
  136. preferences: {
  137. permission: ['admin.integration'],
  138. },
  139. frontend: false
  140. )
  141. Setting.create_if_not_exists(
  142. title: 'Defines postmaster filter.',
  143. name: '5200_postmaster_filter_check_mk',
  144. area: 'Postmaster::PreFilter',
  145. description: 'Defines postmaster filter to manage Check_MK (http://mathias-kettner.com/check_mk.html) emails.',
  146. options: {},
  147. state: 'Channel::Filter::CheckMk',
  148. frontend: false
  149. )
  150. end
  151. end