20171024000001_monit_integration.rb 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class MonitIntegration < 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: 'Monit integration',
  8. name: 'monit_integration',
  9. area: 'Integration::Switch',
  10. description: 'Defines if Monit (https://mmonit.com/monit/) is enabled or not.',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: true,
  16. name: 'monit_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: 'monit_sender',
  35. area: 'Integration::Monit',
  36. description: 'Defines the sender email address of the service emails.',
  37. options: {
  38. form: [
  39. {
  40. display: '',
  41. null: false,
  42. name: 'monit_sender',
  43. tag: 'input',
  44. placeholder: 'monit@monitoring.example.com',
  45. },
  46. ],
  47. },
  48. state: 'monit@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: 'Auto close',
  57. name: 'monit_auto_close',
  58. area: 'Integration::Monit',
  59. description: 'Defines if tickets should be closed if service is recovered.',
  60. options: {
  61. form: [
  62. {
  63. display: '',
  64. null: true,
  65. name: 'monit_auto_close',
  66. tag: 'boolean',
  67. options: {
  68. true => 'yes',
  69. false => 'no',
  70. },
  71. translate: true,
  72. },
  73. ],
  74. },
  75. state: true,
  76. preferences: {
  77. prio: 3,
  78. permission: ['admin.integration'],
  79. },
  80. frontend: false
  81. )
  82. Setting.create_if_not_exists(
  83. title: 'Auto close state',
  84. name: 'monit_auto_close_state_id',
  85. area: 'Integration::Monit',
  86. description: 'Defines the state of auto closed tickets.',
  87. options: {
  88. form: [
  89. {
  90. display: '',
  91. null: false,
  92. name: 'monit_auto_close_state_id',
  93. tag: 'select',
  94. relation: 'TicketState',
  95. translate: true,
  96. },
  97. ],
  98. },
  99. state: 4,
  100. preferences: {
  101. prio: 4,
  102. permission: ['admin.integration'],
  103. },
  104. frontend: false
  105. )
  106. Setting.create_if_not_exists(
  107. title: 'Defines postmaster filter.',
  108. name: '5300_postmaster_filter_monit',
  109. area: 'Postmaster::PreFilter',
  110. description: 'Defines postmaster filter to manage Monit (https://mmonit.com/monit/) emails.',
  111. options: {},
  112. state: 'Channel::Filter::Monit',
  113. frontend: false
  114. )
  115. end
  116. end