[Xymon] Web header corruption with cgi calls using xymonmenu.cfg and xymonpage - a workaround
Deiss, Mark
Mark.Deiss at xerox.com
Fri Jan 10 19:56:05 CET 2014
Maybe this has been fixed in Xymon releases 4.3.11+. This is dealing with custom cgi's being placed into
cgi-bin/cgi-secure that are calling the xymonpage procedure. Problem is being experienced in 4.3.11.
When installing/modifying a custom module, running into corrupt web content with the
upper menu installed through the xymonmenu.cfg/XYMONBODYHEADER mechanism via xymonpage. One variables is not
being defined (XYMONSERVERSECURECGIURL) and de-referencing of another (XYMONSERVERWWWWURL) during
execution. The latter condition is kinky; I tried tracing through xymonpage.c/headfoot.c but ended
up getting lost. Until the XYMONSERVESECURECGIURL is ~~encountered in the xymonmenu.cfg, the XYMONSERVERWWWURL is
being resolved.
Anyways, the problem can be demonstrated below by just setting the XYMONHOME variable and trying the three
functions. Functions try1 and try2 are setting xymon environment using either sourcing of configuration file
or through the xymoncmd. Results of both show the variables being undefined in the web page generation. If you look
at the whole web page generation, there is also something weird with bad ~~duplication after the Help block from
the xymonmenu.cfg (at least on my site). Oof...
One work around is to explicitly import the xymonserver.cfg content using the "--env" option with the xymonpage
call. Function try3 (and try4) works - the variables all get defined. Note: still may need to set up xymon
environment for the first portion feeding into the xymonpage pipeline either by sourcing or via the xymoncmd.
Looking through the mail archive, noticed others reporting something similar with the custom notes editor package.
This work around may help them too.
#!/bin/sh
export XYMONHOME=<your path>/xymon/server
function try1 {
# 1) bad iteration, source in everything at parent level - this results in erratic variable
# expansion in results, cannot find value for XYMONSERVERSECURECGIURL and XYMONSERVERWWWURL
# initially defined but lost on first incidence of XYMONSERVERSECURECGIURL (undefined)
. ${XYMONHOME}/etc/xymonserver.cfg
echo hello | \
${XYMONHOME}/bin/xymonpage
}
function try2 {
# 2) bad iteration, source in using xymoncmd - same erratic results
exec ${XYMONHOME}/bin/xymoncmd --env=${XYMONHOME}/etc/xymonserver.cfg echo hello | \
${XYMONHOME}/bin/xymonpage
}
function try3 {
# 3) works, source in everything at parent level - to set up environment for initial
# execution (the "echo hello" portion) then also re-introduce environment in
# xymonpage using "--env" setting, xymonpage is not reliably picking up runtime
# inherittance otherwise
exec ${XYMONHOME}/bin/xymoncmd --env=${XYMONHOME}/etc/xymonserver.cfg echo hello | \
${XYMONHOME}/bin/xymonpage --env=${XYMONHOME}/etc/xymonserver.cfg
}
function try4 {
# 4) works
. ${XYMONHOME}/etc/xymonserver.cfg
echo hello | \
${XYMONHOME}/bin/xymonpage --env=${XYMONHOME}/etc/xymonserver.cfg
}
# run test runs and filter out everything but blown variables -
# XYMONSERVERSECURECGIURL and XYMONSERVERWWWURL
try1 2>&1 | grep -i xymonserver | head -10
#try2 2>&1 | grep -i xymonserver | head -10
#try3 2>&1 | grep -i xymonserver
#try4 2>&1 | grep -i xymonserver
More information about the Xymon
mailing list