The polite way to use gdb on Nagios.

Dan Stromberg strombrg at dcs.nac.uci.edu
Fri Jan 16 15:52:24 CET 2004


On Thu, 2004-01-15 at 21:02, Stanley Hopcroft wrote:
> Dear Ladies and Gentlemen,
> 
> 
> <Off topic>
> 
> Please would some helpful person share some clues about the use of gdb 
> with Nagios ?
> 
> I would like to examine code in base/checks.c that is run by child 
> processes.
> 
> Even with 'follow-fork-mode' set (to either child or parent), the only 
> code that gdb wants to know about is that run by the parent.
> 
> Set the pid to 0 ?
> 
> The gdb tutorials I have found don't seem helpful.
> 
> Are the debugging #ifdefs/configure --DEBUGn the only way ?
> 
> </Off topic>
> 
> Thank you,
> 
> Yours sincerely.

Hm.  Not sure about convincing gdb to follow forks, but what if you make
a shell wrapper for the process you want to monitor?  Like say you want
to monitor foo.  Then mv foo to foo.bin, and create a "foo" shell script
that gdb's foo.bin.  You may have to redirect all I/O from and to a
tty.  You for this you can:

1) Start an xterm (or rxvt, or gnome-terminal, or konsole or whatever)
2) Inside that xterm, say "tty".  For the sake of discussion, say the
output is "/dev/tty06".
3) Then in foo, use "gdb /path/to/foo.bin > /dev/tty06 2>&1 <
/dev/tty06"

...or something like that.  :)

I wouldn't be terribly surprised if using gdb this way makes nagios
trigger a timeout somewhere though.

-- 
Dan Stromberg DCS/NACS/UCI <strombrg at dcs.nac.uci.edu>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040116/4ad73a0a/attachment.sig>


More information about the Users mailing list