[Nagiosplug-help] NagiosGrapher chroot

ad at heapoverflow.com ad at heapoverflow.com
Mon Dec 17 15:35:16 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
hello everyone,

I'm running Nagios 3.0b7  in a lighttpd chroot environment, all is
running fine but I'm in front of a problem since yesterday for
chrooting the NagiosGrapher addon in it.
Yet NagiosGrapher installed in my chroot, script and the web interface
is running perfectly, rrdtool so , but I just have a problem to
display annotated fonts to my graphs, this behaviour doesnt happen if
I call it from outside the chroot, but from inside (and so on lighttpd
server) I fall in front of a behaviour just before loading the final
PNG because looks like the Magick annotate function needs something I
havent imported within my chroot yet.
Look at strace:

**********************************
times({tms_utime=10, tms_stime=2, tms_cutime=13, tms_cstime=2}) = 18522148
times({tms_utime=10, tms_stime=2, tms_cutime=13, tms_cstime=2}) = 18522148
brk(0x84b4000)                          = 0x84b4000
mmap2(NULL, 1809600, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS,
- -1, 0) = 0xb740b000
brk(0x84ac000)                          = 0x84ac000
brk(0x84a8000)                          = 0x84a8000
brk(0x84a5000)                          = 0x84a5000
munmap(0xb740b000, 1809600)             = 0
brk(0x84a2000)                          = 0x84a2000
brk(0x849e000)                          = 0x849e000
brk(0x849a000)                          = 0x849a000
write(2, "Can\'t call method \"Annotate\" on "..., 97Can't call method
"Annotate" on an undefined value at /etc/nagios/sbin/rrd2-system.cgi
line 105.
**********************************


At this point it spawn a Can't call method Annotate wich is linked to
ImageMagick libs, I have tested also outside the chroot with strace to
check what it is loading after


**********************************
times({tms_utime=13, tms_stime=3, tms_cutime=25, tms_cstime=2}) = 18505820
times({tms_utime=13, tms_stime=3, tms_cutime=25, tms_cstime=2}) = 18505820
brk(0x8509000)                          = 0x8509000
mmap2(NULL, 1926528, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS,
- -1, 0) = 0xb7245000
brk(0x8501000)                          = 0x8501000
brk(0x84fc000)                          = 0x84fc000
brk(0x84f9000)                          = 0x84f9000
open("/usr/lib/ImageMagick-6.2.8/config/colors.xml",
O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 0, [63539], SEEK_END)        = 0
mmap2(NULL, 63539, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7235000
munmap(0xb7235000, 63539)               = 0
close(3)                                = 0
open("/usr/share/ImageMagick-6.2.8/config/colors.xml",
O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 0, [63539], SEEK_END)        = 0
mmap2(NULL, 63539, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7235000
munmap(0xb7235000, 63539)               = 0
close(3)                                = 0
open("/usr/share/doc/ImageMagick-6.2.8/colors.xml",
O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/share/ImageMagick-6.2.8/colors.xml", O_RDONLY|O_LARGEFILE)
= -1 ENOENT (No such file or directory)
open("/root/.magick/colors.xml", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
such file or directory)
open("colors.xml", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
brk(0x8529000)                          = 0x8529000
brk(0x854a000)                          = 0x854a000
stat64("/usr/share/fonts/default/TrueType/arial.ttf",
{st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
access("/usr/share/fonts/default/TrueType/arial.ttf", F_OK) = 0
open("/usr/share/fonts/default/TrueType/arial.ttf", O_RDONLY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
mmap2(NULL, 367112, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb71eb000
close(3)                                = 0
munmap(0xb71eb000, 367112)              = 0
stat64("/usr/share/fonts/default/TrueType/arial.ttf",
{st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
access("/usr/share/fonts/default/TrueType/arial.ttf", F_OK) = 0
open("/usr/share/fonts/default/TrueType/arial.ttf", O_RDONLY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
mmap2(NULL, 367112, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb71eb000
close(3)                                = 0
munmap(0xb71eb000, 367112)              = 0
gettimeofday({1197902602, 138847}, NULL) = 0
stat64("/usr/share/fonts/default/TrueType/arial.ttf",
{st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
access("/usr/share/fonts/default/TrueType/arial.ttf", F_OK) = 0
open("/usr/share/fonts/default/TrueType/arial.ttf", O_RDONLY) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
mmap2(NULL, 367112, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb71eb000
close(3)                                = 0
munmap(0xb71eb000, 367112)              = 0
stat64("/usr/share/fonts/default/TrueType/arial.ttf",
{st_mode=S_IFREG|0644, st_size=367112, ...}) = 0
access("/usr/share/fonts/default/TrueType/arial.ttf", F_OK) = 0
**********************************

I have double checked my chroot to make sure having Magick libs &
fonts imported:

/usr/bin/
Magick++-config  Magick-config  Wand-config  animate  compare
composite  conjure  convert  display  identify  import  mogrify
montage  stream
/usr/lib/ImageMagick
/usr/share/ImageMagick
/usr/share/fonts
/usr/share/X11/fonts
/etc/fonts/
/var/cache/
/usr/lib/perl5/

font_file /usr/share/fonts/default/TrueType/arial.ttf (ngraph.cfg)

The problematic code is:

if ($image_format eq 'PNG' && $code == 0 && !$only_graph && !$no_legend) {
    $ng->time_need(type => 'start');
    # Adding brand
    my  $image = Image::Magick->new(magick => 'png');
        $image->BlobToImage($image_bin);
        $image->[0]->Annotate(

I have tested to change !$only_graph in $only_graph for example to
check what's happening if I bypass this function and now graph are
displayed properly within my chroot but without annotation (wich is
normal because I previously disabled it)


So because its working outside my chroot and not inside, any idea what
is missing to import ? I have checked also the strace debug from the
start to this behaviour and nothing is missing, Im really lost , must
be a bin, or something related to Magick or fonts nor permissions ,
any help is appreciated.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
 
iD8DBQFHZpczdS4H/t4eKFARAqLKAKCLTApCe4X8CrVJG95JB3gMcCIV0gCcCf7a
zvV1Drh33bzczXzdZA3SMe4=
=gCA4
-----END PGP SIGNATURE-----





More information about the Nagiosplugin-help mailing list