dist: provide metrics service and timer.
This commit is contained in:
parent
10311c12c6
commit
a0c7dc362c
14
dist/package/openSUSE-release-tools.spec
vendored
14
dist/package/openSUSE-release-tools.spec
vendored
@ -148,6 +148,7 @@ Group: Development/Tools/Other
|
||||
BuildArch: noarch
|
||||
# TODO Update requirements.
|
||||
Requires: osclib = %{version}
|
||||
Requires(pre): shadow
|
||||
# TODO Requires: python-influxdb, but package does not exist in Factory, but
|
||||
# present in Cloud:OpenStack:Master/python-influxdb.
|
||||
Recommends: python-influxdb
|
||||
@ -342,8 +343,13 @@ exit 0
|
||||
%postun maintenance
|
||||
%service_del_postun osrt-maintenance-incidents.service
|
||||
|
||||
# TODO Provide metrics service once #1006 is resolved.
|
||||
%pre metrics
|
||||
getent passwd osrt-metrics > /dev/null || \
|
||||
useradd -r -m -s /sbin/nologin -c "user for openSUSE-release-tools-metrics" osrt-metrics
|
||||
exit 0
|
||||
|
||||
%postun metrics
|
||||
%systemd_postun
|
||||
# If grafana-server.service is enabled then restart it to load new dashboards.
|
||||
if [ -x /usr/bin/systemctl ] && systemctl is-enabled grafana-server ; then
|
||||
/usr/bin/systemctl try-restart --no-block grafana-server
|
||||
@ -502,6 +508,12 @@ exit 0
|
||||
%{_bindir}/osrt-metrics
|
||||
%{_datadir}/%{source_dir}/metrics
|
||||
%{_datadir}/%{source_dir}/metrics.py
|
||||
# To avoid adding grafana as BuildRequires since it does not live in same repo.
|
||||
%dir %{_localstatedir}/lib/grafana
|
||||
%dir %{_localstatedir}/lib/grafana/dashboards
|
||||
%{_localstatedir}/lib/grafana/dashboards/%{name}
|
||||
%{_unitdir}/osrt-metrics@.service
|
||||
%{_unitdir}/osrt-metrics@.timer
|
||||
|
||||
%files repo-checker
|
||||
%defattr(-,root,root,-)
|
||||
|
12
systemd/osrt-metrics@.service
Normal file
12
systemd/osrt-metrics@.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=openSUSE Release Tools: metrics for %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=osrt-metrics
|
||||
SyslogIdentifier=osrt-metrics
|
||||
ExecStart=/usr/bin/osrt-metrics --debug -p "%i"
|
||||
TimeoutStartSec=8 hour
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
10
systemd/osrt-metrics@.timer
Normal file
10
systemd/osrt-metrics@.timer
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=openSUSE Release Tools: metrics for %i
|
||||
|
||||
[Timer]
|
||||
OnBootSec=120
|
||||
OnCalendar=daily
|
||||
Unit=osrt-metrics@%i.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Loading…
x
Reference in New Issue
Block a user