diff --git a/rpmbuild/SOURCES/prometheus.env b/rpmbuild/SOURCES/prometheus.env new file mode 100644 index 0000000..82ee86e --- /dev/null +++ b/rpmbuild/SOURCES/prometheus.env @@ -0,0 +1,5 @@ +CONFIG_FILE=/opt/prometheus/etc/prometheus.yaml +LISTEN_ADDRESS=0.0.0.0:9090 +LOG_LEVEL=info +TSDB_PATH=/srv/prometheus +PROMETHEUS_OPTIONS= diff --git a/rpmbuild/SOURCES/prometheus.service b/rpmbuild/SOURCES/prometheus.service index 4da0b6a..a8242eb 100644 --- a/rpmbuild/SOURCES/prometheus.service +++ b/rpmbuild/SOURCES/prometheus.service @@ -6,8 +6,9 @@ After=network-online.target [Service] Restart=always Type=simple -ExecStart=/opt/prometheus/bin/prometheus -WorkingDirectory=/opt/prometheus/etc +EnvironmentFile=/opt/prometheus/etc/prometheus.env +ExecStart=/opt/prometheus/bin/prometheus --storage.tsdb.path=${TSDB_PATH} --config.file=${CONFIG_FILE} --web.listen-address=${LISTEN_ADDRESS} --log.level=${LOG_LEVEL} $PROMETHEUS_OPTIONS +WorkingDirectory=/srv/prometheus User=prometheus Group=itix-svc diff --git a/rpmbuild/SOURCES/prometheus.yaml b/rpmbuild/SOURCES/prometheus.yaml new file mode 100644 index 0000000..4a6f9bb --- /dev/null +++ b/rpmbuild/SOURCES/prometheus.yaml @@ -0,0 +1,4 @@ +global: + scrape_interval: 15s + evaluation_interval: 15s + diff --git a/rpmbuild/SPECS/prometheus.spec b/rpmbuild/SPECS/prometheus.spec index 07bd934..55fd904 100644 --- a/rpmbuild/SPECS/prometheus.spec +++ b/rpmbuild/SPECS/prometheus.spec @@ -5,6 +5,8 @@ Summary: The Prometheus monitoring system and time series database. License: Apache-2.0 Source0: https://github.com/prometheus/%{name}/releases/download/v%{version}/%{name}-%{version}.linux-amd64.tar.gz Source1: prometheus.service +Source2: prometheus.yaml +Source3: prometheus.env ExclusiveArch: x86_64 Requires(pre): shadow-utils BuildRequires: systemd @@ -24,6 +26,8 @@ trigger alerts when specified conditions are observed. %prep %setup -q -n %{name}-%{version}.linux-amd64 cp %{S:1} %{name}.service +cp %{S:2} %{name}.yaml +cp %{S:3} %{name}.env %build rm NOTICE @@ -35,6 +39,8 @@ install -D promtool %{buildroot}/opt/%{name}/bin/promtool install -D -m 0644 consoles/* -t %{buildroot}/opt/%{name}/bin/consoles/ install -D -m 0644 console_libraries/* -t %{buildroot}/opt/%{name}/bin/console_libraries/ install -D -m 0644 prometheus.yml %{buildroot}/opt/%{name}/etc/prometheus.yaml +install -D -m 0600 %{name}.yaml %{buildroot}/opt/%{name}/etc/%{name}.yaml +install -D -m 0644 %{name}.env %{buildroot}/opt/%{name}/etc/%{name}.env install -D -m 0644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service %files @@ -44,12 +50,13 @@ install -D -m 0644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service %dir /opt/%{name}/bin/consoles/ %dir /opt/%{name}/bin/console_libraries/ %dir /opt/%{name}/etc/ -%dir /srv/%{name}/ -%attr(0644, root, root) /opt/%{name}/bin/prometheus -%attr(0644, root, root) /opt/%{name}/bin/promtool /opt/%{name}/bin/consoles/* /opt/%{name}/bin/console_libraries/* -%config /opt/%{name}/etc/prometheus.yaml +%attr(0700, prometheus, itix-svc) %dir /srv/%{name}/ +%attr(0755, root, root) /opt/%{name}/bin/prometheus +%attr(0755, root, root) /opt/%{name}/bin/promtool +%attr(0600, prometheus, itix-svc) %config(noreplace) /opt/%{name}/etc/%{name}.yaml +%config(noreplace) /opt/%{name}/etc/%{name}.env %{_unitdir}/%{name}.service %pre @@ -61,5 +68,3 @@ getent passwd %{name} >/dev/null || useradd -r -g itix-svc \ exit 0 %changelog -* Mon Feb 22 2021 Nicolas MASSE - 2.25.0-itix1 -- First release