Hi All,
on my system (Solaris 10 x86 64-bit), version 1.4.14 of the
nagios-plugins did not build successfully. It stopped with the following
library compatibility error:
============================================
/openpkg/bin/cc -m64 -O2 -pipe -m64 -o pst3 pst3-pst3.o -L/openpkg/lib
-L/openpkg/RPM/TMP/nagios-3.2.1/nagios-plugins-1.4.14/plugins-root
-lpthread -ldl -lssl -lcrypto
/openpkg/bin/ld: skipping incompatible /openpkg/lib/libssl.a when
searching for -lssl
/openpkg/bin/ld: skipping incompatible
/openpkg/lib/gcc/i386-pc-solaris2.10/4.2.4/../../../libssl.a when
searching for -lssl
/openpkg/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status
make[2]: *** [pst3] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
+ exit 2
============================================
I don't know if this issue is related to OpenSSL 1.0, but I don't think
so. Switching to 32-bit mode for this particular pst3 file (used by the
check_procs command) solved the problem, so I made the following
adjustments in the patch files of the Nagios package:
- nagios.patch was modified to only handle the "basic" Nagios package.
That means, the modifications concerning nagios-plugins were moved to
the "nagios-plugins.patch" file
- nagios-plugins.patch was created from scratch. The file contains the
modifications related to the nagios-plugins that were already part of
the package + my modifications to make it build under Solaris 10
Then, the nagios.spec file was modified for the following reasons:
- It had to take in account the new patch (nagios-plugins.patch)
- Because the package is created as user openpkg, the checks that
require root permissions are not installed per default. This can be
forced using the "make install-root" target
- The ownership of these "root plugins" has to be root:root, otherwise
they will refuse to run, so these settings have to be adjusted at the
end of the package creation
I hope these modifications are useful for some of you.
Best Regards,
Olivier
Index: base/logging.c
--- base/logging.c.orig 2007-10-29 00:21:29 +0100
+++ base/logging.c 2008-05-28 08:27:03 +0200
@@ -204,6 +204,7 @@
/* write something to the syslog facility */
int write_to_syslog(char *buffer, unsigned long data_type){
+static int logopen = 0;
if(buffer==NULL)
return ERROR;
@@ -220,6 +221,12 @@
if(!(data_type & syslog_options))
return OK;
+ /* OSSP fsl identification */
+ if (!logopen) {
+ openlog("nagios", LOG_NDELAY, LOG_USER);
+ logopen = 1;
+ }
+
/* write the buffer to the syslog facility */
syslog(LOG_USER|LOG_INFO,"%s",buffer);
Index: base/utils.c
--- base/utils.c.orig 2008-03-10 21:58:33 +0100
+++ base/utils.c 2008-05-28 08:27:03 +0200
@@ -499,7 +499,7 @@
/* report an error if we couldn't run the command */
if(fp==NULL){
- strncpy(buffer,"(Error: Could not execute command)\n",sizeof(buffer)-1);
+ snprintf(buffer,sizeof(buffer)-1,"(Error: Could not execute command \"%s\")", cmd);
buffer[sizeof(buffer)-1]='\x0';
/* write the error back to the parent process */
##
## nagios.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package versions
%define V_nagios 3.2.1
%define V_nagios_plugins 1.4.14
%define V_perl_nagios_plugin 0.34
%define V_perl_nagios_object 0.20
%define V_perl_nagios_cmd 0.05
# package information
Name: nagios
Summary: System and Network Monitoring
URL: http://www.nagios.org/
Vendor: Ethan Galstad et al.
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: PLUS
Group: Monitoring
License: GPL
Version: %{V_nagios}
Release: 20100416
# package options
%option with_perl yes
%option with_fsl yes
# list of sources
Source0: http://switch.dl.sourceforge.net/sourceforge/nagios/nagios-%{V_nagios}.tar.gz
Source1: http://switch.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-%{V_nagios_plugins}.tar.gz
Source2: http://www.cpan.org/authors/id/T/TO/TONVOON/Nagios-Plugin-%{V_perl_nagios_plugin}.tar.gz
Source3: http://www.cpan.org/authors/id/T/TO/TOBEYA/Nagios-Object-%{V_perl_nagios_object}.tar.gz
Source4: http://www.cpan.org/authors/id/T/TO/TOBEYA/Nagios-Cmd-%{V_perl_nagios_cmd}.tar.gz
Source5: nagios.txt
Source6: rc.nagios
Source7: fsl.nagios
Patch0: nagios.patch
Patch1: nagios-plugins.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20100101, gcc
PreReq: OpenPKG, openpkg >= 20100101, apache, MTA
%if "%{with_perl}" == "yes"
BuildPreReq: perl-openpkg
BuildPreReq: perl, perl-net, perl-util
PreReq: perl, perl-net, perl-util
%endif
BuildPreReq: zlib, jpeg, png, gd
PreReq: zlib, jpeg, png, gd
BuildPreReq: traceroute, openssl, openssh, coreutils, fping, nail, snmp
PreReq: traceroute, openssl, openssh, coreutils, fping, nail, snmp
%if "%{with_fsl}" == "yes"
BuildPreReq: fsl
PreReq: fsl
%endif
%description
Nagios is a system and network monitoring application. It watches
hosts and services that you specify, alerting you when things go bad
and when they get better.
%track
prog nagios = {
version = %{V_nagios}
url = http://sourceforge.net/projects/nagios/files/
regex = nagios-(\d+(\.\d+)+)\.tar\.gz
}
prog nagios:plugins = {
version = %{V_nagios_plugins}
url = http://sourceforge.net/projects/nagiosplug/files/
regex = nagios-plugins-(\d+(\.\d+)+)\.tar\.gz
}
prog nagios:Nagios-Plugin = {
version = %{V_perl_nagios_plugin}
url = http://www.cpan.org/authors/id/T/TO/TONVOON/
regex = Nagios-Plugin-(__VER__)\.tar\.gz
}
prog nagios:Nagios-Object = {
version = %{V_perl_nagios_object}
url = http://www.cpan.org/authors/id/T/TO/TOBEYA/
regex = Nagios-Object-(__VER__)\.tar\.gz
}
prog nagios:Nagios-Cmd = {
version = %{V_perl_nagios_cmd}
url = http://www.cpan.org/authors/id/T/TO/TOBEYA/
regex = Nagios-Cmd-(__VER__)\.tar\.gz
}
%prep
%setup -q
%setup -q -T -D -a 1
%setup -q -T -D -a 2
%setup -q -T -D -a 3
%setup -q -T -D -a 4
%patch -p0
%patch -p0 -P 1
%{l_shtool} subst \
-e 's;/usr/local/nagios/var/;%{l_prefix}/var/nagios/log;' \
p1.pl
%build
# configure and build Nagios
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
LIBS="%{l_fsl_libs} -lpng -lz -ljpeg" \
PATH_TO_TRACEROUTE="%{l_prefix}/sbin/traceroute" \
./configure \
--prefix=%{l_prefix} \
--sbindir=%{l_prefix}/cgi/nagios \
--sysconfdir=%{l_prefix}/etc/nagios \
--libexecdir=%{l_prefix}/libexec/nagios \
--localstatedir=%{l_prefix}/var/nagios \
--datadir=%{l_prefix}/share/nagios \
--with-cgiurl=/nagios/cgi \
--with-htmurl=/nagios \
--with-nagios-user=%{l_rusr} \
--with-nagios-group=%{l_rgrp} \
--with-command-user=%{l_nusr} \
--with-command-group=%{l_ngrp} \
--with-gd-lib=%{l_prefix}/lib \
--with-gd-inc=%{l_prefix}/include \
--with-lockfile=%{l_prefix}/var/nagios/run/nagios.pid \
%if "%{with_perl}" == "yes"
--enable-embedded-perl \
--with-perlcache \
%endif
--without-init-dir
%{l_make} %{l_mflags} all
# configure and build Nagios plugins
( cd nagios-plugins-%{V_nagios_plugins}/
( echo "ac_cv_ping_packets_first=yes"
echo "ac_cv_ping_has_timeout=no"
) >config.cache
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
LIBS="-lssl -lcrypto" \
./configure \
--cache-file=./config.cache \
--prefix=%{l_prefix}/libexec/nagios \
--libexecdir=%{l_prefix}/libexec/nagios \
--with-cgiurl=/nagios/cgi \
--with-openssl=%{l_prefix} \
--with-perl=%{l_prefix}/bin/perl \
--with-df-command="%{l_prefix}/bin/gdf" \
--with-fping-command=%{l_prefix}/sbin/fping \
--with-ping-command="%{l_prefix}/bin/gping -n -c %d %s" \
--with-ssh-command="%{l_prefix}/bin/ssh" \
--with-snmpget-command="%{l_prefix}/bin/snmpget" \
--with-snmpgetnext-command="%{l_prefix}/bin/snmpgetnext"
%{l_make} %{l_mflags}
) || exit $?
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/nagios \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/libexec/nagios \
$RPM_BUILD_ROOT%{l_prefix}/var/nagios/log \
$RPM_BUILD_ROOT%{l_prefix}/var/nagios/run \
$RPM_BUILD_ROOT%{l_prefix}/var/nagios/cmd
# install Nagios
%{l_make} install DESTDIR="$RPM_BUILD_ROOT" INSTALL_OPTS="" COMMAND_OPTS=""
# install Nagios plugins
( cd nagios-plugins-%{V_nagios_plugins}/
%{l_make} install DESTDIR="$RPM_BUILD_ROOT" \
MKINSTALLDIRS="%{l_shtool} install -d"
%{l_make} install-root DESTDIR="$RPM_BUILD_ROOT" \
MKINSTALLDIRS="%{l_shtool} install -d"
) || exit $?
%if "%{with_perl}" == "yes"
# install Perl modules
%{l_prefix}/bin/perl-openpkg prepare
%{l_prefix}/bin/perl-openpkg -d Nagios-Plugin-%{V_perl_nagios_plugin} configure build install
%{l_prefix}/bin/perl-openpkg -d Nagios-Object-%{V_perl_nagios_object} configure build install
%{l_prefix}/bin/perl-openpkg -d Nagios-Cmd-%{V_perl_nagios_cmd} configure build install
%{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
%else
>perl-openpkg-files
%endif
# post-adjust installation
%if "%{with_perl}" == "yes"
mv $RPM_BUILD_ROOT%{l_prefix}/bin/p1.pl \
$RPM_BUILD_ROOT%{l_prefix}/libexec/nagios/p1.pl
%endif
chmod 0755 $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios/utils.sh
rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/nagios/archives
rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios/share
strip $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios/* 2>/dev/null || true
# install default configuration
for name in `grep "^<file" %{SOURCE nagios.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
(echo ""; cat %{SOURCE nagios.txt}; echo "") |\
sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
%{l_shtool} install -c -m 644 %{l_value -s -a} \
$name $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
done
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.nagios} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# install OSSP fsl configuration
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE fsl.nagios} \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} `cat perl-openpkg-files` \
'%config %{l_prefix}/etc/fsl/fsl.nagios' \
'%config %{l_prefix}/etc/nagios/*' \
'%config %attr(600,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/nagios/resource.cfg' \
'%attr(555,%{l_musr},%{l_mgrp}) %{l_prefix}/bin/nagios*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nagios/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/nagios/*/*' \
'%attr(2775,%{l_rusr},%{l_ngrp}) %{l_prefix}/var/nagios/cmd' \
'%attr(-,%{l_susr},%{l_sgrp}) %{l_prefix}/libexec/nagios/pst3' \
'%attr(-,%{l_susr},%{l_sgrp}) %{l_prefix}/libexec/nagios/check_icmp' \
'%attr(-,%{l_susr},%{l_sgrp}) %{l_prefix}/libexec/nagios/check_dhcp'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# add hook to Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
( echo "Include $RPM_INSTALL_PREFIX/etc/nagios/apache.conf"
) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-a -i "$RPM_INSTALL_PREFIX:nagios" $apacheconf
fi
# display final hints on initial installation
( echo "To complete this installation of Nagios please start the"
echo "Nagios daemon (backend) Apache webserver (frontend) with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc nagios start"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc apache start"
echo "After this you can connect to the Nagios frontend via URL"
echo " http://127.0.0.1/nagios/"
echo "and login with username \"nagios\" and password \"nagios\"."
echo "You can change the password with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/htpasswd \\ "
echo " $RPM_INSTALL_PREFIX/etc/nagios/apache.passwd nagios"
) | %{l_rpmtool} msg -b -t notice
fi
if [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} nagios status 2>/dev/null`
[ ".$nagios_active" = .yes ] && %{l_rc} nagios restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# remove hook from Apache configuration
apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
if [ -f $apacheconf ]; then
$RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
-r -i "$RPM_INSTALL_PREFIX:nagios" $apacheconf
fi
# before erase, stop service and remove log files
%{l_rc} nagios stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/nagios/log/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/nagios/run/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/nagios/cmd/* >/dev/null 2>&1 || true
fi
exit 0
--- nagios-plugins-1.4.14/configure.orig Tue Apr 20 10:00:39 2010
+++ nagios-plugins-1.4.14/configure Tue Apr 20 11:22:12 2010
@@ -22718,8 +22718,8 @@
fi
if test "$ac_cv_lib_ldap_main" = "yes"; then
- LDAPLIBS="-lldap -llber"\
- LDAPINCLUDE="-I/usr/include/ldap"
+ LDAPLIBS="-lldap -llber -lssl -lcrypto"
+ LDAPINCLUDE="-I$prefix/include"
@@ -25942,7 +25942,7 @@
ac_cv_ps_cols=9
{ echo "$as_me:$LINENO: result: using nagios-plugins internal ps command (pst3) for solaris" >&5
echo "${ECHO_T}using nagios-plugins internal ps command (pst3) for solaris" >&6; }
- if test `isainfo -b` = 64 ; then
+ if test `isainfo -b` = 64 && test `uname` != "SunOS" ; then
PST3CFLAGS="-m64"
{ echo "$as_me:$LINENO: using 64bit pst3" >&5
@@ -26302,17 +26302,10 @@
{ echo "$as_me:$LINENO: checking for ICMP ping syntax" >&5
echo $ECHO_N "checking for ICMP ping syntax... $ECHO_C" >&6; }
-ac_cv_ping_packets_first=no
-ac_cv_ping_has_timeout=no
if test -n "$with_ping_command"
then
{ echo "$as_me:$LINENO: result: (command-line) $with_ping_command" >&5
echo "${ECHO_T}(command-line) $with_ping_command" >&6; }
- if test -n "$ac_cv_ping_packets_first"
- then
- ac_cv_ping_packets_first=yes
- ac_cv_ping_has_timeout=yes
- fi
elif [ "z$ac_cv_uname_s" = "zUnixWare" ] && \
$PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \