File sensu-go.spec of Package sensu-go
#
# spec file for package sensu-go
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: sensu-go
Version: 6.9.1
Release: 0
Group: System/Monitoring
Summary: Simple Scalable Multi-cloud monitoring
License: MIT
URL: https://sensu.io
Source0: https://github.com/sensu/sensu-go/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: sensu-go-backend.service
Source2: sensu-go-user.conf
Source3: sensu-go-agent.service
Source4: sensu-go-agent-user.conf
Source5: backend.yml
Source6: agent.yml
Source9: vendor.tar.gz
Source10: %{name}-agent.firewalld
Source11: %{name}-backend.firewalld
BuildRequires: firewall-macros
BuildRequires: golang(API) >= 1.16
BuildRequires: golang-packaging
BuildRequires: systemd-rpm-macros
BuildRequires: sysuser-tools
%description
Sensu is an open source monitoring tool for ephemeral infrastructure and
distributed applications. It is an agent based monitoring system with built-in
auto-discovery, making it very well-suited for cloud environments. Sensu uses
service checks to monitor service health and collect telemetry data. It also
has a number of well defined APIs for configuration, external data input, and
to provide access to Sensu's data. Sensu is extremely extensible and is
commonly referred to as "the monitoring router".
%prep
%setup -q
%setup -q -T -D -a 9
%package agent
Summary: Simple Scalable Multi-cloud monitoring Agent
%description agent
Sensu is an open source monitoring tool for ephemeral infrastructure and
distributed applications. It is an agent based monitoring system with built-in
auto-discovery, making it very well-suited for cloud environments. Sensu uses
service checks to monitor service health and collect telemetry data. It also
has a number of well defined APIs for configuration, external data input, and
to provide access to Sensu's data. Sensu is extremely extensible and is
commonly referred to as "the monitoring router".
This package contains agent to be deployed on monitored hosts.
%build
%sysusers_generate_pre %{SOURCE2} sensu-go sensu-go-user.conf
%sysusers_generate_pre %{SOURCE4} sensu-go-agent sensu-go-agent-user.conf
for i in sensu-agent sensu-backend sensuctl; do
go build -mod=vendor -buildmode=pie -o $i ./cmd/$i
done
%pre -f sensu-go.pre
%service_add_pre sensu-go-backend.service
%preun
%service_del_preun sensu-go-backend.service
%post
%service_add_post sensu-go-backend.service
%firewalld_reload
%postun
%service_del_postun sensu-go-backend.service
%pre agent -f sensu-go-agent.pre
%service_add_pre sensu-go-agent.service
%preun agent
%service_del_preun sensu-go-agent.service
%post agent
%service_add_post sensu-go-agent.service
%firewalld_reload
%postun agent
%service_del_postun sensu-go-agent.service
%install
install -D -d -m 0755 %{buildroot}%{_sbindir}
for i in sensu-agent sensu-backend sensuctl; do
install -m 0755 $i %{buildroot}%{_sbindir}
done
mkdir -p %{buildroot}%{_localstatedir}/lib/sensu-go
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/sensu-go-backend.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/sensu-go-agent.service
install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sensu/backend.yml
install -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sensu/agent.yml
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcsensu-go-backend
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcsensu-go-agent
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/sensu-go-user.conf
install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/sensu-go-agent-user.conf
mkdir -p %{buildroot}%{_localstatedir}/cache/sensu/sensu-backend
mkdir -p %{buildroot}%{_localstatedir}/cache/sensu/sensu-agent
mkdir -p %{buildroot}%{_localstatedir}/log/sensu/
mkdir -p %{buildroot}%{_localstatedir}/lib/sensu/sensu-backend
# firewalld
install -d %{buildroot}%{_libexecdir}/firewalld/services/
install -D -m 644 %{SOURCE10} %{buildroot}%{_libexecdir}/firewalld/services/%{name}-agent.xml
install -D -m 644 %{SOURCE11} %{buildroot}%{_libexecdir}/firewalld/services/%{name}-backend.xml
%files
%license LICENSE
%doc CODE_OF_CONDUCT.md CONTRIBUTING.md FAQ.md README.md
%config(noreplace) %{_sysconfdir}/sensu/backend.yml
%dir %{_sysconfdir}/sensu
%dir %{_libexecdir}/firewalld
%dir %{_libexecdir}/firewalld/services
%{_libexecdir}/firewalld/services/%{name}-backend.xml
%{_sbindir}/sensu-backend
%{_sbindir}/sensuctl
%{_sbindir}/rcsensu-go-backend
%{_unitdir}/sensu-go-backend.service
%{_sysusersdir}/sensu-go-user.conf
%attr(0755, sensu-go, sensu-go) %dir %{_localstatedir}/cache/sensu/sensu-backend
%dir %{_localstatedir}/cache/sensu
%attr(0755, sensu-go, sensu-go) %dir %{_localstatedir}/lib/sensu/sensu-backend
%attr(0755, sensu-go, sensu-go) %dir %{_localstatedir}/lib/sensu
%attr(0755, sensu-go, sensu-go) %dir %{_localstatedir}/log/sensu/
%files agent
%dir %{_localstatedir}/cache/sensu
%attr(0755, sensu-go-agent, sensu-go-agent) %dir %{_localstatedir}/cache/sensu/sensu-agent
%config(noreplace) %{_sysconfdir}/sensu/agent.yml
%dir %{_libexecdir}/firewalld
%dir %{_libexecdir}/firewalld/services
%{_libexecdir}/firewalld/services/%{name}-agent.xml
%{_sysusersdir}/sensu-go-agent-user.conf
%dir %{_sysconfdir}/sensu
%{_sbindir}/sensu-agent
%{_sbindir}/rcsensu-go-agent
%{_unitdir}/sensu-go-agent.service
%changelog