From 9980f3b31b26aa3409f2b77b8aabf60a924a1674 Mon Sep 17 00:00:00 2001 From: Piotr Limanowski Date: Mon, 12 Feb 2024 10:27:53 +0100 Subject: [PATCH] Add status reporting --- .../files/snowplow-report.service | 17 +++++++++++++++ .../files/snowplow-report.timer | 10 +++++++++ .../roles/sp_mini_7_setup_init/tasks/main.yml | 21 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.service create mode 100644 provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.timer diff --git a/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.service b/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.service new file mode 100644 index 00000000..84d1b4be --- /dev/null +++ b/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.service @@ -0,0 +1,17 @@ +[Unit] +Description=Runs Snowplow Report service sending mini status metrics +Wants=snowplow-report.timer + +[Service] +Type=oneshot +ExecStart=/usr/bin/docker compose -f /home/ubuntu/snowplow/docker-compose.yml ps +# FIXME +# Inspect docker compose for services +# Report restarts +# Report errors +# Check OpenSearch for number of events both good and bad +# Check whether collector is accessible +# Report via statsd + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.timer b/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.timer new file mode 100644 index 00000000..cd5bc065 --- /dev/null +++ b/provisioning/roles/sp_mini_7_setup_init/files/snowplow-report.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Starts Snowplow Report timer sending mini status metrics +Requires=snowlow-report.service + +[Timer] +Unit=snowlow-report.service +OnCalendar=*:0/01:00 + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/provisioning/roles/sp_mini_7_setup_init/tasks/main.yml b/provisioning/roles/sp_mini_7_setup_init/tasks/main.yml index beb04113..349528a2 100644 --- a/provisioning/roles/sp_mini_7_setup_init/tasks/main.yml +++ b/provisioning/roles/sp_mini_7_setup_init/tasks/main.yml @@ -1,6 +1,27 @@ --- - include_vars: ../../common_vars.yml + +- name: Create Snowplow Report service + copy: + src: ../files/snowplow-report.service + dest: /etc/systemd/system/snowplow-report.service + become: yes + +- name: Create Report Snowplow timer + copy: + src: ../files/snowplow-report.timer + dest: /etc/systemd/system/snowplow-report.timer + become: yes + +- name: Start Snowplow Report timer service + systemd: + name: snowplow-report.timer + state: started + enabled: yes + daemon_reload: yes + become: yes + - name: Copy SysVinit scripts to /etc/init.d become: yes copy: