Statically Linked NRPE

David Wilkinson nagios-users at noroutetohost.net
Fri Jul 1 17:03:05 CEST 2011


Hi

I have managed to get it to work.

I had to change the LDFLAGS option to include -lz -ldl

LDFLAGS= -L/usr/lib64 -lssl -lcrypto -lz -ldl

# file nrpe
nrpe: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), 
statically linked, for GNU/Linux 2.6.15, not stripped


Regards

David



On 01/07/11 11:57, David Wilkinson wrote:
> Hi All
>
> I am trying to get a statically linked version of NRPE to put on our
> servers.
>
> I tried the Statically Linked Nagios Linux Agent from the Nagios website
> http://exchange.nagios.org/directory/Addons/Monitoring-Agents/Statically-Linked-Nagios-Linux-Agent
>
> It fails to extract to the files when I try to use it, I get the following.
>
> ./Linux_Static_Agent.tar.gz.sh
> Created by: $Id: Makefile 63 2010-07-19 18:32:09Z mmestnik $.
> Mon Jul 19 18:32:18 UTC 2010
> Hostname: colinux
> User: mmestnik
> Path: Linux_Static_Agent
> URL:
> https://devhub.nagios.com/svn/xiagents/trunk/Development/Linux_Static_Agent
> Repository Root: https://devhub.nagios.com/svn/xiagents
> Repository UUID: 775aac8c-84a2-4f69-ad47-ca51e7846425
> Revision: 57
> Node Kind: directory
> Schedule: normal
> Last Changed Author: mmestnik
> Last Changed Rev: 57
> Last Changed Date: 2010-07-15 21:00:37 +0000 (Thu, 15 Jul 2010)
> Removed ci commands and the alias, mmestnik. Aug 03 2010
>
> gzip: stdin: unexpected end of file
> tar: Child returned status 1
> tar: Error is not recoverable: exiting now
> ./Linux_Static_Agent.tar.gz.sh: 67: How: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: EOF: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: Provided: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: EOF: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: How: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: EOF: not found
> ./Linux_Static_Agent.tar.gz.sh: 67: Provided: not found
> ###### Repeats the ./Linux_Static_Agent.tar.gz.sh: 67 line loads of
> times ######
> Starting nrpe:
>
>
> I tried to email the owner and I got a bounce back so I have tried
> compile a static linked version from source
>
> In the Makefile and src/Makefile I have added
> CC=gcc -static
> and from searching around I have also tried adding
> LDFLAGS= -L/usr/lib64 /usr/lib64/libssl.a /usr/lib64/libcrypto.a -ldl
> to the make files and the compile fails every time
>
>
> I get the following error every time I try to compile NRPE statically
> linked.
> Any idea's or pointers on how I can get this to work?
> Could be an OS problem? I am using Debain Squeeze x64
>
>
> # make
> cd ./src/; make ; cd ..
> make[1]: Entering directory `/root/nagios/nrpe-2.12/src'
> gcc -static -g -O2 -I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H
> -o nrpe nrpe.c utils.c -L/usr/lib64 /usr/lib64/libssl.a
> /usr/lib64/libcrypto.a -ldl -lssl -lcrypto -lnsl
> nrpe.c: In function ‘main’:
> nrpe.c:179: warning: ignoring return value of ‘getcwd’, declared with
> attribute warn_unused_result
> nrpe.c:286: warning: ignoring return value of ‘chdir’, declared with
> attribute warn_unused_result
> nrpe.c: In function ‘my_system’:
> nrpe.c:1340: warning: ignoring return value of ‘pipe’, declared with
> attribute warn_unused_result
> nrpe.c:1393: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result
> nrpe.c:1403: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result
> nrpe.c: In function ‘write_pid_file’:
> nrpe.c:1615: warning: ignoring return value of ‘write’, declared with
> attribute warn_unused_result
> /usr/lib64/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
> (.text+0x5b4): warning: Using 'dlopen' in statically linked applications
> requires at runtime the shared libraries from the glibc version used for
> linking
> /tmp/ccJFpUJ7.o: In function `drop_privileges':
> /root/nagios/nrpe-2.12/src/nrpe.c:1558: warning: Using 'initgroups' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /root/nagios/nrpe-2.12/src/nrpe.c:1515: warning: Using 'getgrnam' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /root/nagios/nrpe-2.12/src/nrpe.c:1520: warning: Using 'endgrent' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /root/nagios/nrpe-2.12/src/nrpe.c:1541: warning: Using 'getpwnam' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /root/nagios/nrpe-2.12/src/nrpe.c:1546: warning: Using 'endpwent' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /tmp/ccJFpUJ7.o: In function `is_an_allowed_host':
> /root/nagios/nrpe-2.12/src/nrpe.c:990: warning: Using 'gethostbyname' in
> statically linked applications requires at runtime the shared libraries
> from the glibc version used for linking
> /tmp/ccWaGZas.o: In function `my_connect':
> /root/nagios/nrpe-2.12/src/utils.c:147: warning: Using 'getprotobyname'
> in statically linked applications requires at runtime the shared
> libraries from the glibc version used for linking
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_free':
> (.text+0x6f): undefined reference to `inflateEnd'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_free':
> (.text+0x8d): undefined reference to `deflateEnd'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_ctrl':
> (.text+0x3b4): undefined reference to `deflate'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_ctrl':
> (.text+0x46a): undefined reference to `zError'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_read':
> (.text+0x54b): undefined reference to `inflate'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_read':
> (.text+0x5cd): undefined reference to `zError'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_read':
> (.text+0x63c): undefined reference to `inflateInit_'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_write':
> (.text+0x737): undefined reference to `deflate'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_write':
> (.text+0x7bd): undefined reference to `zError'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `bio_zlib_write':
> (.text+0x851): undefined reference to `deflateInit_'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `zlib_stateful_expand_block':
> (.text+0x9ae): undefined reference to `inflate'
> /usr/lib64/libcrypto.a(c_zlib.o): In function
> `zlib_stateful_compress_block':
> (.text+0xa5e): undefined reference to `deflate'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `zlib_stateful_finish':
> (.text+0xaaf): undefined reference to `inflateEnd'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `zlib_stateful_finish':
> (.text+0xab9): undefined reference to `deflateEnd'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `zlib_stateful_init':
> (.text+0xb67): undefined reference to `inflateInit_'
> /usr/lib64/libcrypto.a(c_zlib.o): In function `zlib_stateful_init':
> (.text+0xbe9): undefined reference to `deflateInit_'
> collect2: ld returned 1 exit status
> make[1]: *** [nrpe] Error 1
> make[1]: Leaving directory `/root/nagios/nrpe-2.12/src'
>
> *** Compile finished ***
>
>
>
> Thanks
>
> David
>
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list