X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/a8261d1b13150b9ded3e6d4733ac5c381c390cdc..4177d28331e277e9bd639d28b1cf606f27794c66:/cookbooks/prometheus/recipes/server.rb?ds=inline diff --git a/cookbooks/prometheus/recipes/server.rb b/cookbooks/prometheus/recipes/server.rb index 6214f1858..b547327c4 100644 --- a/cookbooks/prometheus/recipes/server.rb +++ b/cookbooks/prometheus/recipes/server.rb @@ -28,8 +28,7 @@ admins = data_bag_item("apache", "admins") prometheus_exporter "fastly" do port 8080 - listen_switch "endpoint" - listen_type "url" + listen_switch "listen" environment "FASTLY_API_TOKEN" => tokens["fastly"] end @@ -98,17 +97,17 @@ archive_file "#{cache_dir}/karma-linux-amd64.tar.gz" do subscribes :extract, "remote_file[#{cache_dir}/karma-linux-amd64.tar.gz]" end -package %w[ - prometheus - prometheus-alertmanager -] - -promscale_version = "0.10.0" -promscale_extension_version = "0.3.2" +promscale_version = "0.11.0" database_version = node[:timescaledb][:database_version] database_cluster = "#{database_version}/main" +package %W[ + prometheus + prometheus-alertmanager + promscale-extension-postgresql-#{database_version} +] + postgresql_user "prometheus" do cluster database_cluster superuser true @@ -125,19 +124,6 @@ directory "/opt/promscale" do mode "755" end -remote_file "#{cache_dir}/promscale_extension.pg#{database_version}.x86_64.deb" do - source "https://github.com/timescale/promscale_extension/releases/download/#{promscale_extension_version}/promscale_extension-#{promscale_extension_version}.pg#{database_version}.x86_64.deb" - owner "root" - group "root" - mode "644" - backup false -end - -dpkg_package "promscale-extension-postgresql-#{database_version}" do - source "#{cache_dir}/promscale_extension.pg#{database_version}.x86_64.deb" - version "#{promscale_extension_version}-1" -end - directory "/opt/promscale/bin" do owner "root" group "root" @@ -164,41 +150,16 @@ systemd_service "promscale" do no_new_privileges true end -systemd_service "promscale-maintenance" do - description "Promscale Maintenance" - type "simple" - user "prometheus" - exec_start "/usr/bin/psql --command='CALL prom_api.execute_maintenance()' promscale" - private_tmp true - protect_system "strict" - protect_home true - no_new_privileges true -end - -systemd_timer "promscale-maintenance" do - description "Promscale Maintenace" - on_active_sec 1800 - on_unit_inactive_sec 1800 -end - if node[:prometheus][:promscale] service "promscale" do action [:enable, :start] subscribes :restart, "remote_file[/opt/promscale/bin/promscale]" subscribes :restart, "systemd_service[promscale]" end - - service "promscale-maintenance.timer" do - action [:enable, :start] - end else service "promscale" do action [:disable, :stop] end - - service "promscale-maintenance.timer" do - action [:disable, :stop] - end end search(:node, "roles:gateway") do |gateway| @@ -287,7 +248,8 @@ end systemd_service "prometheus-executable" do service "prometheus" dropin "executable" - exec_start "/opt/prometheus-server/prometheus/prometheus --config.file=/etc/prometheus/prometheus.yml --web.external-url=https://prometheus.openstreetmap.org/prometheus --storage.tsdb.path=/var/lib/prometheus/metrics2" + exec_start "/opt/prometheus-server/prometheus/prometheus --config.file=/etc/prometheus/prometheus.yml --web.external-url=https://prometheus.openstreetmap.org/prometheus --storage.tsdb.path=/var/lib/prometheus/metrics2 --storage.tsdb.retention.time=30d" + timeout_stop_sec 300 notifies :restart, "service[prometheus]" end