trabajo-afectivo/db/migrate/20171024000001_monit_integration.rb

121 lines
3.3 KiB
Ruby
Raw Permalink Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
2017-10-24 23:24:07 +00:00
class MonitIntegration < ActiveRecord::Migration[4.2]
def up
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
2017-10-24 23:24:07 +00:00
Setting.create_if_not_exists(
title: 'Monit integration',
name: 'monit_integration',
area: 'Integration::Switch',
2017-10-24 23:24:07 +00:00
description: 'Defines if Monit (https://mmonit.com/monit/) is enabled or not.',
options: {
2017-10-24 23:24:07 +00:00
form: [
{
display: '',
null: true,
name: 'monit_integration',
tag: 'boolean',
2017-10-24 23:24:07 +00:00
options: {
true => 'yes',
false => 'no',
},
},
],
},
state: false,
2017-10-24 23:24:07 +00:00
preferences: {
prio: 1,
2017-10-24 23:24:07 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-10-24 23:24:07 +00:00
)
Setting.create_if_not_exists(
title: 'Sender',
name: 'monit_sender',
area: 'Integration::Monit',
2017-10-24 23:24:07 +00:00
description: 'Defines the sender email address of the service emails.',
options: {
2017-10-24 23:24:07 +00:00
form: [
{
display: '',
null: false,
name: 'monit_sender',
tag: 'input',
2017-10-24 23:24:07 +00:00
placeholder: 'monit@monitoring.example.com',
},
],
},
state: 'monit@monitoring.example.com',
2017-10-24 23:24:07 +00:00
preferences: {
prio: 2,
2017-10-24 23:24:07 +00:00
permission: ['admin.integration'],
},
frontend: false,
2017-10-24 23:24:07 +00:00
)
Setting.create_if_not_exists(
title: 'Auto close',
name: 'monit_auto_close',
area: 'Integration::Monit',
2017-10-24 23:24:07 +00:00
description: 'Defines if tickets should be closed if service is recovered.',
options: {
2017-10-24 23:24:07 +00:00
form: [
{
display: '',
null: true,
name: 'monit_auto_close',
tag: 'boolean',
options: {
2017-10-24 23:24:07 +00:00
true => 'yes',
false => 'no',
},
translate: true,
},
],
},
state: true,
2017-10-24 23:24:07 +00:00
preferences: {
prio: 3,
2017-10-24 23:24:07 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-10-24 23:24:07 +00:00
)
Setting.create_if_not_exists(
title: 'Auto close state',
name: 'monit_auto_close_state_id',
area: 'Integration::Monit',
2017-10-24 23:24:07 +00:00
description: 'Defines the state of auto closed tickets.',
options: {
2017-10-24 23:24:07 +00:00
form: [
{
display: '',
null: false,
name: 'monit_auto_close_state_id',
tag: 'select',
relation: 'TicketState',
2017-10-24 23:24:07 +00:00
translate: true,
},
],
},
state: 4,
2017-10-24 23:24:07 +00:00
preferences: {
prio: 4,
2017-10-24 23:24:07 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-10-24 23:24:07 +00:00
)
Setting.create_if_not_exists(
title: 'Defines postmaster filter.',
name: '5300_postmaster_filter_monit',
area: 'Postmaster::PreFilter',
2017-10-24 23:24:07 +00:00
description: 'Defines postmaster filter to manage Monit (https://mmonit.com/monit/) emails.',
options: {},
state: 'Channel::Filter::Monit',
frontend: false
2017-10-24 23:24:07 +00:00
)
end
end