From 2e91b767472a36dcfd76aad8dd4a9df35c780fd6 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Thu, 23 Nov 2023 20:25:52 +0100 Subject: [PATCH] Initial commit --- matomo.cf | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 matomo.cf diff --git a/matomo.cf b/matomo.cf new file mode 100644 index 0000000..1cd8104 --- /dev/null +++ b/matomo.cf @@ -0,0 +1,53 @@ +# +# +# +bundle agent matomo +{ +vars: + "src" string => "https://builds.matomo.org/matomo-4.15.1.zip"; + "dst_dir" string => "$(sys.workdir)/data/agent/matomo"; + "zip_file" string => "$(dst_dir)/matomo-4.15.1.zip"; + + "log_importer_install_dir" string => "/usr/local/bin"; + "log_importer" string => "$(log_importer_install_dir)/import_logs.py"; +} + +bundle agent download_matomo +{ +vars: +files: + "$(matomo.dst_dir)/." + create => "true", + handle => "matomo_download_dir_created"; + +methods: + "any" usebundle => download_file("wget","$(matomo.src)","$(matomo.zip_file)","matomo_zip_file",'{}'), + depends_on => {"matomo_download_dir_created"}, + handle => "matomo_downloaded"; + +} + + +bundle agent install_matomo_log_importer +{ +classes: + "importer_exists" expression => fileexists("$(matomo.log_importer)"); + +methods: + "any" usebundle => download_matomo; +commands: + + !importer_exists:: + "unzip" + args => "-o -j $(matomo.zip_file) matomo/misc/log-analytics/import_logs.py -d $(matomo.log_importer_install_dir)", + depends_on => {"matomo_downloaded"}, + handle => "matomo_log_importer_installed", + contain => wmde_cmd_useshell; + importer_exists:: + "/usr/bin/true" + inform => "false", + handle => "matomo_log_importer_installed"; + + + +}