1837509 Members
3731 Online
110117 Solutions
New Discussion

compiling nagios plugins

 
kokwing
Occasional Contributor

compiling nagios plugins

I have problem compiling nagios plugins 1.4.5 in HP-UX 11.11.
The compilation stop at the check_swap phase.
How to fix this problem?

# make
.....
gcc -g -O2 -o check_swap check_swap.o utils.o popen.o -L/tmp/depot/nagios-plugins-1.4.5/plugins -L/opt/openssl/lib -lm ../lib/libnagiosplug.a ../lib/libcoreutils.a /
usr/local/lib/libintl.sl -L/usr/local/lib /usr/local/lib/libiconv.sl -lc -lssl -lcrypto -Wl,+b -Wl,/usr/local/lib
/usr/ccs/bin/ld: Unsatisfied symbols:
floorf (first referenced in check_swap.o) (code)
collect2: ld returned 1 exit status
*** Error exit code 1
8 REPLIES 8
Peter Godron
Honored Contributor

Re: compiling nagios plugins

Hi,
and welcome to the forums !

Problem is down to missing/wrong library or header file. Double check all your LIB_PATHs.
Try to add -lm math.h

For more details on this error:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1374705&group_id=29880


Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Peter Godron
Honored Contributor

Re: compiling nagios plugins

Hi,
how are you getting on with theis problem ?

Could you please complete the thread by awarding points to helpful answers and summarising the solution for you.
This will help resolution of similar problems in the future.
Florian Heigl (new acc)
Honored Contributor

Re: compiling nagios plugins

Hi,

maybe it helps You that there are precompiled nagios plugins for HP-UX at the 'nagios exchange'

http://www.nagiosexchange.org/HP-UX.81.0.html?&tx_netnagext_pi1[p_view]=40
yesterday I stood at the edge. Today I'm one step ahead.
Ralph Grothe
Honored Contributor

Re: compiling nagios plugins

I use Nagios to monitor almost all of our hosts and services (almost, because it's like a model railway an ever ongoing expansion passtime).
And I find that it far better suits my admin needs than so called professional suites like Tivoli (which we I regret to admit have also wasted money on).
You can indeed get prebuilt binaries for many platforms from nagiosexchange, as someone suggested.
However, these are seldomly very much up to date.
Nevertheless, the most fundamental Nagios plug-ins do compile quite easily.
If you don't have any requirement to check swap on your HP-UX hosts by the check_swap plug-in simply skip it.
It's also very easy to write your own plug-in for HP-UX swap state queries, which even would be better suited I would guess.
Either comment the target entry for check_swap in the Makefile and continue.
Or make the remaining plug-ins individually.
There is no special make install required for Nagios plug-ins.
Most of the post-compile commands involves merely things like creating symlinks to check_tcp and check_icmp (which are the two most important plug-ins, as far as the Nagios server is concerned).
If your make aborted due to the swap dificulties, I would suggest to check that check_icmp is owned by root and has the suid bit set (because only root may emit ICMP packets).
Also check that check_host is a sym or hard link to check_icmp, and define check_host as the default check command for your host checks (but *don't* define a check_interval for host checks, as it would subvert Nagios'es own scheduling of host checks and severly degrade performance!).
The check_host guise is special because it is faster than check_icmp as it would only wait for the 1st ICMP packet to return to verify an host OK state and don't linger for any other packets to return.
Is your Nagios server an HP-UX box,
or only your monitored hosts?
In the latter case you would also require some "agent" like the NRPE (also available from nagiosexchange) that would perform the check_swap on behalf of the Nagios server.


Madness, thy name is system administration
kokwing
Occasional Contributor

Re: compiling nagios plugins

After I replaced 'floorf' with 'floor' in the check_swap.c, the compilation was successful.
All the programs in the plug-in directory
are successfully compiled.

However, I encounter error compiling check_dhcp in plugins-root directory.

# make
.....
Making all in plugins-scripts
Making all in plugins-root
if gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../intl -I../plugins -I/o
pt/openssl/include -I/opt/openssl/include -g -O2 -MT check_dhcp.o -MD -MP -MF ".deps/check_dhcp.Tpo" -c -o check_dhcp.o check_dhc
p.c; \
then mv -f ".deps/check_dhcp.Tpo" ".deps/check_dhcp.Po"; else rm -f ".deps/check_dhcp.Tpo"; exit 1; fi
In file included from /usr/include/net/if.h:234,
from check_dhcp.c:60:
/usr/include/net/if6.h:77: error: field 'iflru_addr' has incomplete type
/usr/include/net/if6.h:78: error: field 'iflru_dstaddr' has incomplete type
/usr/include/net/if6.h:118: error: field 'lifra_addr' has incomplete type
/usr/include/net/if6.h:119: error: field 'lifra_mask' has incomplete type
*** Error exit code 1

Since this is a client system, I don't need
the check_dhcp program. I deleted the plugin-root entry in the Makefile.
The compilation was then successful for the rest of the programs.
CRAZY SANTHOSH
Occasional Advisor

Re: compiling nagios plugins

Hi,

Add the following lines to nagios-plugins-1.4.5/plugins/common.h file

defined(__hpux__).

I think it will fix your compilation error.Even I got this error.

May i know What for you are compiling Nagios???As it is available on HP-UX(11iv1,11iv2,11iv3)
Dennis Handly
Acclaimed Contributor

Re: compiling nagios plugins

As Peter said, you need to add -lm to the link line. But since you already have it, that's not quite the right answer.

The issue is that you need to put the -lm at the end of the link line, after you use it.

Hmm, that's not the case either. Looking at math.h, it seems that floorf isn't available on PA and it's only there for IPF. So your solution of using floor, is the correct one.

/usr/include/net/if6.h:77: error: field 'iflru_addr' has incomplete type

This occurs because you haven't included or you haven't compiled with -D_HPUX_SOURCE or _INCLUDE_XOPEN_SOURCE_520.

Caution, I'm not sure if that's 520 or a typo (for 500) since it don't see anyone setting it in . It does seem to be fixed on 11.31.
Dennis Handly
Acclaimed Contributor

Re: compiling nagios plugins

>Dennis: I'm not sure if that's 520 or a typo (for 500) since it don't see anyone setting it in .

This was fixed with CR JAGaf64977 for 11.31.