From dc8443ebc1a00538148f9263ac1495e50d4e4e56 Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Sat, 6 Jan 2024 07:31:01 +0100 Subject: [PATCH] package created by autospec [release 2.9.1-1mamba;Wed Oct 24 2012] --- README.md | 5 ++ nagios-nsca-2.9.1-initscript.patch | 89 +++++++++++++++++++ nagios-nsca-2.9.1-nagios_bug_286.patch | 11 +++ nagios-nsca-2.9.1-send_nsca_config.patch | 11 +++ nagios-nsca-sysconfig | 0 nagios-nsca.spec | 108 +++++++++++++++++++++++ 6 files changed, 224 insertions(+) create mode 100644 nagios-nsca-2.9.1-initscript.patch create mode 100644 nagios-nsca-2.9.1-nagios_bug_286.patch create mode 100644 nagios-nsca-2.9.1-send_nsca_config.patch create mode 100644 nagios-nsca-sysconfig create mode 100644 nagios-nsca.spec diff --git a/README.md b/README.md index 6e005e2..3c356d7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # nagios-nsca +NSCA is a Nagios addon that allows you to send passive check results from remote Linux/Unix hosts to the Nagios daemon running on the monitoring server. +It listens for host and service check results from remote machines (sent using the send_nsca program). +Upon receiving data from a remote client, the daemon will make a *very* basic attempt at validating the data it has received from the client. +If the data looks okay the daemon will make entries in the Nagios external command file telling Nagios to process the host or service check result. + diff --git a/nagios-nsca-2.9.1-initscript.patch b/nagios-nsca-2.9.1-initscript.patch new file mode 100644 index 0000000..1230663 --- /dev/null +++ b/nagios-nsca-2.9.1-initscript.patch @@ -0,0 +1,89 @@ +--- nsca-2.9.1/init-script.in 2011-11-08 00:15:56.000000000 +0100 ++++ nsca-2.9.1/init-script.in.openmamba 2012-10-24 21:46:14.000000000 +0200 +@@ -9,56 +9,69 @@ + # description: nsca is a daemon for accepting service check results \ + # from applications running on other hosts. + # processname: nsca +-# config: /usr/local/nagios/etc/nsca.cfg ++# config: /etc/nagios/nsca.cfg + + # Source function library +-if [ -f /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +-elif [ -f /etc/init.d/functions ]; then +-. /etc/init.d/functions +-elif [ -f /etc/rc.d/functions ]; then +-. /etc/rc.d/functions +-fi + + # Source networking configuration. + . /etc/sysconfig/network + +-# Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 0 + +-NscaBin=@bindir@/nsca ++NscaBin=@sbindir@/nsca + NscaCfg=@sysconfdir@/nsca.cfg + LockFile=/var/lock/subsys/nsca + ++[ -e /etc/sysconfig/nsca ] && . /etc/sysconfig/nsca ++ ++RETVAL=0 ++ + # See how we were called. + case "$1" in + start) +- # Start daemons. ++ [ -x $NscaBin ] || exit 5 ++ [ -f $NscaCfg ] || exit 6 ++ ++ status nsca >/dev/null 2>&1 && exit 0 ++ + echo -n "Starting nsca: " +- daemon $NscaBin -s -c $NscaCfg ++ daemon $NscaBin $OPTIONS -c $NscaCfg + RETVAL=$? + echo +- touch $LockFile ++ [ $RETVAL -eq 0 ] && touch $LockFile + ;; + stop) +- # Stop daemons. ++ status nsca >/dev/null 2>&1 || exit 0 ++ + echo -n "Shutting down nsca: " + killproc nsca ++ RETVAL=$? + echo +- rm -f $LockFile ++ [ $RETVAL -eq 0 ] && rm $LockFile + ;; + restart) + $0 stop + $0 start + ;; ++ reload) ++ echo -n $"Reloading nsca: " ++ killproc nsca -HUP ++ RETVAL=$? ++ echo ++ ;; ++ condrestart) ++ [ -e $LockFile ] && restart ++ RETVAL=$? ++ ;; + status) + status nsca ++ RETVAL=$? + ;; + *) +- echo "Usage: nsca {start|stop|restart|status}" ++ echo "Usage: nsca {start|stop|restart|reload|condrestart|status}" + exit 1 + esac + +-exit 0 +- ++exit $RETVAL + diff --git a/nagios-nsca-2.9.1-nagios_bug_286.patch b/nagios-nsca-2.9.1-nagios_bug_286.patch new file mode 100644 index 0000000..0a86aa2 --- /dev/null +++ b/nagios-nsca-2.9.1-nagios_bug_286.patch @@ -0,0 +1,11 @@ +--- nsca-2.9.1/src/nsca.c 2012-01-27 14:20:36.000000000 +0100 ++++ nsca-2.9.1/src/nsca.c.bug286 2012-10-24 21:51:31.000000000 +0200 +@@ -477,7 +477,7 @@ + int checkresult_test_fd=-1; + char *checkresult_test=NULL; + asprintf(&checkresult_test,"%s/nsca.test.%i",check_result_path,getpid()); +- checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT); ++ checkresult_test_fd=open(checkresult_test,O_WRONLY|O_CREAT,S_IWUSR); + if (checkresult_test_fd>0){ + unlink(checkresult_test); + } diff --git a/nagios-nsca-2.9.1-send_nsca_config.patch b/nagios-nsca-2.9.1-send_nsca_config.patch new file mode 100644 index 0000000..9db9762 --- /dev/null +++ b/nagios-nsca-2.9.1-send_nsca_config.patch @@ -0,0 +1,11 @@ +--- nsca-2.9.1/src/send_nsca.c 2012-01-27 14:20:58.000000000 +0100 ++++ nsca-2.9.1/src/send_nsca.c.config 2012-10-24 21:10:59.000000000 +0200 +@@ -25,7 +25,7 @@ + int server_port=DEFAULT_SERVER_PORT; + char server_name[MAX_HOST_ADDRESS_LENGTH]; + char password[MAX_INPUT_BUFFER]=""; +-char config_file[MAX_INPUT_BUFFER]="send_nsca.cfg"; ++char config_file[MAX_INPUT_BUFFER]="/etc/nagios/send_nsca.cfg"; + char delimiter[2]="\t"; + char block_delimiter[2]=BLOCK_DELIMITER; + diff --git a/nagios-nsca-sysconfig b/nagios-nsca-sysconfig new file mode 100644 index 0000000..e69de29 diff --git a/nagios-nsca.spec b/nagios-nsca.spec new file mode 100644 index 0000000..c9adc39 --- /dev/null +++ b/nagios-nsca.spec @@ -0,0 +1,108 @@ +%define nscaport 5667 +%define nscauser nagios +%define nscagroup nagios + +Name: nagios-nsca +Version: 2.9.1 +Release: 1mamba +Summary: Nagios Service Check Acceptor (NSCA) +Group: Network/Monitoring +Vendor: openmamba +Distribution: openmamba +Packager: Davide Madrisan +URL: http://www.nagios.org +Source0: http://sourceforge.net/projects/nagios/files/nsca-2.x/nsca-%{version}/nsca-%{version}.tar.gz +Source1: %{name}-sysconfig +Patch0: %{name}-2.9.1-initscript.patch +Patch1: %{name}-2.9.1-send_nsca_config.patch +# http://tracker.nagios.org/view.php?id=286 +Patch2: %{name}-2.9.1-nagios_bug_286.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libmcrypt-devel +## AUTOBUILDREQ-END +Provides: nsca = %{?epoch:%epoch:}%{version}-%{release} +Provides: nagios-plugins-nsca = %{?epoch:%epoch:}%{version}-%{release} +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +NSCA is a Nagios addon that allows you to send passive check results from remote Linux/Unix hosts to the Nagios daemon running on the monitoring server. +It listens for host and service check results from remote machines (sent using the send_nsca program). +Upon receiving data from a remote client, the daemon will make a *very* basic attempt at validating the data it has received from the client. +If the data looks okay the daemon will make entries in the Nagios external command file telling Nagios to process the host or service check result. + +%package client +Summary: Client application for sending updates to a nsca server +Group: Network/Monitoring + +%description client +Client application for sending service check informations to a nsca server. + +%prep +%setup -q -n nsca-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 + +sed -i \ +-e "s|^command_file=.*|command_file=%{_localstatedir}/spool/nagios/cmd/nagios.cmd|" \ +-e "s|^alternate_dump_file=.*|alternate_dump_file=%{_localstatedir}/spool/nagios/cmd/nsca.dump|" \ + sample-config/nsca.cfg.in + +%build +CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ +%configure \ + --with-nsca-user="%{nscauser}" \ + --with-nsca-grp="%{nscagroup}" \ + --with-nsca-port="%{nscaport}" \ + --sysconfdir="%{_sysconfdir}/nagios" \ + --localstatedir="%{_localstatedir}/log/nagios" \ + +%make all + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +install -Dp -m 0755 src/nsca %{buildroot}%{_sbindir}/nsca +install -Dp -m 0755 src/send_nsca %{buildroot}%{_sbindir}/send_nsca +install -Dp -m 0644 sample-config/nsca.cfg %{buildroot}%{_sysconfdir}/nagios/nsca.cfg +install -Dp -m 0644 sample-config/send_nsca.cfg %{buildroot}%{_sysconfdir}/nagios/send_nsca.cfg +install -Dp -m 0755 init-script %{buildroot}%{_initrddir}/nsca +install -Dp -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/sysconfig/nsca + +%post +/sbin/chkconfig --add nsca || : + +%preun +if [ $1 -eq 0 ]; then + /sbin/service nsca stop >/dev/null 2>&1 + /sbin/chkconfig --del nsca +fi +exit 0 + +%postun +if [ "$1" -ge "1" ]; then + /sbin/service nsca condrestart >/dev/null 2>&1 +fi +exit 0 + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_sbindir}/nsca +%{_initrddir}/nsca +%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/nagios/nsca.cfg +%config(noreplace) %{_sysconfdir}/sysconfig/nsca +%doc LEGAL README SECURITY + +%files client +%defattr(-,root,root) +%{_sbindir}/send_nsca +%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/nagios/send_nsca.cfg + +%changelog +* Wed Oct 24 2012 Davide Madrisan 2.9.1-1mamba +- package created by autospec