1%define name nsca 2%define version 2.7.2 3%define release 1 4%define nsusr nagios 5%define nsgrp nagios 6%define nsport 5667 7# %define nsport 8086 8 9# Reserve option to override port setting with: 10# rpm -ba|--rebuild --define 'nsport 5666' 11%{?port:%define nsport %{port}} 12 13# Macro that print mesages to syslog at package (un)install time 14%define nnmmsg logger -t %{name}/rpm 15 16Summary: Host/service/network monitoring agent for Nagios 17URL: http://www.nagios.org 18Name: %{name} 19Version: %{version} 20Release: %{release} 21License: GPL 22Group: Application/System 23Source0: %{name}-%{version}.tar.gz 24BuildRoot: %{_tmppath}/%{name}-buildroot 25Requires: bash, nagios, libmcrypt, xinetd 26 27# uncomment this for RedHat Enterprise Linux 3: 28#PreReq: util-linux, sh-utils, shadow-utils, sed, fileutils, mktemp 29# SuSE Linux Enterprise Server 8: 30PreReq: util-linux, sh-utils, shadow, sed, fileutils, mktemp 31 32 33%description 34This program is designed to accept passive service check results from 35clients that use the send_nsca utility and pass them along to the 36Nagios process by using the external command 37interface. The program can either be run as a standalone daemon or as 38a service under inetd. If you have libmcrypt installed on your systems, 39you can choose from multiple crypto algorithms (DES, 3DES, CAST, xTEA, 40Twofish, LOKI97, RJINDAEL, SERPENT, GOST, SAFER/SAFER+, etc.) for 41encrypting the traffic between the client and the server. 42Encryption is important in this addon, as it prevents unauthorized users 43from sending bogus check results to Nagios. Read the included SECURITY 44document for more information. 45 46This package provides the core agent running on the Nagios server 47 48%package send 49Requires: libmcrypt 50Group: Application/System 51Summary: Provides the send_nsca utility running on the Nagios-Client. 52 53%description send 54This program is designed to accept passive service check results from 55clients that use the send_nsca utility (which is included in this package) 56and pass them along to the Nagios process by using the external command 57interface. The program can either be run as a standalone daemon or as 58a service under inetd. If you have libmcrypt installed on your systems, 59you can choose from multiple crypto algorithms (DES, 3DES, CAST, xTEA, 60Twofish, LOKI97, RJINDAEL, SERPENT, GOST, SAFER/SAFER+, etc.) for 61encrypting the traffic between the client and the server. 62Encryption is important in this addon, as it prevents unauthorized users 63from sending bogus check results to Nagios. Read the included SECURITY 64document for more information. 65 66This package provides the send_nsca utility running on the client. 67 68%prep 69%setup -q 70 71 72%pre 73# Create `nagios' user on the system if necessary 74if id %{nsusr} 75then 76 : # user already exists 77else 78 grep nagios /etc/group &>/dev/null || /usr/sbin/groupadd -r nagios 79 80 /usr/sbin/useradd -r -d /var/log/nagios -s /bin/sh -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \ 81 %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. 82fi 83 84# if LSB standard /etc/init.d does not exist, 85# create it as a symlink to the first match we find 86if [ -d /etc/init.d -o -L /etc/init.d ]; then 87 : # we're done 88elif [ -d /etc/rc.d/init.d ]; then 89 ln -s /etc/rc.d/init.d /etc/init.d 90elif [ -d /usr/local/etc/rc.d ]; then 91 ln -s /usr/local/etc/rc.d /etc/init.d 92elif [ -d /sbin/init.d ]; then 93 ln -s /sbin/init.d /etc/init.d 94fi 95 96%postun 97/etc/init.d/xinetd restart 98 99%post 100/etc/init.d/xinetd restart 101 102 103%build 104export PATH=$PATH:/usr/sbin 105CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ 106./configure \ 107 --with-nsca-port=%{nsport} \ 108 --with-nsca-user=%{nsusr} \ 109 --with-nsca-grp=%{nsgrp} \ 110 --prefix="" \ 111 --bindir=%{_prefix}/bin \ 112 --sysconfdir=/etc/nagios \ 113 --localstatedir=/var/spool/nagios \ 114 115 116make all 117 118%install 119[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT 120install -b -D -m 0644 sample-config/nsca.cfg ${RPM_BUILD_ROOT}/etc/nagios/nsca.cfg 121install -b -D -m 0644 sample-config/send_nsca.cfg ${RPM_BUILD_ROOT}/etc/nagios/send_nsca.cfg 122install -b -D -m 0644 sample-config/nsca.xinetd ${RPM_BUILD_ROOT}/etc/xined.d/nsca 123install -b -D -m 0755 src/nsca ${RPM_BUILD_ROOT}/usr/sbin/nsca 124install -b -D -m 0755 src/send_nsca ${RPM_BUILD_ROOT}/usr/bin/send_nsca 125 126%clean 127rm -rf $RPM_BUILD_ROOT 128 129 130%files 131%defattr(755,root,root) 132/etc/xined.d/nsca 133/usr/sbin/nsca 134%dir /etc/nagios 135%defattr(644,root,root) 136%config(noreplace) /etc/nagios/*.cfg 137%defattr(755,%{nsusr},%{nsgrp}) 138%doc Changelog LEGAL README SECURITY 139 140%files send 141%defattr(755,root,root) 142/usr/bin/send_nsca 143%defattr(644,root,root) 144%config(noreplace) /etc/nagios/send_nsca.cfg 145%defattr(755,%{nsusr},%{nsgrp}) 146%doc Changelog LEGAL README SECURITY 147 148%changelog 149* Wed Jan 28 2004 Falk H�ppner <fh at honix de> 150- Create SPEC from nrpe.spec 151- Tested on ia32/ia64 with SLES8/RHEL3 152 153