Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • infrastruktur/ansible-warpzone
  • specki/ansible-warpzone
2 results
Show changes
Commits on Source (4)
......@@ -3,6 +3,9 @@
export BORG_PASSPHRASE="{{repo_passphrase}}"
export BORG_RSH="ssh -i /srv/borgbackup/repo_sshkey"
# Force locale for correct formatting
LANG=en_US.UTF-8
# Metrics output file in the prometheus node-exporter directory
PROM_FILE="/var/lib/prometheus/node-exporter/borgbackup.prom"
......
......@@ -189,9 +189,7 @@
basedir: /srv/icinga,
domain: icinga.warpzone.ms,
api_port: 5665,
mysql_port: 33306,
matrix_notification_domain: "matrix.warpzone.ms",
matrix_notification_room: "!iYefxbySFEfFQfUGEK:matrix.warpzone.ms"
mysql_port: 33306
}
- {
role: webserver/docker_hackmd, tags: hackmd,
......
......@@ -5,7 +5,7 @@ services:
app:
image: gitlab/gitlab-ce:15.10.2-ce.0
image: gitlab/gitlab-ce:15.11.5-ce.0
restart: always
ports:
- "444:22"
......
......@@ -13,9 +13,10 @@ RUN apt-get update \
libnet-dns-perl \
libnet-ip-perl \
perl \
python3-requests \
python3 \
python3-paho-mqtt \
python3-pip \
python3-requests \
virtualenv \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/debconf/*-old
......@@ -49,8 +50,16 @@ RUN cd /opt/ \
&& cd /opt/check_metric_value/ \
&& git checkout b94d3c3e78497a05e3b4520d33421f37e4d77985
# icinga2-matrix_notification - commit from 15.04.2012
# icinga2-matrix-bot - commit from 10.06.2018
# create a symlink to emulate virtualenv
# patch matrix-service-notification.sh
RUN cd /opt/ \
&& git clone https://github.com/linuxmail/icinga2-matrix_notification \
&& cd /opt/icinga2-matrix_notification/ \
&& git checkout 99d2174a3b00e9a88648fe58bcd975368f69837d
&& git clone https://github.com/symptog/icinga2-matrix-bot.git \
&& cd /opt/icinga2-matrix-bot/ \
&& git checkout 86d03ed8884950eb2b883a9a94ecf93460b8e0bb \
&& pip install -r requirements.txt \
&& mkdir /opt/icinga2-matrix-bot/.venv \
&& mkdir /opt/icinga2-matrix-bot/.venv/bin \
&& ln -s /usr/bin/python3 /opt/icinga2-matrix-bot/.venv/bin/python \
&& sed -i 's/matrix-host-state/matrix-service-state/' icinga2/matrix-service-notification.sh
\ No newline at end of file
......@@ -80,131 +80,49 @@ object CheckCommand "check_metric_value" {
*/
object NotificationCommand "matrix-host-notification" {
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix_notification/scripts/matrix-host-notification.sh" ]
arguments += {
"-4" = "$notification_address$"
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
required = true
value = "$notification_date$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
required = true
value = "$notification_hostname$"
}
"-m" = {
required = true
value = "$notification_matrix_room_id$"
}
"-n" = {
required = true
value = "$notification_hostdisplayname$"
}
"-o" = {
required = true
value = "$notification_hostoutput$"
}
"-s" = {
required = true
value = "$notification_hoststate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-x" = {
required = true
value = "$notification_matrix_server$"
}
"-y" = {
required = true
value = "$notification_matrix_token$"
}
}
vars.notification_address = "$address$"
vars.notification_address6 = "$address6$"
vars.notification_author = "$notification.author$"
vars.notification_comment = "$notification.comment$"
vars.notification_date = "$icinga.long_date_time$"
vars.notification_hostdisplayname = "$host.display_name$"
vars.notification_hostname = "$host.name$"
vars.notification_hostoutput = "$host.output$"
vars.notification_hoststate = "$host.state$"
vars.notification_type = "$notification.type$"
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix-bot/icinga2/matrix-host-notification.sh" ]
env = {
"NOTIFICATIONTYPE" = "$notification.type$"
"HOSTALIAS" = "$host.display_name$",
"HOSTADDRESS" = "$address$",
"HOSTNAME" = "$host.name$",
"HOSTSTATE" = "$host.state$",
"LONGDATETIME" = "$icinga.long_date_time$",
"HOSTOUTPUT" = "$host.output$",
"NOTIFICATIONAUTHORNAME" = "$notification.author$",
"NOTIFICATIONCOMMENT" = "$notification.comment$",
"HOSTDISPLAYNAME" = "$host.display_name$",
"ICINGA_WEBURL" = "$notification_icingaweb2url$",
"MATRIX_SERVER" = "$user.vars.matrix.server$",
"MATRIX_TOKEN" = "$user.vars.matrix.token$",
"MATRIX_CHANNEL" = "$user.vars.matrix.channel$",
}
}
object NotificationCommand "matrix-service-notification" {
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix_notification/scripts/matrix-service-notification.sh" ]
arguments += {
"-4" = {
required = true
value = "$notification_address$"
}
"-6" = "$notification_address6$"
"-b" = "$notification_author$"
"-c" = "$notification_comment$"
"-d" = {
required = true
value = "$notification_date$"
}
"-e" = {
required = true
value = "$notification_servicename$"
}
"-i" = "$notification_icingaweb2url$"
"-l" = {
required = true
value = "$notification_hostname$"
}
"-m" = {
required = true
value = "$notification_matrix_room_id$"
}
"-n" = {
required = true
value = "$notification_hostdisplayname$"
}
"-o" = {
required = true
value = "$notification_serviceoutput$"
}
"-s" = {
required = true
value = "$notification_servicestate$"
}
"-t" = {
required = true
value = "$notification_type$"
}
"-u" = {
required = true
value = "$notification_servicedisplayname$"
}
"-x" = {
required = true
value = "$notification_matrix_server$"
}
"-y" = {
required = true
value = "$notification_matrix_token$"
}
}
vars.notification_address = "$address$"
vars.notification_address6 = "$address6$"
vars.notification_author = "$notification.author$"
vars.notification_comment = "$notification.comment$"
vars.notification_date = "$icinga.long_date_time$"
vars.notification_hostdisplayname = "$host.display_name$"
vars.notification_hostname = "$host.name$"
vars.notification_servicedisplayname = "$service.display_name$"
vars.notification_serviceoutput = "$service.output$"
vars.notification_servicestate = "$service.state$"
vars.notification_type = "$notification.type$"
vars.notification_servicename = "$service.name$"
import "plugin-notification-command"
command = [ "/opt/icinga2-matrix-bot/icinga2/matrix-service-notification.sh" ]
env = {
"NOTIFICATIONTYPE" = "$notification.type$"
"SERVICEDESC" = "$service.name$"
"HOSTALIAS" = "$host.display_name$",
"HOSTNAME" = "$host.name$",
"HOSTADDRESS" = "$address$",
"SERVICESTATE" = "$service.state$",
"LONGDATETIME" = "$icinga.long_date_time$",
"SERVICEOUTPUT" = "$service.output$",
"NOTIFICATIONAUTHORNAME" = "$notification.author$",
"NOTIFICATIONCOMMENT" = "$notification.comment$",
"HOSTDISPLAYNAME" = "$host.display_name$",
"SERVICEDISPLAYNAME" = "$service.display_name$",
"ICINGA_WEBURL" = "$notification_icingaweb2url$",
"MATRIX_SERVER" = "$user.vars.matrix.server$",
"MATRIX_TOKEN" = "$user.vars.matrix.token$",
"MATRIX_CHANNEL" = "$user.vars.matrix.channel$",
}
}
// https://github.com/linuxmail/icinga2-matrix_notification
/**
* Example Matrix.org apply rules.
* The "!<id>:matrix.org" needs to be replaced with the room ID
* for example "!SDFfskjfdszhdaslasdkjhdasd:matrix.org".
* Also a Matrix access token is required too.
*/
apply Notification "matrix" to Host {
import "matrix-host-notification"
apply Notification "Matrix host problems" to Host {
import "matrix-host-notification"
users = [ "matrix" ]
user_groups = [ "icingaadmins" ]
interval = 4h
vars.notification_matrix_server = "https://{{ matrix_notification_domain }}"
vars.notification_matrix_room_id = "{{ matrix_notification_room }}"
vars.notification_matrix_token = "{{ matrix_notification_access_token }}"
# Assign to all hosts
assign where host.address
assign where host.address
}
apply Notification "Matrix service problems" to Service {
import "matrix-service-notification"
user_groups = [ "icingaadmins" ]
apply Notification "matrix" to Service {
import "matrix-service-notification"
users = [ "matrix" ]
vars.notification_matrix_server = "https://{{ matrix_notification_domain }}"
vars.notification_matrix_room_id = "{{ matrix_notification_room }}"
vars.notification_matrix_token = "{{ matrix_notification_access_token }}"
interval = 4h
# Assign to all services
assign where service.name
assign where service.name
}
......@@ -87,32 +87,24 @@ template Notification "mail-service-notification" {
*/
template Notification "matrix-host-notification" {
command = "matrix-host-notification"
command = "matrix-host-notification"
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
// notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
notification_logtosyslog = false
}
// interval = 0s
states = [ Up, Down ]
types = [ Problem, Acknowledgement, Custom, FlappingStart, FlappingEnd ]
period = "24x7"
vars += {
notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
}
}
template Notification "matrix-service-notification" {
command = "matrix-service-notification"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
command = "matrix-service-notification"
vars += {
// notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
notification_logtosyslog = false
}
// interval = 0s
states = [ OK, Critical, Unknown ]
types = [ Problem, Acknowledgement, Custom, FlappingStart, FlappingEnd ]
period = "24x7"
vars += {
notification_icingaweb2url = "https://{{ domain }}/icingaweb2"
}
}
......@@ -3,3 +3,18 @@ object UserGroup "icingaadmins" {
display_name = "Icinga 2 Admin Group"
}
object User "matrix" {
import "generic-user"
display_name = "Matrix User"
vars.matrix = {
token = "{{ matrix_notification_access_token }}"
channel = "!iYefxbySFEfFQfUGEK:matrix.warpzone.ms"
server = "https://matrix.warpzone.ms"
}
}
object UserGroup "matrix" {
display_name = "Matrix Group"
assign where user.vars.matrix
}
......@@ -10,7 +10,7 @@ services:
db:
image: postgres:13.6
image: postgres:13.11
restart: always
volumes:
- /srv/matrix/db:/var/lib/postgresql/data
......@@ -24,7 +24,7 @@ services:
synapse:
image: matrixdotorg/synapse:v1.78.0
image: matrixdotorg/synapse:v1.83.0
restart: always
cpu_count: "1"
cpuset: "0"
......