Page 1 of 1

Nagios 4.3.2 - check_smb_file.pl

Posted: Thu Aug 03, 2017 2:38 am
by mschau
Hi!

When I manually exec "check_smb_file.pl" following error occurs:

Code: Select all

root@nagmon:/usr/local/nagios/libexec# ./check_smb_file.pl
Can't locate Filesys/SmbClient.pm in @INC (you may need to install the Filesys::SmbClient module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at ./check_smb_file.pl line 491.
So apparently I have to install some dependencies:

Code: Select all

perl -MCPAN -e 'install Filesys::SmbClient'

---> Where can I find libsmbclient.h ? []
/usr/include/samba-4.0/libsmbclient.h

---> Where can I find libsmbclient.so ? []
/usr/lib/x86_64-linux-gnu/libsmbclient.so


Makefile:347: recipe for target 'SmbClient.o' failed
make: *** [SmbClient.o] Error 1
  ALIAN/Filesys-SmbClient-3.2.tar.gz
  /usr/bin/make -- NOT OK
en detail:

Code: Select all

root@nagmon:/usr/local/nagios/libexec# perl -MCPAN -e 'install Filesys::SmbClient'
Reading '/root/.cpan/Metadata'
  Database was generated on Tue, 01 Aug 2017 10:41:02 GMT
Running install for module 'Filesys::SmbClient'
Checksum for /root/.cpan/sources/authors/id/A/AL/ALIAN/Filesys-SmbClient-3.2.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring A/AL/ALIAN/Filesys-SmbClient-3.2.tar.gz with Makefile.PL
I search in: /usr/local/s/include
/usr/s/include
/s/include
/include
/usr/games/include
/usr/local/games/include
/usr/local/samba/include
/usr/local/samba3/include
/usr/local/include
/usr/include
Where can I find libsmbclient.h ? [] /usr/include/samba-4.0/
I search in: /usr/local/s/lib
/usr/s/lib
/s/lib
/lib
/usr/games/lib
/usr/local/games/lib
/usr/local/lib
/usr/lib
/usr/local/samba/lib
/usr/local/samba3/lib
Where can I find libsmbclient.so ? [] /usr/lib/x86_64-linux-gnu/
Do you want make tests ?(you will be prompted for server /
worgroup / share / user / password to make read write access. [yes] no
Compile module with trace to STDERR ? [no] yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for working alloca.h... yes
checking for alloca... yes
checking for smbc_mkdir in -lsmbclient... yes
checking for smbc_open in -lsmbclient... yes
checking for smbc_fstat in -lsmbclient... yes
checking for smbc_init_context in -lsmbclient... yes
You don't define SMBCTXX->flags. Samba older than 3.0.11. Filesys::SmbClient::set_flag will not work
You use SMBCTXX->close (release < 3.0.20).
configure: creating ./config.status
config.status: creating config.h
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Filesys::SmbClient
Writing MYMETA.yml and MYMETA.json
  ALIAN/Filesys-SmbClient-3.2.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for A/AL/ALIAN/Filesys-SmbClient-3.2.tar.gz
cp SmbClient.pm blib/lib/Filesys/SmbClient.pm
AutoSplitting blib/lib/Filesys/SmbClient.pm (blib/lib/auto/Filesys/SmbClient)
Running Mkbootstrap for Filesys::SmbClient ()
chmod 644 "SmbClient.bs"
x86_64-linux-gnu-gcc -c  -I/usr/include/samba-4.0/ -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"3.2\" -DXS_VERSION=\"3.2\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE"  -DVERBOSE libauthSamba.c
libauthSamba.c: In function ‘set_fn’:
libauthSamba.c:25:13: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
     fprintf("Workgroup is set to %s", workgroup);
             ^
In file included from /usr/include/stdio.h:936:0,
                 from libauthSamba.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:95:1: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
 ^
libauthSamba.c:25:5: warning: format not a string literal and no format arguments [-Wformat-security]
     fprintf("Workgroup is set to %s", workgroup);
     ^
libauthSamba.c: In function ‘auth_fn’:
libauthSamba.c:47:13: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types]
     fprintf("Workgroup is set to %s", Workgroup);
             ^
In file included from /usr/include/stdio.h:936:0,
                 from libauthSamba.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:95:1: note: expected ‘FILE * restrict {aka struct _IO_FILE * restrict}’ but argument is of type ‘char *’
 fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
 ^
libauthSamba.c:47:39: warning: format not a string literal and no format arguments [-Wformat-security]
     fprintf("Workgroup is set to %s", Workgroup);
                                       ^
libauthSamba.c: In function ‘ask_auth_fn’:
libauthSamba.c:80:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(temp, sizeof(temp), stdin);
   ^
libauthSamba.c:88:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(temp, sizeof(temp), stdin);
   ^
libauthSamba.c:96:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(temp, sizeof(temp), stdin);
   ^
"/usr/bin/perl" "/usr/share/perl/5.22/ExtUtils/xsubpp"  -typemap "/usr/share/perl/5.22/ExtUtils/typemap" -typemap "typemap"  SmbClient.xs > SmbClient.xsc && mv SmbClient.xsc SmbClient.c
x86_64-linux-gnu-gcc -c  -I/usr/include/samba-4.0/ -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"3.2\" -DXS_VERSION=\"3.2\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE"  -DVERBOSE SmbClient.c
SmbClient.xs: In function ‘XS_Filesys__SmbClient__mkdir’:
SmbClient.xs:104:1: warning: ‘mkdir’ is deprecated [-Wdeprecated-declarations]
 RETVAL = context->mkdir(context, fname, mode);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3015:41: note: declared here
         smbc_mkdir_fn                   mkdir DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__rmdir’:
SmbClient.xs:128:1: warning: ‘rmdir’ is deprecated [-Wdeprecated-declarations]
 RETVAL = context->rmdir(context, fname);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3016:41: note: declared here
         smbc_rmdir_fn                   rmdir DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__opendir’:
SmbClient.xs:150:3: warning: ‘opendir’ is deprecated [-Wdeprecated-declarations]
   RETVAL = context->opendir(context, fname);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3011:41: note: declared here
         smbc_opendir_fn                 opendir DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs:152:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘SMBCFILE * {aka struct _SMBCFILE *}’ [-Wformat=]
   fprintf(stderr, "! Filesys::SmbClient : _opendir: %d\n", RETVAL);
                   ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__closedir’:
SmbClient.xs:177:1: warning: ‘closedir’ is deprecated [-Wdeprecated-declarations]
 RETVAL = context->closedir(context, fd);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3012:41: note: declared here
         smbc_closedir_fn                closedir DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__readdir’:
SmbClient.xs:201:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘SMBCFILE * {aka struct _SMBCFILE *}’ [-Wformat=]
   fprintf(stderr, "! Filesys::SmbClient : _readdir: %d\n", fd);
                   ^
SmbClient.xs:209:18: warning: ‘readdir’ is deprecated [-Wdeprecated-declarations]
   dirp = (struct smbc_dirent *)context->readdir(context, fd);
                  ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3013:41: note: declared here
         smbc_readdir_fn                 readdir DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__stat’:
SmbClient.xs:237:3: warning: ‘stat’ is deprecated [-Wdeprecated-declarations]
   i = context->stat(context, fname, &buf);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3005:41: note: declared here
         smbc_stat_fn                    stat DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__fstat’:
SmbClient.xs:273:1: warning: ‘fstat’ is deprecated [-Wdeprecated-declarations]
 i = context->fstat(context, fd, &buf);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3006:41: note: declared here
         smbc_fstat_fn                   fstat DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__rename’:
SmbClient.xs:305:1: warning: ‘rename’ is deprecated [-Wdeprecated-declarations]
 RETVAL = context->rename(context, oname, context, nname);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3003:41: note: declared here
         smbc_rename_fn                  rename DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__open’:
SmbClient.xs:339:17: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
 fprintf(stderr, "! Filesys::SmbClient :"
                 ^
SmbClient.xs:350:1: warning: ‘open’ is deprecated [-Wdeprecated-declarations]
 RETVAL = context->open(context, fname, flags, mode);
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:2998:41: note: declared here
         smbc_open_fn                    open DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs:352:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘SMBCFILE * {aka struct _SMBCFILE *}’ [-Wformat=]
   fprintf(stderr, "! Filesys::SmbClient :"
                   ^
SmbClient.xs:361:1: warning: ‘lseek’ is deprecated [-Wdeprecated-declarations]
 } else if (seek_end) { context->lseek(context, RETVAL, 0, SEEK_END); }
 ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3004:41: note: declared here
         smbc_lseek_fn                   lseek DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__read’:
SmbClient.xs:380:3: warning: ‘read’ is deprecated [-Wdeprecated-declarations]
   returnValue = context->read(context, fd, buf, count);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3000:41: note: declared here
         smbc_read_fn                    read DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__write’:
SmbClient.xs:404:3: warning: ‘write’ is deprecated [-Wdeprecated-declarations]
   RETVAL=context->write(context, fd, buf, count);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3001:41: note: declared here
         smbc_write_fn                   write DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs:416:23: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘SMBCFILE * {aka struct _SMBCFILE *}’ [-Wformat=]
       fprintf(stderr, "*** Error Filesys::SmbClient: "
                       ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__lseek’:
SmbClient.xs:430:3: warning: ‘lseek’ is deprecated [-Wdeprecated-declarations]
   RETVAL=context->lseek(context, fd, offset, whence);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3004:41: note: declared here
         smbc_lseek_fn                   lseek DEPRECATED_SMBC_INTERFACE;
                                         ^
SmbClient.xs:440:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘SMBCFILE * {aka struct _SMBCFILE *}’ [-Wformat=]
      fprintf(stderr, "*** Error Filesys::SmbClient: "
                      ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__close’:
SmbClient.xs:460:17: error: ‘SMBCCTX {aka struct _SMBCCTX}’ has no member named ‘close’
   RETVAL=context->close(context, fd);
                 ^
SmbClient.xs: In function ‘XS_Filesys__SmbClient__unlink’:
SmbClient.xs:476:3: warning: ‘unlink’ is deprecated [-Wdeprecated-declarations]
   RETVAL = context->unlink(context, fname);
   ^
In file included from SmbClient.xs:20:0:
/usr/include/samba-4.0/libsmbclient.h:3002:41: note: declared here
         smbc_unlink_fn                  unlink DEPRECATED_SMBC_INTERFACE;
                                         ^
Makefile:347: recipe for target 'SmbClient.o' failed
make: *** [SmbClient.o] Error 1
  ALIAN/Filesys-SmbClient-3.2.tar.gz
  /usr/bin/make -- NOT OK
Any ideas?

Re: Nagios 4.3.2 - check_smb_file.pl

Posted: Thu Aug 03, 2017 9:57 am
by bolson
Which version of Samba and the Samba client are you running?

Re: Nagios 4.3.2 - check_smb_file.pl

Posted: Thu Aug 03, 2017 10:39 am
by mschau
Samba is not installed

root@nagmon:/home/helpdesk# smbclient -V
Version 4.3.11-Ubuntu

Re: Nagios 4.3.2 - check_smb_file.pl

Posted: Thu Aug 03, 2017 12:13 pm
by bolson
I'm unable to find information on whether the perl 'install Filesys::SmbClient' supports version 4.x version of the samba client. The install script seems to be expecting version 3.x. based on the warnings and error messages.