From 33d5f9448b17dafb985754086aa132979033b3ba Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 3 Dec 2009 09:21:01 +0100 Subject: [PATCH] Apply Arno's patch on nagios plugin Tweak the Makefile to simplify the installation process --- bacula/autoconf/configure.in | 1 + .../examples/nagios/check_bacula/Makefile.in | 98 +++++ bacula/examples/nagios/check_bacula/README | 15 + .../nagios/check_bacula/authenticate.c | 180 +++++++++ .../nagios/check_bacula/check_bacula.c | 370 ++++++++++++++++++ .../nagios/check_bacula/check_bacula.h | 121 ++++++ .../nagios/nagios_plugin_check_bacula.tgz | Bin 6311 -> 0 bytes .../examples/nagios/prepare_for_check_bacula | 32 -- 8 files changed, 785 insertions(+), 32 deletions(-) create mode 100644 bacula/examples/nagios/check_bacula/Makefile.in create mode 100755 bacula/examples/nagios/check_bacula/README create mode 100644 bacula/examples/nagios/check_bacula/authenticate.c create mode 100644 bacula/examples/nagios/check_bacula/check_bacula.c create mode 100644 bacula/examples/nagios/check_bacula/check_bacula.h delete mode 100644 bacula/examples/nagios/nagios_plugin_check_bacula.tgz delete mode 100755 bacula/examples/nagios/prepare_for_check_bacula diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 1699f8e9c2..649b746971 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -3005,6 +3005,7 @@ AC_OUTPUT([autoconf/Make.common \ updatedb/update_mysql_tables_10_to_11 \ updatedb/update_sqlite3_tables_10_to_11 \ updatedb/update_postgresql_tables_10_to_11 \ + examples/nagios/check_bacula/Makefile.in \ $PFILES ], [ ] ) diff --git a/bacula/examples/nagios/check_bacula/Makefile.in b/bacula/examples/nagios/check_bacula/Makefile.in new file mode 100644 index 0000000000..235efbf235 --- /dev/null +++ b/bacula/examples/nagios/check_bacula/Makefile.in @@ -0,0 +1,98 @@ +# +# Version $Id: Makefile.in,v 1.4 2004/09/25 10:19:59 nboichat Exp $ +# +@MCOMMON@ + +srcdir = . +VPATH = . +.PATH: . + +# one up +basedir = ../../../src +# top dir +topdir = ../../.. +# this dir relative to top dir +thisdir = ../examples/nagios/check_bacula + +DEBUG=@DEBUG@ + +first_rule: all +dummy: + +# +CHECKSRCS = check_bacula.c authenticate.c +CHECKOBJS = check_bacula.o authenticate.o + +# these are the objects that are changed by the .configure process +EXTRAOBJS = @OBJLIST@ + +CHECK_CPPFLAGS= +CHECK_LDFLAGS= + +.SUFFIXES: .c .o +.PHONY: +.DONTCARE: + +# inference rules +.c.o: + @echo "Compiling $<" + $(NO_ECHO) $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(CHECK_CPPFLAGS) \ + -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< +#------------------------------------------------------------------------- +all: Makefile check_bacula + @echo "==== Make of check_bacula is good ====" + @echo " " + +check_bacula: Makefile $(CHECKOBJS) $(basedir)/lib/libbac$(DEFAULT_ARCHIVE_TYPE) + $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) $(CHECK_LDFLAGS) -L$(basedir)/lib -o $@ \ + $(CHECKOBJS) $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS) + + +Makefile: $(srcdir)/Makefile.in $(topdir)/config.status + cd $(topdir) \ + && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +libtool-clean: + $(RMF) -r .libs _libs + +clean: + @$(RMF) check_bacula core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3 + +realclean: clean + @$(RMF) tags + +distclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile) + +devclean: realclean + if test $(srcdir) = .; then $(MAKE) realclean; fi + (cd $(srcdir); $(RMF) Makefile) + +install: all + $(INSTALL_PROGRAM) check_bacula $(DESTDIR)$(sbindir)/check_bacula + +uninstall: + (cd $(DESTDIR)$(sbindir); $(RMF) check_bacula) + + + +# Semi-automatic generation of dependencies: +# Use gcc -MM because X11 `makedepend' doesn't work on all systems +# and it also includes system headers. +# `semi'-automatic since dependencies are generated at distribution time. + +depend: + @$(MV) Makefile Makefile.bak + @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile + @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(CHECK_CPPFLAGS) -I$(srcdir) -I$(basedir) *.c >> Makefile + @if test -f Makefile ; then \ + $(RMF) Makefile.bak; \ + else \ + $(MV) Makefile.bak Makefile; \ + echo -e "Something went wrong\n\a"; \ + fi + +# ----------------------------------------------------------------------- +# DO NOT DELETE: nice dependency list follows diff --git a/bacula/examples/nagios/check_bacula/README b/bacula/examples/nagios/check_bacula/README new file mode 100755 index 0000000000..2914b0b452 --- /dev/null +++ b/bacula/examples/nagios/check_bacula/README @@ -0,0 +1,15 @@ +# It's more or less untested, though. +# Submitted by Arno Lehmann +# + +run ./configure with your usual options at the toplevel. Afterwards, use +'make' to create your binaries. + +If you encounter problems, you'll have to setup the Bacula source manually. + +Note that check_bacula does not support TLS and is an unsupported add-on to +Bacula. Even if it's not part of the core Bacula programs, questions can be +asked at the bacula-users mailing list. + +Bacula is a Trademark of Kern Sibbald. Bacula and the accompanying programs +are open source. See the LICENSE file for more information. diff --git a/bacula/examples/nagios/check_bacula/authenticate.c b/bacula/examples/nagios/check_bacula/authenticate.c new file mode 100644 index 0000000000..e7cb17f977 --- /dev/null +++ b/bacula/examples/nagios/check_bacula/authenticate.c @@ -0,0 +1,180 @@ +/* + * + * Bacula authentication. Provides authentication with + * File and Storage daemons. + * + * Nicolas Boichat, August MMIV + * + * This routine runs as a thread and must be thread reentrant. + * + * Basic tasks done here: + * + */ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +#include "bacula.h" +#include "check_bacula.h" + +void senditf(const char *fmt, ...); +void sendit(const char *buf); + +/* Commands sent to Director */ +static char DIRhello[] = "Hello %s calling\n"; + +/* 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"; + +/* Response from SD */ +static char SDOKhello[] = "3000 OK Hello\n"; +/* Response from FD */ +static char FDOKhello[] = "2000 OK Hello\n"; +static char FD3OKhello[] = "2000 OK Hello 1\n"; +static char FD31OKhello[] = "2000 OK Hello 2\n"; + +/* Forward referenced functions */ + +/* + * Authenticate Director + */ +int authenticate_director(BSOCK *dir, char *dirname, char *password) +{ + int tls_local_need = BNET_TLS_NONE; + int tls_remote_need = BNET_TLS_NONE; + int compatible = true; + char bashed_name[MAX_NAME_LENGTH]; + + bstrncpy(bashed_name, dirname, sizeof(bashed_name)); + bash_spaces(bashed_name); + + /* Timeout Hello after 5 mins */ + btimer_t *tid = start_bsock_timer(dir, 60 * 5); + bnet_fsend(dir, DIRhello, bashed_name); + + if (!cram_md5_respond(dir, password, &tls_remote_need, &compatible) || + !cram_md5_challenge(dir, password, tls_local_need, compatible)) { + stop_bsock_timer(tid); + return 0; + } + + Dmsg1(6, ">dird: %s", dir->msg); + if (bnet_recv(dir) <= 0) { + stop_bsock_timer(tid); + return 0; + } + Dmsg1(10, "msg); + stop_bsock_timer(tid); + if (strncmp(dir->msg, DIROKhello, sizeof(DIROKhello)-1) != 0) { + return 0; + } + return 1; +} + +/* + * Authenticate Storage daemon connection + */ +int authenticate_storage_daemon(BSOCK *sd, char *sdname, char* password) +{ + char dirname[MAX_NAME_LENGTH]; + int tls_local_need = BNET_TLS_NONE; + int tls_remote_need = BNET_TLS_NONE; + int compatible = true; + + /* + * Send my name to the Storage daemon then do authentication + */ + bstrncpy(dirname, sdname, sizeof(dirname)); + bash_spaces(dirname); + /* Timeout Hello after 5 mins */ + btimer_t *tid = start_bsock_timer(sd, 60 * 5); + if (!bnet_fsend(sd, SDFDhello, dirname)) { + stop_bsock_timer(tid); + return 0; + } + if (!cram_md5_respond(sd, password, &tls_remote_need, &compatible) || + !cram_md5_challenge(sd, password, tls_local_need, compatible)) { + stop_bsock_timer(tid); + return 0; + } + Dmsg1(116, ">stored: %s", sd->msg); + if (bnet_recv(sd) <= 0) { + stop_bsock_timer(tid); + return 0; + } + Dmsg1(110, "msg); + stop_bsock_timer(tid); + if (strncmp(sd->msg, SDOKhello, sizeof(SDOKhello)) != 0) { + return 0; + } + return 1; +} + +/* + * Authenticate File daemon connection + */ +int authenticate_file_daemon(BSOCK *fd, char *fdname, char *password) +{ + char dirname[MAX_NAME_LENGTH]; + int tls_local_need = BNET_TLS_NONE; + int tls_remote_need = BNET_TLS_NONE; + int compatible = true; + + /* + * Send my name to the File daemon then do authentication + */ + bstrncpy(dirname, fdname, sizeof(dirname)); + bash_spaces(dirname); + /* Timeout Hello after 5 mins */ + btimer_t *tid = start_bsock_timer(fd, 60 * 5); + if (!bnet_fsend(fd, SDFDhello, dirname)) { + stop_bsock_timer(tid); + return 0; + } + if (!cram_md5_respond(fd, password, &tls_remote_need, &compatible) || + !cram_md5_challenge(fd, password, tls_local_need, compatible)) { + stop_bsock_timer(tid); + return 0; + } + Dmsg1(116, ">filed: %s", fd->msg); + if (bnet_recv(fd) <= 0) { + stop_bsock_timer(tid); + return 0; + } + Dmsg1(110, "msg); + stop_bsock_timer(tid); + if ((strncmp(fd->msg, FDOKhello, sizeof(FDOKhello)) != 0) && + (strncmp(fd->msg, FD3OKhello, sizeof(FD3OKhello)) != 0) && + (strncmp(fd->msg, FD31OKhello, sizeof(FD31OKhello)) != 0) ) { + return 0; + } + return 1; +} diff --git a/bacula/examples/nagios/check_bacula/check_bacula.c b/bacula/examples/nagios/check_bacula/check_bacula.c new file mode 100644 index 0000000000..872d31d155 --- /dev/null +++ b/bacula/examples/nagios/check_bacula/check_bacula.c @@ -0,0 +1,370 @@ +/* + * + * Nagios Plugin check_bacula + * + * Christian Masopust, (c)2005 + * + * Version $Id: check_bacula.c,v 1.0 2005/02/25 + */ + +/* + Copyright (C) 2005 Christian Masopust + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "check_bacula.h" + +#define STATE_OK 0 +#define STATE_WARNING 1 +#define STATE_CRITICAL 2 +#define STATE_UNKNOWN 3 + + +/* Imported functions */ +int authenticate_director(BSOCK *s, char *dirname, char *password); +int authenticate_file_daemon(BSOCK *s, char *fdname, char *password); +int authenticate_storage_daemon(BSOCK *s, char* sdname, char *password); + +/* Forward referenced functions */ +void writecmd(monitoritem* item, const char* command); +int docmd(monitoritem* item, const char* command, char *answer); + +/* Static variables */ +static monitoritem mitem; + +/* Data received from DIR/FD/SD */ +static char OKqstatus[] = "%c000 OK .status\n"; + + + +static void usage() +{ + fprintf(stderr, _( +"Copyright (C) 2005 Christian Masopust\n" +"Written by Christian Masopust (2005)\n" +"\nVersion: " VERSION " (" BDATE ") %s %s %s\n\n" +"Usage: check_bacula [-d debug_level] -H host -D daemon -N name -P port\n" +" -H hostname where daemon runs\n" +" -D which daemon to check: dir|sd|fd\n" +" -M name of monitor (as in bacula-*.conf)\n" +" -K password for access to daemon\n" +" -P port where daemon listens\n" +" -dnn set debug level to nn\n" +" -? print this message.\n" +"\n"), HOST_OS, DISTNAME, DISTVER); +} + + +/********************************************************************* + * + * Main Bacula Tray Monitor -- User Interface Program + * + */ +int main(int argc, char *argv[]) +{ + int ch; + DIRRES s_dird; + CLIENT s_filed; + STORE s_stored; + + char host[250]; + char daemon[20]; + char monitorname[100]; + char pw[200]; + int port = 0; + + char answer[1024]; + int retcode = STATE_UNKNOWN; + + unsigned int i, j; + struct MD5Context md5c; + unsigned char signature[16]; + + + struct sigaction sigignore; + sigignore.sa_flags = 0; + sigignore.sa_handler = SIG_IGN; + sigfillset(&sigignore.sa_mask); + sigaction(SIGPIPE, &sigignore, NULL); + + strcpy (pw, ""); + + init_stack_dump(); + my_name_is(argc, argv, "check_bacula"); + textdomain("bacula"); + init_msg(NULL, NULL); + + while ((ch = getopt(argc, argv, "H:D:M:P:K:d:h?")) != -1) { + + switch (ch) { + + case 'H': + strcpy (host, optarg); + break; + + case 'D': + strcpy (daemon, optarg); + break; + + case 'M': + strcpy (monitorname, optarg); + break; + + case 'P': + port = atoi(optarg); + break; + + case 'K': + strcpy (pw, optarg); + break; + + case 'd': + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + break; + + case 'h': + case '?': + default: + usage(); + exit(1); + } + } + argc -= optind; + //argv += optind; + + if (argc) { + usage(); + exit(STATE_UNKNOWN); + } + + lmgr_init_thread(); + + char sig[100]; + MD5Init(&md5c); + MD5Update(&md5c, (unsigned char *) pw, strlen(pw)); + MD5Final(signature, &md5c); + for (i = j = 0; i < sizeof(signature); i++) { + sprintf(&sig[j], "%02x", signature[i]); + j += 2; + } + + + /* director ? */ + if (strcmp (daemon, "dir") == 0) { + + if (port != 0) + s_dird.DIRport = port; + else + s_dird.DIRport = 9101; + + s_dird.address = host; + s_dird.password = sig; + s_dird.hdr.name = monitorname; + + mitem.type = R_DIRECTOR; + mitem.resource = &s_dird; + mitem.D_sock = NULL; + + } else if (strcmp (daemon, "sd") == 0) { + + if (port != 0) + s_stored.SDport = port; + else + s_stored.SDport = 9103; + + s_stored.address = host; + s_stored.password = sig; + s_stored.hdr.name = monitorname; + + mitem.type = R_STORAGE; + mitem.resource = &s_stored; + mitem.D_sock = NULL; + + } else if (strcmp (daemon, "fd") == 0) { + + if (port != 0) + s_filed.FDport = port; + else + s_filed.FDport = 9102; + + s_filed.address = host; + s_filed.password = sig; + s_filed.hdr.name = monitorname; + + mitem.type = R_CLIENT; + mitem.resource = &s_filed; + mitem.D_sock = NULL; + + } else { + + usage(); + exit(1); + } + + + if (mitem.type == R_DIRECTOR) + retcode = docmd(&mitem, ".status dir current\n", answer); + else + retcode = docmd(&mitem, ".status current\n", answer); + + + if (mitem.D_sock) { + bnet_sig(mitem.D_sock, BNET_TERMINATE); /* send EOF */ + bnet_close(mitem.D_sock); + } + + printf ("%s\n", answer); + return retcode; +} + + +static int authenticate_daemon(monitoritem* item) { + + DIRRES *d; + CLIENT *f; + STORE *s; + + switch (item->type) { + case R_DIRECTOR: + d = (DIRRES *)item->resource; + return authenticate_director(item->D_sock, d->hdr.name, d->password); + break; + case R_CLIENT: + f = (CLIENT *)item->resource; + return authenticate_file_daemon(item->D_sock, f->hdr.name, f->password); + break; + case R_STORAGE: + s = (STORE *)item->resource; + return authenticate_storage_daemon(item->D_sock, s->hdr.name, s->password); + break; + default: + printf("Error, currentitem is not a Client or a Storage..\n"); + return FALSE; + } +} + + + +int docmd(monitoritem* item, const char* command, char *answer) { + + int stat; + char num; + char *dname; + + dname = ""; + + if (!item->D_sock) { + + DIRRES* dird; + CLIENT* filed; + STORE* stored; + + switch (item->type) { + case R_DIRECTOR: + dird = (DIRRES*)item->resource; + item->D_sock = bnet_connect(NULL, 0, 0, 0, "Director daemon", dird->address, NULL, dird->DIRport, 0); + dname = "Director"; + break; + case R_CLIENT: + filed = (CLIENT*)item->resource; + item->D_sock = bnet_connect(NULL, 0, 0, 0, "File daemon", filed->address, NULL, filed->FDport, 0); + dname = "FileDaemon"; + break; + case R_STORAGE: + stored = (STORE*)item->resource; + item->D_sock = bnet_connect(NULL, 0, 0, 0, "Storage daemon", stored->address, NULL, stored->SDport, 0); + dname = "StorageDaemon"; + break; + default: + printf("Error, currentitem is not a Client, a Storage or a Director..\n"); + return STATE_UNKNOWN; + } + + if (item->D_sock == NULL) { + sprintf (answer, "BACULA CRITICAL - Cannot connect to %s!", dname); + return STATE_CRITICAL; + } + + if (!authenticate_daemon(item)) { + sprintf (answer, "BACULA CRITICAL - Cannot authenticate to %s: %s", dname, item->D_sock->msg); + item->D_sock = NULL; + return STATE_CRITICAL; + } + + } + + if (command[0] != 0) + writecmd(item, command); + + while(1) { + if ((stat = bnet_recv(item->D_sock)) >= 0) { + + /* welcome message of director */ + if ((item->type == R_DIRECTOR) && (strncmp(item->D_sock->msg, "Using ", 6) == 0)) + continue; + + if (sscanf(item->D_sock->msg, OKqstatus, &num) != 1) { + /* Error, couldn't find OK */ + sprintf (answer, "BACULA CRITICAL - %s Status: %s", dname, item->D_sock->msg); + return STATE_CRITICAL; + } else { + sprintf (answer, "BACULA OK - %s Status OK", dname); + return STATE_OK; + } + } + else if (stat == BNET_SIGNAL) { + if (item->D_sock->msglen == BNET_EOD) { + strcpy(answer, "BACULA WARNING - << EOD >>"); + return STATE_WARNING; + } + else if (item->D_sock->msglen == BNET_PROMPT) { + strcpy(answer, "BACULA WARNING - BNET_PROMPT signal received."); + return STATE_WARNING; + } + else if (item->D_sock->msglen == BNET_HEARTBEAT) { + bnet_sig(item->D_sock, BNET_HB_RESPONSE); + } + else { + sprintf(answer, "BACULA WARNING - Unexpected signal received : %s ", bnet_sig_to_ascii(item->D_sock)); + } + } + else { /* BNET_HARDEOF || BNET_ERROR */ + strcpy(answer, "BACULA CRITICAL - ERROR: BNET_HARDEOF or BNET_ERROR"); + item->D_sock = NULL; + return STATE_CRITICAL; + } + + if (is_bnet_stop(item->D_sock)) { + item->D_sock = NULL; + return STATE_WARNING; + } + } +} + +void writecmd(monitoritem* item, const char* command) { + if (item->D_sock) { + item->D_sock->msglen = strlen(command); + pm_strcpy(&item->D_sock->msg, command); + bnet_send(item->D_sock); + } +} + diff --git a/bacula/examples/nagios/check_bacula/check_bacula.h b/bacula/examples/nagios/check_bacula/check_bacula.h new file mode 100644 index 0000000000..03811af503 --- /dev/null +++ b/bacula/examples/nagios/check_bacula/check_bacula.h @@ -0,0 +1,121 @@ +/* + * Includes specific to the tray monitor + * + * Nicolas Boichat, August MMIV + * + * Version $Id: tray-monitor.h,v 1.6 2004/08/25 12:20:01 nboichat Exp $ + */ +/* + Copyright (C) 2004 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +/* + * Resource codes -- they must be sequential for indexing + */ +enum rescode { + R_MONITOR = 1001, + R_DIRECTOR, + R_CLIENT, + R_STORAGE, + R_FIRST = R_MONITOR, + R_LAST = R_STORAGE /* keep this updated */ +}; + + +/* + * Some resource attributes + */ +enum { + R_NAME = 1020, + R_ADDRESS, + R_PASSWORD, + R_TYPE, + R_BACKUP +}; + +/* Director */ +struct DIRRES { + RES hdr; + int DIRport; /* UA server port */ + char *address; /* UA server address */ + char *password; /* UA server password */ + int enable_ssl; /* Use SSL */ +}; + +/* + * Tray Monitor Resource + * + */ +struct MONITOR { + RES hdr; + int require_ssl; /* Require SSL for all connections */ + MSGS *messages; /* Daemon message handler */ + char *password; /* UA server password */ + utime_t RefreshInterval; /* Status refresh interval */ + utime_t FDConnectTimeout; /* timeout for connect in seconds */ + utime_t SDConnectTimeout; /* timeout in seconds */ +}; + + +/* + * Client Resource + * + */ +struct CLIENT { + RES hdr; + + int FDport; /* Where File daemon listens */ + char *address; + char *password; + int enable_ssl; /* Use SSL */ +}; + +/* + * Store Resource + * + */ +struct STORE { + RES hdr; + + int SDport; /* port where Directors connect */ + char *address; + char *password; + int enable_ssl; /* Use SSL */ +}; + + + +/* Define the Union of all the above + * resource structure definitions. + */ +union URES { + MONITOR res_monitor; + DIRRES res_dir; + CLIENT res_client; + STORE res_store; + RES hdr; +}; + + + +struct monitoritem { + rescode type; /* R_DIRECTOR, R_CLIENT or R_STORAGE */ + void* resource; /* DIRRES*, CLIENT* or STORE* */ + BSOCK *D_sock; +}; diff --git a/bacula/examples/nagios/nagios_plugin_check_bacula.tgz b/bacula/examples/nagios/nagios_plugin_check_bacula.tgz deleted file mode 100644 index 761751e6a6167c72214eb6d171b7e6fe7dcad81a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6311 zcmV;Y7+B{YiwFQc$qPyV1MEEOdfLd6`D;Bz4asD{0~m;L&R{ze%*E!Ii$8=j$tGEj zEVV!rA+eH(<1@)V(muid+I_LD>TX@Zw~Qy}w)zr-x~r?Js;jE2N-fGe`kd(>rWcyN zvbCK@f5cV6>v_G-Kk<^E)$pFTRjaj1?fLHRZoT%Xg5URcA3^;Op(b;!{6O;n9(k@C z+yr-FIp2buZ+(^1>#wbXIdcL_*8*17A7~C*;Jw}5%=$-qP<>v1_NZEUUaQvj>U+;o zPpb9mZuJpV9%%j>ue+}QZTBR;lck@XsD}ab|=xgGI>o>~T)8Wb$72Sfv0lX!!oa^4X0rqpCw@4!Y7tKB4NZm3X*QA z?|66)$IM}#X2aR)!nSn6(zkTx_>9(dNsa!T8E|pMM_en@rM*HmFbsKy&y8erb-! z&Ee$DK3_0YR$w2Q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{U@F*@O3>~LVICT@wX%c zc%9a)60uI)AzLVN@jZgFoB_cSYrz=NjnnC@kKz=Iy+kW>DQwei2`|-eau+uHZT3cyg(nL z>xnNr?Y}MLWsEg^bmP@rPQ^Hf@WJ%z=@l)m)>SsUpiT4!1q63;ZDSA5>5zL;E`U0- z9mXSlChu~gaz(#_gI&nD)5q5|vI6#9`3v+K9LhFlbhJfwBr+X{V${K{g>oaUKy6a=40Gw&|C5gTY`h7z_r3!C){L d3 -# - -# Save configure -mv -uiv configure configure.without_check_bacula - -# Modify ./configure -sed -e 's/\(ac_config_files=".*$PFILES\)"/\1 src\/check_bacula\/Makefile"/' -e 's/\(^ *# Handling of arguments.*$\)/\1\n "src\/check_bacula\/Makefile" ) CONFIG_FILES="$CONFIG_FILES src\/check_bacula\/Makefile" ;;/' configure.without_check_bacula > configure -chmod a+x configure - -# extract check_bacula source -tar xzCf src examples/nagios/nagios_plugin_check_bacula.tgz - -echo "Now you can run ./configure with your usual options. Afterwards, use -'make' to create your binaries. Then you can run 'make' in -src/check_bacula to create that program. - -If you encounter problems, you'll have to setup the Bacula source manually. -The original configure script has been saved to configure.without_check_bacula - -Note that check_bacula does not support TLS and is an unsupported add-on to -Bacula. Even if it's not part of the core Bacula programs, questions can be -asked at the bacula-users mailing list. - -Bacula is a Trademark of Kern Sibbald. Bacula and the accompanying programs -are open source. See the LICENSE file for more information. -" -- 2.39.5