[bug?] Crash of hobbitsvc.cgi on trends column display
list Charles Goyard
Hi Henrik, Yesterday I upgraded my hobbit server to take advantage of the all-in-one corrections, plus the "split-ncv" feature (have a peek in your spambox to see my message about this :)). I then found a bug that did not show up on the test host, so I rolled back. Since then, hobbitsvc.cgi segfaults when I click on the trends column (renamed _graphs in my setup) : http://monitor/hobbit-cgi/bb-hostsvc.sh?HOST=somehost.dom&SERVICE=_graphs Here's gdb output : #0 bbh_find_item (host=0x8088210, item=BBH_DISPLAYNAME) at loadhosts.c:160 #1 0x0804e652 in rrdlink_text (host=0x807f980, rrd=0x80881f0,wantmeta=HG_PLAIN_LINK) at hobbitsvc-trends.c:120 #2 0x0804eb99 in generate_trends (hostname=0x80769d8 "somehost.dom") at hobbitsvc-trends.c:288 #3 0x08049feb in do_request () at hobbitsvc.c:216 #4 0x0804aeb6 in main (argc=1, argv=0xbf935594) at hobbitsvc.c:518 just before the crash, I have : i=0 host->elems gives "Cannot access memory at address 0x0" item=BBH_DISPLAYNAME bbh_item_key[item]="NAME:" 160 while (host->elems[i] && strncasecmp(host->elems[i],bbh_item_key[item], strlen(bbh_item_key[item]))) i++; Can it come from a missing "something" in the configuration ? Can it crash because of corrupted rrd files ? I continue my investigations, but you sure can help :). [oh, I found another small bug, not severe at all: when running hobbitsvc.cgi from the command line, it segfaults if SCRIPT_NAME is not set. Maybe it should set SCRIPT_NAME to a sensible default or at least exit grcefully] -- Charles Goyard - user-98f9625a7a59@xymon.invalid - (+33) 1 45 38 01 31
list Gildas le Nadan
▸
[oh, I found another small bug, not severe at all: when running hobbitsvc.cgi from the command line, it segfaults if SCRIPT_NAME is not set. Maybe it should set SCRIPT_NAME to a sensible default or at least exit grcefully]
Yes, the cgis are not all checking that their environment.
I was about to provide patches so they at least call envcheck() as some
of the cgis are using it.
Something like this will do the trick for hobbigraph.c for instance
--- hobbit-4.2.0-allinone/web/hobbitgraph.c 2006-11-08
14:08:15.000000000 +0000
+++ hobbit-4.2.0-sanity/web/hobbitgraph.c 2006-11-28
15:16:10.492252944 +0000
@@ -490,6 +490,13 @@
char *okuri, *p;
int urilen;
+ /* first of all, sanity checks */
+ char *reqenv[] = {
+ "BBHOME", "BBRRDS", "SCRIPT_NAME", "RRDHEIGHT",
+ "RRDWIDTH", "HTMLCONTENTTYPE", NULL
+ };
+ envcheck(reqenv);
• graphwidth = atoi(xgetenv("RRDWIDTH"));
graphheight = atoi(xgetenv("RRDHEIGHT"));
Cheers,
Gildas
list Charles Goyard
Hi again, As an extra info, I found the reason why the program crashes : in loadhosts.c, when there : if (result || !host->defaulthost || (strcasecmp(host->bbhostname, ".default.") == 0)) return result; else return bbh_find_item(host->defaulthost, item); I get in the "else". At that point, host->defaulthost is not null, but points to garbage. I dont't get what the default host should be. (btw, thanks for the patch Gildas) -- Charles Goyard - user-98f9625a7a59@xymon.invalid - (+33) 1 45 38 01 31
list Gildas le Nadan
Ok, I went thru the /web directory and edited the cgi to add the crude environment checking I've been talking on earlier. Compiled cgis have been tested individually without parameters and in line as drop-in replacements for the existing cgi, "it works for me". This patch applies to a hobbit-4.2.0 with the all-in-one patch applied using "patch -p1 <sanity_check.patch". As always, feedback are welcome Cheers Gildas
▸
Charles Goyard wrote:Hi again, As an extra info, I found the reason why the program crashes : in loadhosts.c, when there : if (result || !host->defaulthost || (strcasecmp(host->bbhostname, ".default.") == 0)) return result; else return bbh_find_item(host->defaulthost, item); I get in the "else". At that point, host->defaulthost is not null, but points to garbage. I dont't get what the default host should be. (btw, thanks for the patch Gildas)
list Charles Goyard
Hi,
▸
Charles Goyard wrote :Hi Henrik, Yesterday I upgraded my hobbit server to take advantage of the all-in-one corrections, plus the "split-ncv" feature (have a peek in your spambox to see my message about this :)). I then found a bug that did not show up on the test host, so I rolled back. Since then, hobbitsvc.cgi segfaults when I click on the trends column (renamed _graphs in my setup) :
ok, I figured all this out... I upgraded hobbit partially in the wrong location. I had HOME for the hobbit user set to /home/hobbit/server instead of /home/hobbit, so I partially screwed up my server. Reinstalling correctly solves the problems. Now my split-ncv feature (extensively debugged on my personal box) is on my production server. I'll submit the patch next week if anything goes well. Quick question: which implementation do you prefer : SPLITNCV_sometest="data1:GAUGE...." or NCV_sometest="data1:GAUGE...." SPLITNCV="sometest,someothertest..." Kind regards, -- Charles Goyard - user-98f9625a7a59@xymon.invalid - (+33) 1 45 38 01 31
list Rob Fuller
Hi, I'm currently running Hobbit (4.2.0) and devmon (0..2) monitor a number of hosts and appliances. All is working well, however, i'd like to add the functionality of trend graphing to the data collected from devmon. I believe that hobbit wont natively generate the rrd files using the NCV directive. Is there a known work around for this. From reading through the archives I found: http://www.hobbitmon.com/hobbiton/2006/03/msg00097.html Which seems to address the problem, but no details on how. Any help appreciated. Kind regards Rob
list Torben Aagaard
Hi Rob See the mail archieves ( from Jan 23 2007 ) for the devmon-support list. The short answer is : Yes, it works. There is some quirks to the NCV parsing of the message that you should be aware of - but it works. This was also discussed last week here on the hobbit list. Enjoy /Torben
▸
On 1/29/07, Rob Fuller <user-a31aae8297f6@xymon.invalid> wrote:Hi, I'm currently running Hobbit (4.2.0) and devmon (0..2) monitor a number of hosts and appliances. All is working well, however, i'd like to add the functionality of trend graphing to the data collected from devmon. I believe that hobbit wont natively generate the rrd files using the NCV directive. Is there a known work around for this. From reading through the archives I found: http://www.hobbitmon.com/hobbiton/2006/03/msg00097.html Which seems to address the problem, but no details on how. Any help appreciated. Kind regards Rob