-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Co-authored-by: mattmix <[email protected]>
- Loading branch information
1 parent
a0e27e4
commit 74271ef
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# cgroup subsystem paths to look at, comma separated | ||
CONFIG_PATHS=/user.slice | ||
# Additional options | ||
OPTIONS= |