Add RPM spec file and systemd service unit. (#26)
* Add RPM spec file and systemd service unit. * Move to packaging/rpm --------- Co-authored-by: Matt Mix <mattmix@umn.edu> Co-authored-by: mattmix <mattmix@andor.local>
This commit is contained in:
parent
a0e27e49d1
commit
74271ef07c
|
@ -0,0 +1,32 @@
|
|||
[Unit]
|
||||
Description=cgroup exporter
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=-/etc/sysconfig/cgroup_exporter
|
||||
ExecStart=/usr/sbin/cgroup_exporter --config.paths $CONFIG_PATHS $OPTIONS
|
||||
Restart=always
|
||||
User=cgroup_exporter
|
||||
Group=cgroup_exporter
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
RestrictSUIDSGID=yes
|
||||
MemoryDenyWriteExecute=yes
|
||||
LockPersonality=yes
|
||||
RemoveIPC=yes
|
||||
CapabilityBoundingSet=
|
||||
SystemCallFilter=@system-service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,45 @@
|
|||
Name: cgroup_exporter
|
||||
Version: 0.9.1
|
||||
Release: 1%{?dist}
|
||||
Summary: The cgroup_exporter produces metrics from cgroups.
|
||||
|
||||
License: Apache License
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
URL: https://github.com/treydock/cgroup_exporter
|
||||
|
||||
BuildRequires: go-toolset
|
||||
Requires: systemd
|
||||
|
||||
%description
|
||||
|
||||
The cgroup_exporter produces metrics from cgroups.
|
||||
|
||||
This exporter by default listens on port 9306 and all metrics are exposed via the /metrics endpoint.
|
||||
|
||||
%global debug_package %{nil}
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
go build -v -o %{name}
|
||||
|
||||
%install
|
||||
install -Dpm 0755 %{name} %{buildroot}%{_sbindir}/%{name}
|
||||
install -Dpm 0644 packaging/rpm/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
|
||||
install -Dpm 0644 packaging/rpm/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%pre
|
||||
%{_sbindir}/useradd -c "cgroup exporter user" -s /bin/false -r -d / cgroup_exporter 2>/dev/null || :
|
||||
|
||||
%files
|
||||
%{_sbindir}/%{name}
|
||||
%{_unitdir}/%{name}.service
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||
|
||||
%changelog
|
||||
* Fri Nov 10 2023 Initial RPM
|
||||
-
|
|
@ -0,0 +1,4 @@
|
|||
# cgroup subsystem paths to look at, comma separated
|
||||
CONFIG_PATHS=/user.slice
|
||||
# Additional options
|
||||
OPTIONS=
|
Loading…
Reference in New Issue