Trends / Alert Histogram are not working properly

Hello,

I’m getting the following error in http error log:
[Tue May 26 15:39:03 2009] [error] [client 172.31.1.28] /usr/local/nagios/sbin /trends.cgi : symbol lookup error: /usr/local/nagios/sbin /trends.cgi : undefined symbol: gdImageCreateFromPng, referer: nagios.services.net/nagios/cgi-b … acktrack=4
[Tue May 26 15:39:03 2009] [error] [client 172.31.1.28] Premature end of script headers: trends.cgi, referer: nagios.services.net/nagios/cgi-b … acktrack=4

I checked the following:
ldd trends.cgi
linux-gate.so.1 => (0x00ee4000)
libgd.so.2 => /usr/local/lib /libgd.so.2 (0x00110000)
libpng12.so.0 => /usr/lib /libpng12.so.0 (0x00568000)
libjpeg.so.62 => /usr/lib /libjpeg.so.62 (0x04f3b000)
libz.so.1 => /usr/lib /libz.so.1 (0x00b2c000)
libm.so.6 => /lib /libm.so.6 (0x00a88000)
libglib-2.0.so.0 => /lib /libglib-2.0.so.0 (0x00b80000)
libc.so.6 => /lib /libc.so.6 (0x00924000)
/lib /ld-linux.so.2 (0x00901000)
librt.so.1 => /lib /librt.so.1 (0x00b41000)
libpthread.so.0 => /lib /libpthread.so.0 (0x00a6f000)

Nagios version: 3.0.1
OS: CentOS release 5.2 (Final)

Anyone ideas ?

Thanks,

Dirk

Are the gd libraries correctly installed?
does the map work in nagios?

[nagios@nagios project]$/usr/bin/gdlib-config --all
GD library 2.0.33
includedir: /usr/include
cflags: -I/usr/include
ldflags: -L/usr/lib
libs: -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12 -lz -lm
libdir: /usr/lib
features: GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE GD_PNG GD_GIF

[nagios@nagios project]$rpm -qav|grep gd
sysklogd-1.4.1-44.el5
php-gd-5.1.6-20.el5
gdbm-1.8.0-26.2.1
graphviz-gd-2.22.2-1.el5
gd-2.0.33-9.4.el5_1.1
gd-devel-2.0.33-9.4.el5_1.1

It looks like that the gd libraries are correctly installed.
The map also don’t work, same http error

What do you mean with switching off and on ?

[quote=“dirk385”][nagios@nagios project]$/usr/bin/gdlib-config --all
GD library 2.0.33
includedir: /usr/include
cflags: -I/usr/include
ldflags: -L/usr/lib
libs: -lXpm -lX11 -ljpeg -lfontconfig -lfreetype -lpng12 -lz -lm
libdir: /usr/lib
features: GD_XPM GD_JPEG GD_FONTCONFIG GD_FREETYPE GD_PNG GD_GIF

[nagios@nagios project]$rpm -qav|grep gd
sysklogd-1.4.1-44.el5
php-gd-5.1.6-20.el5
gdbm-1.8.0-26.2.1
graphviz-gd-2.22.2-1.el5
gd-2.0.33-9.4.el5_1.1
gd-devel-2.0.33-9.4.el5_1.1

It looks like that the gd libraries are correctly installed.
The map also don’t work, same http error
[/quote]

What does the nagios configure output say in regards to GD?

[quote]
What do you mean with switching off and on ?[/quote]

forget it… it’ my signature :mrgreen:

See also the attachment config.doc (first topic of the thread)

checking for a BSD-compatible install… /usr/bin/install -c
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking for gcc… gcc
checking for C compiler default output file name… 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 whether make sets $(MAKE)… yes
checking for strip… /usr/bin/strip
checking how to run the C preprocessor… gcc -E
checking for egrep… grep -E
checking for ANSI C header files… yes
checking whether time.h and sys/time.h may both be included… yes
checking for sys/wait.h that is POSIX.1 compatible… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking arpa/inet.h usability… yes
checking arpa/inet.h presence… yes
checking for arpa/inet.h… yes
checking ctype.h usability… yes
checking ctype.h presence… yes
checking for ctype.h… yes
checking dirent.h usability… yes
checking dirent.h presence… yes
checking for dirent.h… yes
checking errno.h usability… yes
checking errno.h presence… yes
checking for errno.h… yes
checking fcntl.h usability… yes
checking fcntl.h presence… yes
checking for fcntl.h… yes
checking getopt.h usability… yes
checking getopt.h presence… yes
checking for getopt.h… yes
checking grp.h usability… yes
checking grp.h presence… yes
checking for grp.h… yes
checking libgen.h usability… yes
checking libgen.h presence… yes
checking for libgen.h… yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking math.h usability… yes
checking math.h presence… yes
checking for math.h… yes
checking netdb.h usability… yes
checking netdb.h presence… yes
checking for netdb.h… yes
checking netinet/in.h usability… yes
checking netinet/in.h presence… yes
checking for netinet/in.h… yes
checking pthread.h usability… yes
checking pthread.h presence… yes
checking for pthread.h… yes
checking pthreads.h usability… no
checking pthreads.h presence… no
checking for pthreads.h… no
checking pwd.h usability… yes
checking pwd.h presence… yes
checking for pwd.h… yes
checking regex.h usability… yes
checking regex.h presence… yes
checking for regex.h… yes
checking signal.h usability… yes
checking signal.h presence… yes
checking for signal.h… yes
checking socket.h usability… no
checking socket.h presence… no
checking for socket.h… no
checking stdarg.h usability… yes
checking stdarg.h presence… yes
checking for stdarg.h… yes
checking for string.h… (cached) yes
checking for strings.h… (cached) yes
checking sys/mman.h usability… yes
checking sys/mman.h presence… yes
checking for sys/mman.h… yes
checking for sys/types.h… (cached) yes
checking sys/time.h usability… yes
checking sys/time.h presence… yes
checking for sys/time.h… yes
checking sys/resource.h usability… yes
checking sys/resource.h presence… yes
checking for sys/resource.h… yes
checking for sys/wait.h… (cached) yes
checking sys/socket.h usability… yes
checking sys/socket.h presence… yes
checking for sys/socket.h… yes
checking for sys/stat.h… (cached) yes
checking sys/timeb.h usability… yes
checking sys/timeb.h presence… yes
checking for sys/timeb.h… yes
checking sys/un.h usability… yes
checking sys/un.h presence… yes
checking for sys/un.h… yes
checking sys/ipc.h usability… yes
checking sys/ipc.h presence… yes
checking for sys/ipc.h… yes
checking sys/msg.h usability… yes
checking sys/msg.h presence… yes
checking for sys/msg.h… yes
checking sys/poll.h usability… yes
checking sys/poll.h presence… yes
checking for sys/poll.h… yes
checking syslog.h usability… yes
checking syslog.h presence… yes
checking for syslog.h… yes
checking uio.h usability… no
checking uio.h presence… no
checking for uio.h… no
checking for unistd.h… (cached) yes
checking for an ANSI C-conforming const… yes
checking whether struct tm is in sys/time.h or time.h… time.h
checking for struct tm.tm_zone… yes
checking for mode_t… yes
checking for pid_t… yes
checking for size_t… yes
checking return type of signal handlers… void
checking for uid_t in sys/types.h… yes
checking type of array argument to getgroups… gid_t
checking for va_copy… yes
checking for vsnprintf… yes
checking for snprintf… yes
checking for asprintf… yes
checking for vasprintf… yes
checking for C99 vsnprintf… yes
checking for initgroups… yes
checking for setenv… yes
checking for strdup… yes
checking for strstr… yes
checking for strtoul… yes
checking for unsetenv… yes
checking for type of socket size… size_t
checking for pthread_create in -lcma… no
checking for pthread_create in -lpthread… yes
checking for library containing nanosleep… none required
checking for mail… /bin/mail
We’ll use default routines (in xdata/xsddefault.) for status data I/O…
We’ll use default routines (in xdata/xcddefault.
) for comment data I/O…
We’ll use default routines (in xdata/xrddefault.) for retention data I/O…
We’ll use template-based routines (in xdata/xodtemplate.
) for object data I/O…
We’ll use default routines (in xdata/xpddefault.) for performance data I/O…
We’ll use default routines (in xdata/xdddefault.
) for scheduled downtime data I/O…
checking for main in -liconv… no
checking for gdImagePng in -lgd (order 1)… no
checking for gdImagePng in -lgd (order 2)… yes
GD library was found!
checking ltdl.h usability… no
checking ltdl.h presence… no
checking for ltdl.h… no
checking dlfcn.h usability… yes
checking dlfcn.h presence… yes
checking for dlfcn.h… yes
checking for dlopen in -ldl… yes
checking for extra flags needed to export symbols… -Wl,-export-dynamic
checking for linker flags for loadable modules… -shared
checking for traceroute… /bin/traceroute
checking for type va_list… yes
checking for perl… /usr/bin/perl
configure: creating ./config.status
config.status: creating Makefile
config.status: creating subst
config.status: creating pkginfo
config.status: creating base/Makefile
config.status: creating common/Makefile
config.status: creating contrib/Makefile
config.status: creating cgi/Makefile
config.status: creating html/Makefile
config.status: creating module/Makefile
config.status: creating xdata/Makefile
config.status: creating daemon-init
config.status: creating html/index.html
config.status: creating html/side.html
config.status: creating include/config.h
config.status: include/config.h is unchanged
config.status: creating include/snprintf.h
config.status: include/snprintf.h is unchanged
config.status: creating include/cgiutils.h
config.status: include/cgiutils.h is unchanged

Creating sample config files in sample-config/ …

*** Configuration summary for nagios 3.0.1 04-01-2008 ***:

General Options:

    Nagios executable:  nagios
    Nagios user/group:  nagios,nagios
   Command user/group:  nagios,nagcmd
        Embedded Perl:  no
         Event Broker:  yes
    Install ${prefix}:  /usr/local/nagios
            Lock file:  ${prefix}/var/nagios.lock

Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu

Web Interface Options:

             HTML URL:  [localhost/nagios/](http://localhost/nagios/)
              CGI URL:  [localhost/nagios/cgi-bin/](http://localhost/nagios/cgi-bin/)

Traceroute (used by WAP): /bin/traceroute

Review the options above for accuracy. If they look okay,
type ‘make all’ to compile the main program and CGIs.

No ideas, but it’s worth trying to upgrade to 3.0.6 even if the changelog doesn’t report anything for the GD libs or map…

Solved, the issue had to do with the fact that the gd libs were installed as rpm and as source.
I removed the source libs
libgd.a
libgd.so
gd.h

Compiled Nagios again and that did the trick.

Luca, thanks for you input.

Happy it’s fixed, thanks to you for sharing the problem and solution :slight_smile: