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
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
On Wed, Dec 2, 2015 at 3:33 AM J.C. Cleaver <cleaver at terabithia.org> 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.
participants (2)
-
cleaver@terabithia.org
-
jlaidman@rebel-it.com.au