[hobbit] bb-larrdcolumn and NetBSD

Emmanuel Dreyfus manu at netbsd.org
Tue Jan 18 14:41:10 CET 2005


On Mon, Jan 17, 2005 at 05:50:44PM +0100, Henrik Stoerner wrote:
> Essentially, you should never run ANY of the Hobbit tools without
> setting up the environment variables defined in hobbitserver.cfg;
> hobbitlaunch does that for you, or you can run COMMAND as
> 
>   bbcmd --env=/usr/local/hobbit/server/etc/hobbitserver.cfg COMMAND

It gets a SIGSEGV if ran that way.
A kernel trace shows that environement looks correctly set

 17269 bbcmd    ENV   "_=/usr/bin/ktrace"
 17269 bbcmd    ENV   "PAGER=less"
 17269 bbcmd    ENV   "MANPATH=/usr/share/man:/usr/local/man:/usr/pkg/man"
 17269 bbcmd    ENV   "PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/\
        local/sbin:/usr/pkg/hobbit/server/bin"
 17269 bbcmd    ENV   "EDITOR=vi"
 17269 bbcmd    ENV   "SHELL=/bin/ksh"
 17269 bbcmd    ENV   "BLOCKSIZE=1k"
 17269 bbcmd    ENV   "BBHOSTS=/usr/pkg/hobbit/server/etc/bb-hosts"
 17269 bbcmd    ENV   "BBVAR=/usr/pkg/hobbit/data"
 17269 bbcmd    ENV   "SU_FROM=manu"
 17269 bbcmd    ENV   "USER=root"
 17269 bbcmd    ENV   "LESSCHARSET=latin1"
 17269 bbcmd    ENV   "HOME=/root"
 17269 bbcmd    ENV   "TERM=xterm"
 17269 bbcmd    ENV   "EXINIT=set autoindent"
 17269 bbcmd    ENV   "BBSERVERROOT=/usr/pkg/hobbit"
 17269 bbcmd    ENV   "BBSERVERLOGS=/var/log/hobbit"
 17269 bbcmd    ENV   "BBSERVERHOSTNAME=a.

lan"
 17269 bbcmd    ENV   "BBSERVERIP=192.0.2.26"
 17269 bbcmd    ENV   "BBSERVEROS=netbsd"
 17269 bbcmd    ENV   "BBSERVERWWWNAME=plan"
 17269 bbcmd    ENV   "BBSERVERWWWURL=/hobbit"
 17269 bbcmd    ENV   "BBSERVERCGIURL=/cgi-bin"
 17269 bbcmd    ENV   "BBPORT=1984"
 17269 bbcmd    ENV   "BBDISP=192.0.2.26"
 17269 bbcmd    ENV   "BBDISPLAYS="
 17269 bbcmd    ENV   "BBPAGE=192.0.2.26"
 17269 bbcmd    ENV   "BBPAGERS="
 17269 bbcmd    ENV   "FQDN=TRUE"
 17269 bbcmd    ENV   "USEHOBBITD=TRUE"
 17269 bbcmd    ENV   "DOCOMBO=TRUE"
 17269 bbcmd    ENV   "PAGELEVELS=red yellow purple"
 17269 bbcmd    ENV   "PURPLEDELAY=30"
 17269 bbcmd    ENV   "BBLOGSTATUS=DYNAMIC"
 17269 bbcmd    ENV   "BBOSTYPE=netbsd"
 17269 bbcmd    ENV   "MACHINEDOTS=plan"
 17269 bbcmd    ENV   "MACHINEADDR=192.0.2.26"
 17269 bbcmd    ENV   "BBWEBHOST=http://plan"
 17269 bbcmd    ENV   "BBWEBHOSTURL=http://plan/hobbit"
 17269 bbcmd    ENV   "BBWEBHTMLLOGS=http://plan/hobbit/html"
 17269 bbcmd    ENV   "BBWEB=/hobbit"
 17269 bbcmd    ENV   "BBSKIN=/hobbit/gifs"
 17269 bbcmd    ENV   "BBREPURL=/hobbit/rep"
 17269 bbcmd    ENV   "BBWAP=/hobbit/wml"
 17269 bbcmd    ENV   "CGIBINURL=/cgi-bin"
 17269 bbcmd    ENV   "BBHOME=/usr/pkg/hobbit/server"
 17269 bbcmd    ENV   "BBTMP=/usr/pkg/hobbit/server/tmp"
 17269 bbcmd    ENV   "BB=/usr/pkg/hobbit/server/bin/bb"
 17269 bbcmd    ENV   "BBACKS=/usr/pkg/hobbit/data/acks"
 17269 bbcmd    ENV   "BBDATA=/usr/pkg/hobbit/data/data"
 17269 bbcmd    ENV   "BBDISABLED=/usr/pkg/hobbit/data/disabled"
 17269 bbcmd    ENV   "BBHIST=/usr/pkg/hobbit/data/hist"
 17269 bbcmd    ENV   "BBHISTLOGS=/usr/pkg/hobbit/data/histlogs"
 17269 bbcmd    ENV   "BBLOGS=/usr/pkg/hobbit/data/logs"
 17269 bbcmd    ENV   "BBWWW=/usr/pkg/hobbit/server/www"
 17269 bbcmd    ENV   "BBHTML=/usr/pkg/hobbit/server/www/html"
 17269 bbcmd    ENV   "BBNOTES=/usr/pkg/hobbit/server/www/notes"
 17269 bbcmd    ENV   "BBREP=/usr/pkg/hobbit/server/www/rep"
 17269 bbcmd    ENV   "RECVFROMMSG=Status message received from"
 17269 bbcmd    ENV   "STATUNCHMSG=Status unchanged in"
 17269 bbcmd    ENV   "BBALLHISTLOG=TRUE"
 17269 bbcmd    ENV   "BBHOSTHISTLOG=TRUE"
 17269 bbcmd    ENV   "SAVESTATUSLOG=TRUE"
 17269 bbcmd    ENV   "MAILC=mail"
 17269 bbcmd    ENV   "MAIL=mail -s"
 17269 bbcmd    ENV   "SVCCODES=disk:100,cpu:200,procs:300,svcs:350,msgs:400,c\
        onn:500,http:600,dns:800,smtp:725,telnet:723,ftp:721,pop:810,pop3:810,\
        pop-3:810,ssh:722,imap:843,ssh1:722,ssh2:722,imap2:843,imap3:843,imap4\
        :843,pop2:809,pop-2:809,nntp:819,test:901"
 17269 bbcmd    ENV   "CONNTEST=TRUE"
 17269 bbcmd    ENV   "IPTEST_2_CLEAR_ON_FAILED_CONN=TRUE"
 17269 bbcmd    ENV   "NONETPAGE="
 17269 bbcmd    ENV   "FPING=/usr/pkg/sbin/fping"
 17269 bbcmd    ENV   "NTPDATE=ntpdate"
 17269 bbcmd    ENV   "BBROUTERTEXT=router"
 17269 bbcmd    ENV   "BBRRDS=/usr/pkg/hobbit/data/rrd"
 17269 bbcmd    ENV   "LARRDS=cpu=la,disk,memory,conn=tcp,fping=tcp,ftp=tcp,ft\
        ps=tcp,ssh=tcp,ssh1=tcp,ssh2=tcp,telnet=tcp,telnets=tcp,smtp=tcp,smtps\
        =tcp,pop-2=tcp,pop2=tcp,pop-3=tcp,pop3=tcp,pop=tcp,pop3s=tcp,imap=tcp,\
        imap2=tcp,imap3=tcp,imap4=tcp,imaps=tcp,nntp=tcp,nntps=tcp,ldap=tcp,ld\
        aps=tcp,rsync=tcp,bbd=tcp,clamd=tcp,oratns=tcp,qmtp=tcp,qmqp=tcp,http=\
        tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apa\
        che,bind,sendmail,nmailq,socks,bea,citrix,bbgen,bbtest,bbproxy,hobbitd"
 17269 bbcmd    ENV   "GRAPHS=la,disk:disk_part:5,memory,users,vmstat,iostat,t\
        cp.http,tcp,netstat,temperature,ntpstat,apache,bind,sendmail,nmailq,so\
        cks,bea,citrix,bbgen,bbtest,bbproxy,hobbitd"
 17269 bbcmd    ENV   "SUMMARY_SET_BKG=FALSE"
 17269 bbcmd    ENV   "BBMKBB2EXT=eventlog.sh acklog.sh"
 17269 bbcmd    ENV   "BBREL=Hobbit"
 17269 bbcmd    ENV   "BBRELDATE="
 17269 bbcmd    ENV   "DOTHEIGHT=16"
 17269 bbcmd    ENV   "DOTWIDTH=16"
 17269 bbcmd    ENV   "COLUMNDOCURL=/cgi-bin/hobbitcolumn.sh?%s"
 17269 bbcmd    ENV   "MKBBLOCAL=<B><I>Pages Hosted Locally</I></B>"
 17269 bbcmd    ENV   "MKBBREMOTE=<B><I>Remote Status Display</I></B>"
 17269 bbcmd    ENV   "MKBBSUBLOCAL=<B><I>Subpages Hosted Locally</I></B>"
 17269 bbcmd    ENV   "MKBBACKFONT=COLOR=silver SIZE=\"-1\""
 17269 bbcmd    ENV   "MKBBCOLFONT=COLOR=\"#87a9e5\" SIZE=\"-1\""
 17269 bbcmd    ENV   "MKBBROWFONT=SIZE=\"+1\" COLOR=\"#FFFFCC\" FACE=\"Tahoma\
        , Arial, Helvetica\""
 17269 bbcmd    ENV   "MKBBTITLE=COLOR=ivory SIZE=\"+1\""
 17269 bbcmd    ENV   "BBDATEFORMAT=%a %b %d %H:%M:%S %Y"
 17269 bbcmd    ENV   "BBRSSTITLE=Big Brother Alerts"
 17269 bbcmd    ENV   "WMLMAXCHARS=1500"
 17269 bbcmd    ENV   "WML_OUTPUT=FALSE"
 17269 bbcmd    ENV   "BBREPWARN=97"
 17269 bbcmd    ENV   "BBHISTEXT="
 17269 bbcmd    ENV   "HOBBITDREL=4.0-beta4"
 17269 bbcmd    ENV   "MACHINE=plan"
 17269 bb-larrdcolumn EMUL  "netbsd"
 17269 bb-larrdcolumn RET   execve JUSTRETURN

If I set this environement, nd run bb-larrdcolumn inside gdb:

Program received signal SIGSEGV, Segmentation fault.
generate_larrd (rrddirname=0x807e040 "/usr/pkg/hobbit/data/rrd", 
    larrdcolumn=0x8051c47 "trends", larrd043=1, hobbitd=1)
    at bb-larrdcolumn.c:337
337                     while (graph->larrdrrdname) {
(gdb) bt
#0  generate_larrd (rrddirname=0x807e040 "/usr/pkg/hobbit/data/rrd", 
    larrdcolumn=0x8051c47 "trends", larrd043=1, hobbitd=1)
    at bb-larrdcolumn.c:337
#1  0x0804a19b in main (argc=1, argv=0xbfbfe138) at bb-larrdcolumn.c:442
#2  0x080494c2 in ___start ()
(gdb) print graph
$1 = (larrdgraph_t *) 0x481085e0
(gdb) print *graph
$2 = {
  larrdrrdname = 0x99990009 <Error reading address 0x99990009: Invalid argument>, larrdpartname = 0x0, maxgraphs = 0}

A deeper inspection shows that graph is never valid (we don't loop before
the crash). It is initialized as
336:		graph = larrdgraphs

And larrdgraphs seems only touched by larrd_setup(). Setting a few 
breakpoints show that I get the SIGSEGV without ever getting into 
larrd_setup().

Does this ring a bell?

-- 
Emmanuel Dreyfus
manu at netbsd.org



More information about the Xymon mailing list