2017-10-25 11:20:10 +00:00
|
|
|
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.find_by(name: 'system_init_done')
|
|
|
|
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
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.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-08-21 23:13:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'check_mk_integration',
|
|
|
|
tag: 'boolean',
|
2017-08-21 23:13:19 +00:00
|
|
|
options: {
|
|
|
|
true => 'yes',
|
|
|
|
false => 'no',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: false,
|
2017-08-21 23:13:19 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 1,
|
2017-08-21 23:13:19 +00:00
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-08-21 23:13:19 +00:00
|
|
|
)
|
2017-10-25 11:20:10 +00:00
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Sender',
|
|
|
|
name: 'check_mk_sender',
|
|
|
|
area: 'Integration::CheckMK',
|
2017-10-25 11:20:10 +00:00
|
|
|
description: 'Defines the sender email address of the service emails.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-10-25 11:20:10 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: false,
|
|
|
|
name: 'check_mk_sender',
|
|
|
|
tag: 'input',
|
2017-10-25 11:20:10 +00:00
|
|
|
placeholder: 'check_mk@monitoring.example.com',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 'check_mk@monitoring.example.com',
|
2017-10-25 11:20:10 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 2,
|
2017-10-25 11:20:10 +00:00
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false,
|
2017-10-25 11:20:10 +00:00
|
|
|
)
|
2017-08-21 23:13:19 +00:00
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
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.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-08-21 23:13:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: false,
|
|
|
|
name: 'check_mk_group_id',
|
|
|
|
tag: 'select',
|
2017-08-21 23:13:19 +00:00
|
|
|
relation: 'Group',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 1,
|
2017-08-21 23:13:19 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 3,
|
2017-08-21 23:13:19 +00:00
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-08-21 23:13:19 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
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.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-08-21 23:13:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: true,
|
|
|
|
name: 'check_mk_auto_close',
|
|
|
|
tag: 'boolean',
|
|
|
|
options: {
|
2017-08-21 23:13:19 +00:00
|
|
|
true => 'yes',
|
|
|
|
false => 'no',
|
|
|
|
},
|
2017-10-25 11:20:10 +00:00
|
|
|
translate: true,
|
2017-08-21 23:13:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: true,
|
2017-08-21 23:13:19 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 4,
|
2017-08-21 23:13:19 +00:00
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-08-21 23:13:19 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
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.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-08-21 23:13:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: false,
|
|
|
|
name: 'check_mk_auto_close_state_id',
|
|
|
|
tag: 'select',
|
|
|
|
relation: 'TicketState',
|
2017-10-25 11:20:10 +00:00
|
|
|
translate: true,
|
2017-08-21 23:13:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 4,
|
2017-08-21 23:13:19 +00:00
|
|
|
preferences: {
|
2018-12-19 17:31:51 +00:00
|
|
|
prio: 5,
|
2017-08-21 23:13:19 +00:00
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-08-21 23:13:19 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
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.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {},
|
|
|
|
state: SecureRandom.hex(16),
|
2017-08-21 23:13:19 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.integration'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false
|
2017-08-21 23:13:19 +00:00
|
|
|
)
|
2017-10-25 11:20:10 +00:00
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Defines postmaster filter.',
|
|
|
|
name: '5200_postmaster_filter_check_mk',
|
|
|
|
area: 'Postmaster::PreFilter',
|
2017-10-25 11:20:10 +00:00
|
|
|
description: 'Defines postmaster filter to manage Check_MK (http://mathias-kettner.com/check_mk.html) emails.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {},
|
|
|
|
state: 'Channel::Filter::CheckMk',
|
|
|
|
frontend: false
|
2017-10-25 11:20:10 +00:00
|
|
|
)
|
2017-08-21 23:13:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|