trabajo-afectivo/db/migrate/20171024000002_check_mk_integration2.rb

156 lines
4.3 KiB
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class CheckMkIntegration2 < ActiveRecord::Migration[4.2]
2017-08-21 23:13:19 +00:00
def up
# return if it's a new setup
return if !Setting.exists?(name: 'system_init_done')
2017-08-21 23:13:19 +00:00
Setting.create_if_not_exists(
title: 'Check_MK integration',
name: 'check_mk_integration',
area: 'Integration::Switch',
2017-08-21 23:13:19 +00:00
description: 'Defines if Check_MK (http://mathias-kettner.com/check_mk.html) is enabled or not.',
options: {
2017-08-21 23:13:19 +00:00
form: [
{
display: '',
null: true,
name: 'check_mk_integration',
tag: 'boolean',
2017-08-21 23:13:19 +00:00
options: {
true => 'yes',
false => 'no',
},
},
],
},
state: false,
2017-08-21 23:13:19 +00:00
preferences: {
prio: 1,
2017-08-21 23:13:19 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-08-21 23:13:19 +00:00
)
Setting.create_if_not_exists(
title: 'Sender',
name: 'check_mk_sender',
area: 'Integration::CheckMK',
description: 'Defines the sender email address of the service emails.',
options: {
form: [
{
display: '',
null: false,
name: 'check_mk_sender',
tag: 'input',
placeholder: 'check_mk@monitoring.example.com',
},
],
},
state: 'check_mk@monitoring.example.com',
preferences: {
prio: 2,
permission: ['admin.integration'],
},
frontend: false,
)
2017-08-21 23:13:19 +00:00
Setting.create_if_not_exists(
title: 'Group',
name: 'check_mk_group_id',
area: 'Integration::CheckMK',
2017-08-21 23:13:19 +00:00
description: 'Defines the group of created tickets.',
options: {
2017-08-21 23:13:19 +00:00
form: [
{
display: '',
null: false,
name: 'check_mk_group_id',
tag: 'select',
2017-08-21 23:13:19 +00:00
relation: 'Group',
},
],
},
state: 1,
2017-08-21 23:13:19 +00:00
preferences: {
prio: 3,
2017-08-21 23:13:19 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-08-21 23:13:19 +00:00
)
Setting.create_if_not_exists(
title: 'Auto close',
name: 'check_mk_auto_close',
area: 'Integration::CheckMK',
2017-08-21 23:13:19 +00:00
description: 'Defines if tickets should be closed if service is recovered.',
options: {
2017-08-21 23:13:19 +00:00
form: [
{
display: '',
null: true,
name: 'check_mk_auto_close',
tag: 'boolean',
options: {
2017-08-21 23:13:19 +00:00
true => 'yes',
false => 'no',
},
translate: true,
2017-08-21 23:13:19 +00:00
},
],
},
state: true,
2017-08-21 23:13:19 +00:00
preferences: {
prio: 4,
2017-08-21 23:13:19 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-08-21 23:13:19 +00:00
)
Setting.create_if_not_exists(
title: 'Auto close state',
name: 'check_mk_auto_close_state_id',
area: 'Integration::CheckMK',
2017-08-21 23:13:19 +00:00
description: 'Defines the state of auto closed tickets.',
options: {
2017-08-21 23:13:19 +00:00
form: [
{
display: '',
null: false,
name: 'check_mk_auto_close_state_id',
tag: 'select',
relation: 'TicketState',
translate: true,
2017-08-21 23:13:19 +00:00
},
],
},
state: 4,
2017-08-21 23:13:19 +00:00
preferences: {
prio: 5,
2017-08-21 23:13:19 +00:00
permission: ['admin.integration'],
},
frontend: false
2017-08-21 23:13:19 +00:00
)
Setting.create_if_not_exists(
title: 'Check_MK tolen',
name: 'check_mk_token',
area: 'Core',
2017-08-21 23:13:19 +00:00
description: 'Defines the Check_MK token for allowing updates.',
options: {},
state: SecureRandom.hex(16),
2017-08-21 23:13:19 +00:00
preferences: {
permission: ['admin.integration'],
},
frontend: false
2017-08-21 23:13:19 +00:00
)
Setting.create_if_not_exists(
title: 'Defines postmaster filter.',
name: '5200_postmaster_filter_check_mk',
area: 'Postmaster::PreFilter',
description: 'Defines postmaster filter to manage Check_MK (http://mathias-kettner.com/check_mk.html) emails.',
options: {},
state: 'Channel::Filter::CheckMk',
frontend: false
)
2017-08-21 23:13:19 +00:00
end
end