Following your commands, the only suggestion is that the variables might
not have been set correctly. Perhaps run "echo $QUERY_STRING; echo
$REQUEST_METHOD; echo $SCRIPT_NAME" immediately before "$SCRIPT_NAME".
In case my instructions were amiss, here's another example of debugging
showgraph.sh to follow:
https://lists.xymon.com/archive/2012-July/035214.html
J
On Wed, 18 Sep 2019 at 04:32, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:
I must be doing something group here, neither worked:
$ SCRIPT_NAME=showgraph.sh REQUEST_METHOD=GET
root nsmdenvp117:/etc/xymon/analysis.d
$
QUERY_STRING='host=nsmdenvp185&service=ncv:ConfigPulls&graph_width=576&graph_height=120&disp=nsmdenvp185&nostale&color=blue&graph_start=1568489816&graph_end=1568662616&graph=hourly&action=view'
$ PATH=$PATH:/usr/lib64/xymon/cgi-bin
$ type showgraph.sh
showgraph.sh is /usr/lib64/xymon/cgi-bin/showgraph.sh
$ showgraph.sh
Content-type: text/html
<html><head><title>Invalid request</title></head>
<body>Invalid request - no host or service</body></html>
$ export QUERY_STRING
$ export SCRIPTNAME
$ $SCRIPTNAME
$ export SCRIPT_NAME
$ $SCRIPT_NAME
Content-type: text/html
<html><head><title>Invalid request</title></head>
<body>Invalid request - no host or service</body></html>
$
QUERY_STRING='host=nsmdenvp185&service=cpu&graph_width=576&graph_height=120&disp=nsmdenvp185&nostale&color=blue&graph_start=1568489816&graph_end=1568662616&graph=hourly&action=view'
$ $SCRIPT_NAME
Content-type: text/html
<html><head><title>Invalid request</title></head>
<body>Invalid request - no host or service</body></html>
$ file /usr/lib64/xymon/cgi-bin/showgraph.sh
/usr/lib64/xymon/cgi-bin/showgraph.sh: ELF 64-bit LSB executable, x86-64,
version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
2.6.18, stripped
*From:* Jeremy Laidman <user-0608abae5e7c@xymon.invalid>
*Sent:* Monday, September 16, 2019 3:38 PM
*To:* Root, Paul T <user-76fdb6883669@xymon.invalid>
*Cc:* xymon at xymon.com
*Subject:* Re: [Xymon] Graphing in Xymon
On Tue, 17 Sep 2019 at 05:53, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:
Looping back on this:
Running the showgraph by hand
$ *./showgraph.sh host=nsmdenvp185 service=ncv:ConfigPulls
graph_width=576 graph_height=120 disp=nsmdenvp185 nostale color=blue
graph_start=1568489816 graph_end=1568662616 graph=hourly action=view*
This won't work. The showgraph.cgi binary expects to be run as a CGI and
requires QUERY_STRING to be set (to
host=nsmdenvp185&service=ncv:ConfigPulls&graph_width=...) and
REQUEST_MATHOD to be set to "GET". It also expects SCRIPT_NAME to be set
(and normally it would be showgraph.sh) but I think this only generates
warnings.
Try running like so:
SCRIPT_NAME=showgraph.sh REQUEST_METHOD=GET
QUERY_STRING='host=nsmdenvp185&service=ncv:ConfigPulls&graph_width=576&graph_height=120&disp=nsmdenvp185&nostale&color=blue&graph_start=1568489816&graph_end=1568662616&graph=hourly&action=view'
./showgraph.sh
The output will be partly binary, so you might want to try:
SCRIPT_NAME=showgraph.sh REQUEST_METHOD=GET
QUERY_STRING='host=nsmdenvp185&service=ncv:ConfigPulls&graph_width=576&graph_height=120&disp=nsmdenvp185&nostale&color=blue&graph_start=1568489816&graph_end=1568662616&graph=hourly&action=view'
./showgraph.sh | sed '1,/^$/d' | file -
and see if it shows that a PNG file format was generated.
If this doesn't work, check for a service name such as "cpu" that is known
to work, rather than your custom "ncv:ConfigPulls".
Content-type: text/html
<html><head><title>Invalid request</title></head>
<body>Invalid request - no host or service</body></html>
Yep, cos no QUERY_STRING.
$ *ls /var/lib/xymon/rrd/nsmdenvp185/ConfigPulls**
/var/lib/xymon/rrd/nsmdenvp185/ConfigPulls.rrd
root nsmdenvp117:/usr/lib64/xymon/cgi-bin
$ cat ~ptroot/crap2
#!/bin/bash
$* curl -k
https://nsmdenvp117.corp.intranet/xymon-cgi/showgraph.sh\?host=nsmdenvp185\&service=ncv:ConfigPulls\&graph_width=576\&graph_height=120\&disp=nsmdenvp185\&nostale\&color=blue\&graph_start=1568489816\&graph_end=1568662616\&graph=hourly\&action=view
<https://imss91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2fnsmdenvp117.corp.intranet%2fxymon%2dcgi%2fshowgraph.sh%255C%3fhost%3dnsmdenvp185%255C%26service%3dncv%3aConfigPulls%255C%26graph%5fwidth%3d576%255C%26graph%5fheight%3d120%255C%26disp%3dnsmdenvp185%255C%26nostale%255C%26color%3dblue%255C%26graph%5fstart%3d1568489816%255C%26graph%5fend%3d1568662616%255C%26graph%3dhourly%255C%26action%3dview&umid=656D8EA6-92B1-9705-83D0-CC28939636BB&auth=19120be9529b25014b618505cb01789c5433dae7-c5515d751c27d0f5b49b12d1513ad03efa095723>*
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
This works for me (substituting my own Xymon servername, hostname and
service.
</head><body>
<h1>Internal Server Error</h1>
This communication is the property of CenturyLink and may contain
confidential or privileged information. Unauthorized use of this
communication is strictly prohibited and may be unlawful. If you have
received this communication in error, please immediately notify the sender
by reply e-mail and destroy all copies of the communication and any
attachments.