%global lbuildir %{_builddir}/%{name}-%{version}/%{name}-%{version}.linux-amd64 %global debug_package %{nil} Name: node_exporter Version: 0.16.0 Release: 1%{?dist} Summary: Exporter for machine metrics. License: ASL 1.0 URL: https://github.com/prometheus/node_exporter Source0: https://github.com/prometheus/%{name}/releases/download/v%{version}/%{name}-%{version}.linux-amd64.tar.gz Source1: %{name}.service %{?systemd_requires} BuildRequires: systemd %description Prometheus node exporter for hardware and OS metrics exposed by *NIX kernels, written in Go with pluggable metric collectors. The WMI exporter is recommended for Windows users. %prep %setup -c -q %build %pre getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || \ useradd -r -g %{name} -d /var/lib/%{name} -s /sbin/nologin \ -c "Prometheus Node Exporter" %{name} exit 0 %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %install rm -rf %{buildroot} %{__mkdir_p} %{buildroot}/%{_sbindir} %{__install} -p %{lbuildir}/%{name} %{buildroot}/%{_sbindir}/ %{__install} -p -D %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service %{__mkdir_p} %{buildroot}/%{_usr}/share/%{name} %{__install} -p -D %{lbuildir}/{LICENSE,NOTICE} %{buildroot}/%{_usr}/share/%{name} %{__mkdir_p} %{buildroot}/%{_sysconfdir}/sysconfig %{__cat} < %{buildroot}/%{_sysconfdir}/sysconfig/%{name} OPTIONS="--collector.textfile.directory %{_sharedstatedir}/%{name}/textfile_collector" EOF %{__mkdir_p} %{buildroot}/%{_sharedstatedir}/%{name}/textfile_collector %files %defattr(644,%{name},%{name},755) %attr(755,-,-) /usr/sbin/%{name} %{_usr}/share/%{name}/NOTICE %config %{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %license %{_usr}/share/%{name}/LICENSE %dir %{_sharedstatedir}/%{name}/textfile_collector %changelog * Wed Oct 17 2018 Disk Stats - 0.16.0-1 - rebuilt