Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Created January 8, 2020 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h0tw1r3/0337b3bec378fa98310303779e5d64a0 to your computer and use it in GitHub Desktop.
Save h0tw1r3/0337b3bec378fa98310303779e5d64a0 to your computer and use it in GitHub Desktop.
RPM spec for packaging nsca-ng 1.6 tested on RHEL/CentOS 6 and 7
%if 0%{?fedora} > 17 || 0%{?rhel} > 6
%global systemd_support 1
%else
%global systemd_support 0
%endif
Summary: A modern replacement for NSCA
Name: nsca-ng
Version: 1.6
Release: 1%{?dist}
License: BSD-2-Clause
Url: https://github.com/weiss/nsca-ng/
Group: System/Monitoring
Source: https://github.com/weiss/nsca-ng/releases/download/v1.6/nsca-ng-1.6.tar.gz
BuildRequires: gcc
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libconfuse-devel
BuildRequires: libev-devel
BuildRequires: openssl-devel >= 1.0.0
BuildRequires: pkgconfig
BuildRequires: nagios-common
%if %{systemd_support}
BuildRequires: systemd-units
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%else
Requires(preun): /sbin/service, /sbin/chkconfig
Requires(post): /sbin/chkconfig
Requires(postun): /sbin/service
%endif
Requires: nagios
%description
A client-server pair which makes the "Nagios command file" accessible to
remote systems. This allows for submitting passive check results, downtimes,
and many other commands to Nagios (or compatible monitoring solutions).
NSCA-ng supports TLS encryption and shared-secret authentication with
client-specific passwords (based on RFC 4279), as well as fine-grained
authorization control.
%package client
Summary: Client application for sending updates to a nsca server
Requires: nagios-common
Conflicts: nsca-client
Provides: nsca-client
%description client
Client application for sending updates to a nsca server
%prep
%setup -q
%build
autoreconf -fi
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure --enable-server --disable-silent-rules --sysconfdir %{_sysconfdir}/nagios
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot} %{?_smp_mflags}
%if %{systemd_support}
install -D -m 0644 etc/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 etc/%{name}.socket %{buildroot}%{_unitdir}/%{name}.socket
%else
install -D -m 0755 contrib/%{name}.init %{buildroot}%{_initrddir}/%{name}
%endif
%files
%defattr(-,root,root)
%doc ChangeLog README COPYING
%config(noreplace) %attr(0640,root,nagios) %{_sysconfdir}/nagios/nsca-ng.cfg
%{_sbindir}/nsca-ng
%{_mandir}/man5/nsca-ng.cfg.5.gz
%{_mandir}/man8/nsca-ng.8.gz
%if %{systemd_support}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.socket
%else
%{_initrddir}/nsca-ng
%endif
%files client
%defattr(-,root,root)
%config(noreplace) %attr(0640,root,nagios) %{_sysconfdir}/nagios/send_nsca.cfg
%{_sbindir}/send_nsca
%{_mandir}/man5/send_nsca.cfg.5.gz
%{_mandir}/man8/send_nsca.8.gz
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment