Xymon Mailing List Archive search

Bug in TRENDS handling?

3 messages in this thread

list Jeremy Laidman · Tue, 01 Dec 2015 13:33:46 +0000 ·
Hiya

I think I've found a rather obscure bug in the handling of the TRENDS
overrides in hosts.cfg.  For example, the following hosts.cfg entry doesn't
do what I'd expect:

192.168.0.1 server1.example.com #
TRENDS:*,netstat_enhanced:ns1|ns2,netstat:netstat|netstat1

(Assume that GRAPHS in xymonserver.cfg includes "netstat" and
"netstat_enhanced".)

I would expect that the trends page for this host would have graphs of ns1,
ns2 (in place of netstat_enhanced), and netstat and netstat1 (in place of
just netstat).

However, it appears that the "nestat_enhanced" entry masks the "netstat"
entry, and the latter is set to the default of showing only the "netstat"
graph.

Another example is, if I have
TRENDS:*,_vmstat_,vmstat:vmstat|vmstat3|vmstat4|vmstat5,...
then my trends page shows only the one "vmstat" graph.  After removing the
"_vmstat_" I get four vmstat graphs as specified.

If I upper-case any of the characters in the earlier definition, or if I
move the definition to be later, everything works as expected.

I had a quick look at the code, but I can't read C well enough to find the
bug.  Although I'm starting to suspect that the strstr() in
svcstatus-trends.c might be successfully sub-string matching.  Instead, it
should match only a whole word (perhaps terminated by whitespace, comman,
pipe and colon.  But this is a guess, really.

J
list Japheth Cleaver · Tue, 1 Dec 2015 08:33:08 -0800 ·
quoted from Jeremy Laidman
On Tue, December 1, 2015 5:33 am, Jeremy Laidman wrote:
Hiya

I think I've found a rather obscure bug in the handling of the TRENDS
overrides in hosts.cfg.  For example, the following hosts.cfg entry
doesn't
do what I'd expect:

192.168.0.1 server1.example.com #
TRENDS:*,netstat_enhanced:ns1|ns2,netstat:netstat|netstat1

(Assume that GRAPHS in xymonserver.cfg includes "netstat" and
"netstat_enhanced".)

I would expect that the trends page for this host would have graphs of
ns1,
ns2 (in place of netstat_enhanced), and netstat and netstat1 (in place of
just netstat).

However, it appears that the "nestat_enhanced" entry masks the "netstat"
entry, and the latter is set to the default of showing only the "netstat"
graph.

Another example is, if I have
TRENDS:*,_vmstat_,vmstat:vmstat|vmstat3|vmstat4|vmstat5,...
then my trends page shows only the one "vmstat" graph.  After removing the
"_vmstat_" I get four vmstat graphs as specified.

If I upper-case any of the characters in the earlier definition, or if I
move the definition to be later, everything works as expected.

I had a quick look at the code, but I can't read C well enough to find the
bug.  Although I'm starting to suspect that the strstr() in
svcstatus-trends.c might be successfully sub-string matching.  Instead, it
should match only a whole word (perhaps terminated by whitespace, comman,
pipe and colon.  But this is a guess, really.

J
That's an interesting one.

This is not particularly well tested, but can you see if this patch fixes
the issue you're seeing? It's basically just a transplant of the logic
that was being used in the 'acceptonly' patch for isolation.


-jc
list Jeremy Laidman · Wed, 02 Dec 2015 00:17:41 +0000 ·
quoted from Japheth Cleaver
On Wed, Dec 2, 2015 at 3:33 AM J.C. Cleaver <user-87556346d4af@xymon.invalid> wrote:
This is not particularly well tested, but can you see if this patch fixes
the issue you're seeing? It's basically just a transplant of the logic
that was being used in the 'acceptonly' patch for isolation.
It works. Thanks.