Xymon Mailing List Archive search

Graphing in Xymon

list Jeremy Laidman
Fri, 20 Sep 2019 10:01:20 +1000
Message-Id: <CACO=ejzuSUPVAoErv9967dNf5jrw4JF_cRXLh-Uzr=user-7163abc9e3d1@xymon.invalid>

It's my understanding that the "service=XYZ" option is used to find a match
in graphs.cfg (ie [XYZ]). Usually this is the same string as the column
name, but sometimes not, and I have to admit that I don't fully understand
the relationships between RRD filename, graph name, column name, service
name, the variables TEST2RRD and GRAPHS and the per-host TRENDS settings.


On Fri, 20 Sep 2019 at 03:03, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:
Ah, that got it.  I had REQUEST_METHOD=get on the same line as
SCRIPT_NAME, effectively making the command ?showgraph REQUEST_METHOD=GET?


Also, the QUERY_STRING does not want the ncv: in it.


ConfigPulls yields:

$ $SCRIPT_NAME

Content-type: text/html


<html><head><title>Invalid request</title></head>

<body>Unknown graph requested</body></html>


While cpu, and another custom graph we have (proc-mem) both work fine.


I?m thinking the upper case maybe causing the issue. I?m going to try to
rename the test to lowercase.


*From:* Jeremy Laidman <user-0608abae5e7c@xymon.invalid>
*Sent:* Wednesday, September 18, 2019 6:47 PM
*To:* Root, Paul T <user-76fdb6883669@xymon.invalid>
*Cc:* xymon at xymon.com
*Subject:* Re: [Xymon] Graphing in Xymon


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
<https://imss91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2flists.xymon.com%2farchive%2f2012%2dJuly%2f035214.html&umid=53F7D197-92DC-7705-AA3B-96B005793723&auth=19120be9529b25014b618505cb01789c5433dae7-0da69dac38e7cd9a0ec0cb613ccf621beba4f183>;


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=53F7D197-92DC-7705-AA3B-96B005793723&auth=19120be9529b25014b618505cb01789c5433dae7-99d13073304ea227297a4aef5b6bce69d989c333>*

<!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.

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.