add .editorconfig, format files correctly
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-02-17 10:56:18 +01:00
parent b42e39ed0a
commit fbb8840dff
Signed by: kunsi
GPG key ID: 12E3D2136B818350
33 changed files with 240 additions and 238 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yaml]
indent_size = 2
# possibly sql dumps
[*.sql]
indent_size = unset

View file

@ -3,8 +3,8 @@
# /etc/kernel/postinst.d/unattended-upgrades
case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in
linux-image-extra*::postrm)
exit 0;;
linux-image-extra*::postrm)
exit 0;;
esac
if [ -d /var/run ]; then

View file

@ -1,10 +1,3 @@
# __ ____
# / /_ __ ______ ____/ / /__ _ ___________ _____
# / __ \/ / / / __ \/ __ / / _ \ | /| / / ___/ __ `/ __ \
# / /_/ / /_/ / / / / /_/ / / __/ |/ |/ / / / /_/ / /_/ /
#/_.___/\__,_/_/ /_/\__,_/_/\___/|__/|__/_/ \__,_/ .___/
# /_/
#
# CAUTION! This file is managed with bundlewrap.
# Any manual edits will be lost!

View file

@ -1,10 +1,3 @@
# __ ____
# / /_ __ ______ ____/ / /__ _ ___________ _____
# / __ \/ / / / __ \/ __ / / _ \ | /| / / ___/ __ `/ __ \
# / /_/ / /_/ / / / / /_/ / / __/ |/ |/ / / / /_/ / /_/ /
#/_.___/\__,_/_/ /_/\__,_/_/\___/|__/|__/_/ \__,_/ .___/
# /_/
#
# CAUTION! This file is managed with bundlewrap.
# Any manual edits will be lost!

View file

@ -1,15 +1,15 @@
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
set "mailbox" "${1}";
}
if string "${mailbox}" "Trash" {
stop;
stop;
}
if environment :matches "imap.user" "*" {
set "username" "${1}";
set "username" "${1}";
}
pipe :copy "sa-learn-ham.sh" [ "${username}" ];

View file

@ -1,7 +1,7 @@
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.user" "*" {
set "username" "${1}";
set "username" "${1}";
}
pipe :copy "sa-learn-spam.sh" [ "${username}" ];

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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
}

View file

@ -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"
}

View file

@ -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$"
}
}
}

View file

@ -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
}

View file

@ -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

View file

@ -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
}
}

View file

@ -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 = {
}
}

View file

@ -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

View file

@ -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,

View file

@ -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': {},
}

View file

@ -33,5 +33,5 @@ exit_hook() {<%text>
<%text>
HANDLER="$1"; shift
if [[ "${HANDLER}" =~ ^(deploy_cert|exit_hook)$ ]]; then
"$HANDLER" "$@"
"$HANDLER" "$@"
fi</%text>

View file

@ -77,11 +77,11 @@ suppress_key_server_warning: true
%endif
password_config:
enabled: true
enabled: true
email:
enable_notifs: false
notif_from: "Matrix <noreply@${server_name}"
enable_notifs: false
notif_from: "Matrix <noreply@${server_name}"
enable_group_creation: true

View file

@ -1,4 +1,5 @@
#!/usr/bin/env perl
# editorconfig-checker-disable-file
# check_nginx_status.pl
# Author : regis.leroy at makina-corpus.com
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt

View file

@ -1,4 +1,5 @@
#!/bin/bash
# editorconfig-checker-disable-file
# created by McArt <hello@mcart.ru> http://www.mcart.ru/
# Uncomment to enable debugging

View file

@ -1,6 +1,6 @@
% for zone in sorted(zones):
zone "${zone}" {
file "/var/lib/powerdns/zones/${zone}";
type native;
file "/var/lib/powerdns/zones/${zone}";
type native;
};
% endfor

View file

@ -1,4 +1,5 @@
#!/usr/bin/perl -w
# editorconfig-checker-disable-file
# Check SMART status of ATA/SCSI/NVMe drives, returning any usable metrics as perfdata.
# For usage information, run ./check_smart -h
#

View file

@ -1,4 +1,5 @@
#!/bin/bash
# editorconfig-checker-disable-file
#
# Plugin to check free ram space
# using check_by_ssh

View file

@ -45,7 +45,7 @@ if node.has_bundle('systemd-networkd'):
if node.has_bundle('netdata'):
files['/etc/netdata/go.d/unbound.conf'] = {
'source': 'netdata-unbound.conf',
'source': 'netdata-unbound.yaml',
'triggers': {
'svc_systemd:netdata:restart',
},

View file

@ -13,5 +13,5 @@ id-assoc pd 0 {
};
profile default {
information-only;
information-only;
};

View file

@ -1,12 +1,12 @@
client_max_body_size 0;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
}
location /seafhttp {

View file

@ -1,5 +1,5 @@
location ~ /(data|conf|bin|inc|vendor)/ {
deny all;
deny all;
}
location / { try_files $uri $uri/ @dokuwiki; }