Fix Nagios plugin (partially)

This commit is contained in:
Simone Caronni 2014-04-01 17:18:41 +02:00
parent f0afcfd56a
commit 457a0b7583
2 changed files with 77 additions and 5 deletions

View File

@ -0,0 +1,68 @@
diff -Naur bacula-7.0.1/examples/nagios/check_bacula/authenticate.c bacula-7.0.1.new/examples/nagios/check_bacula/authenticate.c
--- bacula-7.0.1/examples/nagios/check_bacula/authenticate.c 2014-03-31 20:51:34.000000000 +0200
+++ bacula-7.0.1.new/examples/nagios/check_bacula/authenticate.c 2014-04-01 16:45:15.315588066 +0200
@@ -50,12 +50,14 @@
/* Response from Director */
static char DIROKhello[] = "1000 OK:";
-/* Commands sent to Storage daemon and File daemon and received
- * from the User Agent */
-static char SDFDhello[] = "Hello Director %s calling\n";
+/* Commands sent to Storage daemon */
+static char SDhello[] = "Hello SD: Bacula Director %s calling\n";
+
+/* Commands sent to File daemon */
+static char FDhello[] = "Hello Director %s calling\n";
/* Response from SD */
-static char SDOKhello[] = "3000 OK Hello\n";
+static char SDOKhello[] = "3000 OK Hello";
/* Response from FD */
static char FDOKhello[] = "2000 OK Hello";
@@ -114,7 +116,7 @@
bash_spaces(dirname);
/* Timeout Hello after 5 mins */
btimer_t *tid = start_bsock_timer(sd, 60 * 5);
- if (!sd->fsend(SDFDhello, dirname)) {
+ if (!sd->fsend(SDhello, dirname)) {
stop_bsock_timer(tid);
return 0;
}
@@ -130,7 +132,7 @@
}
Dmsg1(110, "<stored: %s", sd->msg);
stop_bsock_timer(tid);
- if (strncmp(sd->msg, SDOKhello, sizeof(SDOKhello)) != 0) {
+ if (strncmp(sd->msg, SDOKhello, strlen(SDOKhello)) != 0) {
return 0;
}
return 1;
@@ -153,7 +155,7 @@
bash_spaces(dirname);
/* Timeout Hello after 5 mins */
btimer_t *tid = start_bsock_timer(fd, 60 * 5);
- if (!fd->fsend(SDFDhello, dirname)) {
+ if (!fd->fsend(FDhello, dirname)) {
stop_bsock_timer(tid);
return 0;
}
diff -Naur bacula-7.0.1/examples/nagios/check_bacula/Makefile.in bacula-7.0.1.new/examples/nagios/check_bacula/Makefile.in
--- bacula-7.0.1/examples/nagios/check_bacula/Makefile.in 2014-03-31 20:51:34.000000000 +0200
+++ bacula-7.0.1.new/examples/nagios/check_bacula/Makefile.in 2014-04-01 16:46:12.364115625 +0200
@@ -70,7 +70,7 @@
(cd $(srcdir); $(RMF) Makefile)
install: all
- $(INSTALL_PROGRAM) check_bacula $(DESTDIR)$(sbindir)/check_bacula
+ $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) check_bacula $(DESTDIR)$(sbindir)/check_bacula
uninstall:
(cd $(DESTDIR)$(sbindir); $(RMF) check_bacula)
diff -Naur bacula-7.0.1/examples/nagios/check_bacula/makeit bacula-7.0.1.new/examples/nagios/check_bacula/makeit
--- bacula-7.0.1/examples/nagios/check_bacula/makeit 2014-03-31 20:51:34.000000000 +0200
+++ bacula-7.0.1.new/examples/nagios/check_bacula/makeit 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-make LIBS="-lpthread -ldl -lssl -lcrypto -lz"

View File

@ -3,7 +3,7 @@
Name: bacula
Version: 7.0.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Cross platform network backup for Linux, Unix, Mac and Windows
# See LICENSE for details
License: AGPLv3 with exceptions
@ -39,6 +39,7 @@ Patch5: %{name}-5.2.12-seg-fault.patch
Patch6: %{name}-5.2.13-logwatch.patch
Patch7: %{name}-non-free-code.patch
Patch8: %{name}-7.0.0-configure.patch
Patch9: %{name}-7.0.1-fix-nagios.patch
BuildRequires: desktop-file-utils
BuildRequires: perl
@ -287,6 +288,7 @@ This development package contains static libraries and header files.
Summary: Nagios Plugin - check_bacula
Group: Applications/System
Requires: bacula-libs%{?_isa} = %{version}-%{release}
Requires: nagios-common%{?_isa}
%description -n nagios-plugins-bacula
Provides check_bacula support for Nagios.
@ -301,6 +303,7 @@ Provides check_bacula support for Nagios.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} .
# Remove execution permissions from files we're packaging as docs later on
@ -359,10 +362,7 @@ sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
pushd examples/nagios/check_bacula
CFLAGS="%{optflags}" make LIBS="-lpthread -ldl -lssl -lcrypto -lz"
popd
make -C examples/nagios/check_bacula
%if 0%{?fedora} || 0%{?rhel} >= 6
pushd src/qt-console/tray-monitor
@ -737,6 +737,10 @@ fi
%{_libdir}/nagios/plugins/check_bacula
%changelog
* Tue Apr 01 2014 Simone Caronni <negativo17@gmail.com> - 7.0.1-2
- Add patch for Nagios plugin.
- Add missing requirement for Nagios plugin folder.
* Tue Apr 01 2014 Simone Caronni <negativo17@gmail.com> - 7.0.1-1
- Update to 7.0.1; remove Python.
- Drop git patch.