[Xymon] Graph titles and NAME: in hosts.cfg - bug?
John Horne
john.horne at plymouth.ac.uk
Wed Apr 17 00:29:49 CEST 2019
Hello,
(A bit long, sorry...)
Using Xymon 4.3.28 from the Terabithia RPMs.
I've been adding a few new client servers to our Xymon monitor. However, I have
noticed today that for some graphs no graph title appears. The graph appears,
the values appear (on the graph) and the graph lines appear. Just no title.
It seems that this affects those client servers which are configured in the
hosts.cfg file with a NAME: entry. For example:
10.11.12.13 server1 # NAME:"server1 (pre-prod web)" testip !ftp ssh...
(I don't use FQDNs for the server names.)
It seems that entries we have added to the 'graphs.cfg' file, and where the
TITLE uses the 'exec:' function have the problem. (See the 'graphs.cfg' man
page for info about using 'exec:'.) So, for example we have in graphs.cfg:
=======
[memory]
TITLE exec:/bin/sh -c 'echo Memory Utilisation - $2'
YAXIS % Used
...
=======
Debugging the graph output (by setting some variables) using
'xymoncmd showgraph.cgi --debug >/tmp/graph.out' shows:
=======
# xymoncmd showgraph.cgi --debug >/tmp/graph.out
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/bin/sh -c 'echo Memory Utilisation - $2' server1 (pre-prod
web) memory "14/Apr/2019 - 16/Apr/2019" "memory.rrd"'
=======
As can be seen the parameters passed to 'showgraph.cgi' should include the
hostname, but it includes the hostname and the NAME: entry. The shell barfs on
the parentheses. If I run the above shell command directly but quoting the
whole server name, then it works fine:
======
$ /bin/sh -c 'echo Memory Utilisation - $2' "server1 (pre-
prod web)" memory "14/Apr/2019 - 16/Apr/2019" "memory.rrd"
Memory Utilisation - 14/Apr/2019 - 16/Apr/2019
======
This seems to be a bug. If the hostname parameter being sent to showgraph
includes spaces (because the NAME: entry is included), then the whole parameter
should be quoted.
I suspect that if the NAME: entry itself has double-quotes in it, then the
graph title could be a bit messed up. If in the above example I changed the
parentheses to '=' signs, then no quoting is required but the title comes out
as 'Memory Utilisation - web='. Perhaps in those instances, as the man page for
graphs.cfg suggests, a local script is run instead to do the processing and dig
out the correct graph title.
It's late now, and I'm going to be busy leading up to the Easter break, but if
I can I'll take a look and see if I can get a patch for the code. I'm
suspecting it should be a one-line - if the total hostname parameter has a
space then quote the whole thing.
John.
--
John Horne | Senior Operations Analyst | Technology and Information Services
University of Plymouth | Drake Circus | Plymouth | Devon | PL4 8AA | UK
________________________________
[http://www.plymouth.ac.uk/images/email_footer.gif]<http://www.plymouth.ac.uk/worldclass>
This email and any files with it are confidential and intended solely for the use of the recipient to whom it is addressed. If you are not the intended recipient then copying, distribution or other use of the information contained is strictly prohibited and you should not rely on it. If you have received this email in error please let the sender know immediately and delete it from your system(s). Internet emails are not necessarily secure. While we take every care, University of Plymouth accepts no responsibility for viruses and it is your responsibility to scan emails and their attachments. University of Plymouth does not accept responsibility for any changes made after it was sent. Nothing in this email or its attachments constitutes an order for goods or services unless accompanied by an official order form.
More information about the Xymon
mailing list