add .editorconfig, format files correctly
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
b42e39ed0a
commit
fbb8840dff
33 changed files with 240 additions and 238 deletions
|
@ -1,7 +1,7 @@
|
|||
% for user, config in sorted(node.metadata.get('icinga2', {}).get('api_users', {}).items()):
|
||||
object ApiUser "${user}" {
|
||||
password = "${config['password']}"
|
||||
permissions = [ "${'", "'.join(sorted(config['permissions']))}" ]
|
||||
password = "${config['password']}"
|
||||
permissions = [ "${'", "'.join(sorted(config['permissions']))}" ]
|
||||
}
|
||||
|
||||
% endfor
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
% for monitored_node in sorted(monitored_nodes):
|
||||
% if not monitored_node.dummy:
|
||||
object ScheduledDowntime "unattended_upgrades" {
|
||||
host_name = "${monitored_node.name}"
|
||||
host_name = "${monitored_node.name}"
|
||||
|
||||
author = "upgrade-and-reboot"
|
||||
comment = "Downtime for upgrade-and-reboot"
|
||||
author = "upgrade-and-reboot"
|
||||
comment = "Downtime for upgrade-and-reboot"
|
||||
|
||||
fixed = true
|
||||
fixed = true
|
||||
|
||||
ranges = {
|
||||
"${days[monitored_node.metadata.get('apt', {}).get('unattended_upgrades', {}).get('day', 5)]}" = "01:${monitored_node.magic_number%30}-01:${(monitored_node.magic_number%30)+30}"
|
||||
}
|
||||
ranges = {
|
||||
"${days[monitored_node.metadata.get('apt', {}).get('unattended_upgrades', {}).get('day', 5)]}" = "01:${monitored_node.magic_number%30}-01:${(monitored_node.magic_number%30)+30}"
|
||||
}
|
||||
|
||||
child_options = "DowntimeTriggeredChildren"
|
||||
child_options = "DowntimeTriggeredChildren"
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
% for group in sorted(repo.groups):
|
||||
object HostGroup "group-${group.name}" {
|
||||
display_name = "bw group ${group.name}"
|
||||
display_name = "bw group ${group.name}"
|
||||
|
||||
assign where "${group.name}" in host.vars.bw_groups
|
||||
assign where "${group.name}" in host.vars.bw_groups
|
||||
}
|
||||
% endfor
|
||||
|
||||
% for bundle in sorted(bundles):
|
||||
object ServiceGroup "bundle-${bundle}" {
|
||||
display_name = "bw bundle ${bundle}"
|
||||
display_name = "bw bundle ${bundle}"
|
||||
|
||||
assign where service.vars.bundle == "${bundle}"
|
||||
assign where service.vars.bundle == "${bundle}"
|
||||
}
|
||||
% endfor
|
||||
|
||||
object ServiceGroup "checks_with_mail" {
|
||||
display_name = "Checks which send E-Mails"
|
||||
display_name = "Checks which send E-Mails"
|
||||
|
||||
assign where service.vars.notification.mail == true
|
||||
assign where service.vars.notification.mail == true
|
||||
}
|
||||
|
||||
object HostGroup "checks_with_sms" {
|
||||
display_name = "Hosts which send SMS"
|
||||
display_name = "Hosts which send SMS"
|
||||
|
||||
assign where host.vars.notification.sms == true
|
||||
assign where host.vars.notification.sms == true
|
||||
}
|
||||
|
||||
object ServiceGroup "checks_with_sms" {
|
||||
display_name = "Checks which send SMS"
|
||||
display_name = "Checks which send SMS"
|
||||
|
||||
assign where service.vars.notification.sms == true
|
||||
assign where service.vars.notification.sms == true
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
% for monitored_node in sorted(monitored_nodes):
|
||||
object Host "${monitored_node.name}" {
|
||||
import "generic-host"
|
||||
import "generic-host"
|
||||
|
||||
address = "${monitored_node.metadata.get('icinga_options', {}).get('hostname', monitored_node.hostname)}"
|
||||
address = "${monitored_node.metadata.get('icinga_options', {}).get('hostname', monitored_node.hostname)}"
|
||||
|
||||
vars.os = "${monitored_node.os}"
|
||||
vars.sla = "${monitored_node.metadata.get('sla', '24x7')}"
|
||||
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
||||
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
|
||||
vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ]
|
||||
vars.notification.sms = ${str(monitored_node.metadata.get('icinga_options', {}).get('vars.notification.sms', True)).lower()}
|
||||
vars.notification.mail = true
|
||||
vars.os = "${monitored_node.os}"
|
||||
vars.sla = "${monitored_node.metadata.get('sla', '24x7')}"
|
||||
vars.period = "${sla_info[monitored_node.metadata.get('sla', '24x7')]}"
|
||||
vars.location = "${monitored_node.metadata.get('location', 'unknown')}"
|
||||
vars.bw_groups = [ "${'", "'.join(sorted({group.name for group in monitored_node.groups}))}" ]
|
||||
vars.notification.sms = ${str(monitored_node.metadata.get('icinga_options', {}).get('vars.notification.sms', True)).lower()}
|
||||
vars.notification.mail = true
|
||||
}
|
||||
% endfor
|
||||
|
||||
apply Dependency "disable-service-checks-on-host-down" to Service {
|
||||
disable_checks = true
|
||||
ignore_soft_states = true
|
||||
assign where true
|
||||
disable_checks = true
|
||||
ignore_soft_states = true
|
||||
assign where true
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
library "db_ido_pgsql"
|
||||
|
||||
object IdoPgsqlConnection "ido-pgsql" {
|
||||
user = "icinga2",
|
||||
password = "${node.metadata['postgresql']['roles']['icinga2']['password']}",
|
||||
host = "localhost",
|
||||
database = "icinga2"
|
||||
user = "icinga2",
|
||||
password = "${node.metadata['postgresql']['roles']['icinga2']['password']}",
|
||||
host = "localhost",
|
||||
database = "icinga2"
|
||||
}
|
||||
|
|
|
@ -1,74 +1,74 @@
|
|||
object NotificationCommand "send-host-notification" {
|
||||
import "plugin-notification-command"
|
||||
import "plugin-notification-command"
|
||||
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
host_vars = host.vars
|
||||
if (host_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--state" = "$host.state$"
|
||||
"--output" = "$host.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--state" = "$host.state$"
|
||||
"--output" = "$host.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object NotificationCommand "send-service-notification" {
|
||||
import "plugin-notification-command"
|
||||
import "plugin-notification-command"
|
||||
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
command = [ ConfigDir + "/scripts/icinga_notification_wrapper" ]
|
||||
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
arguments = {
|
||||
"--mail" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.mail == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
}}
|
||||
value = "$user.email$"
|
||||
}
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
"--sms" = {
|
||||
set_if = {{
|
||||
svc_vars = service.vars
|
||||
if (svc_vars.notification.sms == true) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--service_name" = "$service.display_name$"
|
||||
"--state" = "$service.state$"
|
||||
"--output" = "$service.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}}
|
||||
value = "$user.vars.mobile$"
|
||||
}
|
||||
"--host_name" = "$host.display_name$"
|
||||
"--service_name" = "$service.display_name$"
|
||||
"--state" = "$service.state$"
|
||||
"--output" = "$service.output$"
|
||||
"--escalation" = {
|
||||
set_if = "$escalation$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
apply Notification "notify_host-notification" to Host {
|
||||
import "host-notification"
|
||||
interval = 30m
|
||||
import "host-notification"
|
||||
interval = 30m
|
||||
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
|
||||
assign where host.vars.notification.sms == true
|
||||
assign where host.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification" to Service {
|
||||
import "service-notification"
|
||||
interval = 30m
|
||||
import "service-notification"
|
||||
interval = 30m
|
||||
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
times = {
|
||||
begin = 1m
|
||||
end = 30m
|
||||
}
|
||||
|
||||
assign where service.vars.notification.sms == true
|
||||
assign where service.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_host-notification-escalation" to Host {
|
||||
import "host-notification"
|
||||
interval = 20m
|
||||
import "host-notification"
|
||||
interval = 20m
|
||||
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
|
||||
vars.escalation = true
|
||||
vars.escalation = true
|
||||
|
||||
assign where host.vars.notification.sms == true
|
||||
assign where host.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification-escalation" to Service {
|
||||
import "service-notification"
|
||||
interval = 20m
|
||||
import "service-notification"
|
||||
interval = 20m
|
||||
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
times = {
|
||||
begin = 30m
|
||||
}
|
||||
|
||||
vars.escalation = true
|
||||
vars.escalation = true
|
||||
|
||||
assign where service.vars.notification.sms == true
|
||||
assign where service.vars.notification.sms == true
|
||||
}
|
||||
|
||||
|
||||
apply Notification "notify_service-notification-mail" to Service {
|
||||
import "service-notification"
|
||||
interval = 0
|
||||
import "service-notification"
|
||||
interval = 0
|
||||
|
||||
assign where service.vars.notification.mail == true
|
||||
ignore where service.vars.notification.sms == true
|
||||
assign where service.vars.notification.mail == true
|
||||
ignore where service.vars.notification.sms == true
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
% for node_data, icingaconf in sorted(bundle_metadata.items()):
|
||||
% for service, config in sorted(icingaconf.items()):
|
||||
% for service, config in sorted(icingaconf.items()):
|
||||
object Service "${service}" {
|
||||
import "generic-service"
|
||||
host_name = "${node_data.name}"
|
||||
% for k, v in sorted(config.items()):
|
||||
% if k not in {'import', 'command_on_monitored_host'} and not k.startswith('vars.notification'):
|
||||
% if isinstance(v, bool) or isinstance(v, int) or k in ["check_interval", "retry_interval"]:
|
||||
${k} = ${str(v).lower()}
|
||||
% elif isinstance(v, list):
|
||||
${k} = [${", ".join(['"' + i + '"' for i in v])}]
|
||||
% else:
|
||||
${k} = "${v}"
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
||||
vars.bundle = "${bundle_name}"
|
||||
vars.notification.sms = ${str(config.get('vars.notification.sms', False)).lower()}
|
||||
vars.notification.mail = ${str(config.get('vars.notification.mail', False)).lower()}
|
||||
import "generic-service"
|
||||
host_name = "${node_data.name}"
|
||||
% for k, v in sorted(config.items()):
|
||||
% if k not in {'import', 'command_on_monitored_host'} and not k.startswith('vars.notification'):
|
||||
% if isinstance(v, bool) or isinstance(v, int) or k in ["check_interval", "retry_interval"]:
|
||||
${k} = ${str(v).lower()}
|
||||
% elif isinstance(v, list):
|
||||
${k} = [${", ".join(['"' + i + '"' for i in v])}]
|
||||
% else:
|
||||
${k} = "${v}"
|
||||
% endif
|
||||
% endif
|
||||
% endfor
|
||||
vars.bundle = "${bundle_name}"
|
||||
vars.notification.sms = ${str(config.get('vars.notification.sms', False)).lower()}
|
||||
vars.notification.mail = ${str(config.get('vars.notification.mail', False)).lower()}
|
||||
}
|
||||
% endfor
|
||||
% endfor
|
||||
% endfor
|
||||
|
|
|
@ -68,8 +68,8 @@ template Notification "service-notification" {
|
|||
user_groups = [ "on-call_sms" ]
|
||||
|
||||
if(service.vars.period) {
|
||||
period = service.vars.period
|
||||
period = service.vars.period
|
||||
} else {
|
||||
period = host.vars.period
|
||||
period = host.vars.period
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
object TimePeriod "24x7" {
|
||||
import "legacy-timeperiod"
|
||||
import "legacy-timeperiod"
|
||||
|
||||
display_name = "24x7"
|
||||
ranges = {
|
||||
"monday" = "00:00-24:00"
|
||||
"tuesday" = "00:00-24:00"
|
||||
"wednesday" = "00:00-24:00"
|
||||
"thursday" = "00:00-24:00"
|
||||
"friday" = "00:00-24:00"
|
||||
"saturday" = "00:00-24:00"
|
||||
"sunday" = "00:00-24:00"
|
||||
}
|
||||
display_name = "24x7"
|
||||
ranges = {
|
||||
"monday" = "00:00-24:00"
|
||||
"tuesday" = "00:00-24:00"
|
||||
"wednesday" = "00:00-24:00"
|
||||
"thursday" = "00:00-24:00"
|
||||
"friday" = "00:00-24:00"
|
||||
"saturday" = "00:00-24:00"
|
||||
"sunday" = "00:00-24:00"
|
||||
}
|
||||
}
|
||||
|
||||
object TimePeriod "weekdays_9to6" {
|
||||
import "legacy-timeperiod"
|
||||
import "legacy-timeperiod"
|
||||
|
||||
display_name = "9to6 (UTC)"
|
||||
ranges = {
|
||||
"monday" = "09:00-18:00"
|
||||
"tuesday" = "09:00-18:00"
|
||||
"wednesday" = "09:00-18:00"
|
||||
"thursday" = "09:00-18:00"
|
||||
"friday" = "09:00-18:00"
|
||||
}
|
||||
display_name = "9to6 (UTC)"
|
||||
ranges = {
|
||||
"monday" = "09:00-18:00"
|
||||
"tuesday" = "09:00-18:00"
|
||||
"wednesday" = "09:00-18:00"
|
||||
"thursday" = "09:00-18:00"
|
||||
"friday" = "09:00-18:00"
|
||||
}
|
||||
}
|
||||
|
||||
object TimePeriod "never" {
|
||||
import "legacy-timeperiod"
|
||||
import "legacy-timeperiod"
|
||||
|
||||
display_name = "never"
|
||||
ranges = {
|
||||
}
|
||||
display_name = "never"
|
||||
ranges = {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,20 @@ object UserGroup "on-call_sms" {
|
|||
|
||||
% for username, config in sorted(node.metadata.get('icinga2', {}).get('icinga_users', {}).items()):
|
||||
object User "${username}" {
|
||||
display_name = "${username}"
|
||||
enable_notifications = true
|
||||
period = "24x7"
|
||||
display_name = "${username}"
|
||||
enable_notifications = true
|
||||
period = "24x7"
|
||||
% if not config['is_admin']:
|
||||
states = [ OK, Warning, Critical, Up, Down ]
|
||||
types = [ Problem, Recovery ]
|
||||
states = [ OK, Warning, Critical, Up, Down ]
|
||||
types = [ Problem, Recovery ]
|
||||
% endif
|
||||
|
||||
% if config['is_admin'] and (config['email'] or config['phone']):
|
||||
groups = [ "on-call_sms" ]
|
||||
groups = [ "on-call_sms" ]
|
||||
% endif
|
||||
|
||||
email = "${config['email']}"
|
||||
vars.mobile = "${config['phone']}"
|
||||
email = "${config['email']}"
|
||||
vars.mobile = "${config['phone']}"
|
||||
}
|
||||
|
||||
% endfor
|
||||
|
|
|
@ -90,6 +90,7 @@ def notify_per_sms():
|
|||
|
||||
|
||||
def notify_per_mail():
|
||||
# editorconfig-checker-disable
|
||||
text = """
|
||||
_ _
|
||||
(_)____(_)___ ____ _____ _
|
||||
|
@ -108,6 +109,7 @@ Service: {service}"""
|
|||
State: {state}
|
||||
|
||||
{output}"""
|
||||
# editorconfig-checker-enable
|
||||
|
||||
mail = email.mime.text.MIMEText(text.format(
|
||||
host=args.host_name,
|
||||
|
|
|
@ -17,12 +17,6 @@ defaults = {
|
|||
'icingaweb2': {},
|
||||
'icingaweb2-module-monitoring': {},
|
||||
|
||||
# needed for check_rbl
|
||||
'libdata-validate-ip-perl': {},
|
||||
'libmonitoring-plugin-perl': {},
|
||||
'libnet-dns-perl': {},
|
||||
'libreadonly-perl': {},
|
||||
|
||||
# neeeded for statusmonitor
|
||||
'python3-flask': {},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue