20160412000003_add_nagios_integration.rb 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. class AddNagiosIntegration < ActiveRecord::Migration
  2. def up
  3. Setting.create_if_not_exists(
  4. title: 'Define postmaster filter.',
  5. name: '5100_postmaster_filter_nagios',
  6. area: 'Postmaster::PreFilter',
  7. description: 'Define postmaster filter for manage Nagios (http://www.nagios.org) emails.',
  8. options: {},
  9. state: 'Channel::Filter::Nagios',
  10. frontend: false
  11. )
  12. Setting.create_if_not_exists(
  13. title: 'Nagios integration',
  14. name: 'nagios_integration',
  15. area: 'Integration::Nagios',
  16. description: 'Define if Nagios (http://www.nagios.org) is enabled or not.',
  17. options: {
  18. form: [
  19. {
  20. display: '',
  21. null: true,
  22. name: 'nagios_integration',
  23. tag: 'boolean',
  24. options: {
  25. true => 'yes',
  26. false => 'no',
  27. },
  28. },
  29. ],
  30. },
  31. state: false,
  32. preferences: { prio: 1 },
  33. frontend: false
  34. )
  35. Setting.create_if_not_exists(
  36. title: 'Sender',
  37. name: 'nagios_sender',
  38. area: 'Integration::Nagios',
  39. description: 'Define the sender email address of Nagios emails.',
  40. options: {
  41. form: [
  42. {
  43. display: '',
  44. null: false,
  45. name: 'nagios_sender',
  46. tag: 'input',
  47. },
  48. ],
  49. },
  50. state: 'nagios@monitoring.example.com',
  51. frontend: false,
  52. preferences: { prio: 2 },
  53. )
  54. Setting.create_if_not_exists(
  55. title: 'Auto close',
  56. name: 'nagios_auto_close',
  57. area: 'Integration::Nagios',
  58. description: 'Define if tickets should be closed if service is recovered.',
  59. options: {
  60. form: [
  61. {
  62. display: '',
  63. null: true,
  64. name: 'nagios_auto_close',
  65. tag: 'boolean',
  66. options: {
  67. true => 'yes',
  68. false => 'no',
  69. },
  70. },
  71. ],
  72. },
  73. state: true,
  74. preferences: { prio: 3 },
  75. frontend: false
  76. )
  77. Setting.create_if_not_exists(
  78. title: 'Auto close state',
  79. name: 'nagios_auto_close_state_id',
  80. area: 'Integration::Nagios',
  81. description: 'Define the ticket state of auto closed tickets.',
  82. options: {
  83. form: [
  84. {
  85. display: '',
  86. null: false,
  87. name: 'nagios_auto_close_state_id',
  88. tag: 'select',
  89. relation: 'TicketState',
  90. },
  91. ],
  92. },
  93. state: 4,
  94. preferences: { prio: 4 },
  95. frontend: false
  96. )
  97. end
  98. end