Xymon Mailing List Archive search

TEST2RRD variable too long in xymonserver.cfg file

6 messages in this thread

list Jimmy Aulestia · Tue, 17 Apr 2018 15:20:33 +0000 ·
Hi,


I have a lot of custom scripts  and the line of TEST2RRD is  very long, sometimes is hard to find the ncv definitions in the line.


Can I split the TEST2RRD in two o more lines?


Greetings,
list John Thurston · Tue, 17 Apr 2018 07:49:45 -0800 ·
On 4/17/2018 7:20 AM, Jimmy Aulestia wrote:
Can I split the TEST2RRD in two o more lines?
It is one variable, so I think it must appear on one logical line. However, I don't see any reason you can't use line-continuation to improve the legibility. Doing so will let your content span several short visual lines in your text file.

 From the man file for hosts.cfg (the first place I looked for continuation):
"Long lines can be broken up by putting a backslash at the end of the line and continuing the entry on the next line."

I expect white space in the line to be stripped by the parser, so I'd expect to be able to insert "\" and " " characters liberally. You should be able to make your lines appear however you like.
--
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska
list Galen Johnson · Tue, 17 Apr 2018 13:17:58 -0400 ·
Another option would be to use string concatenation; such as:

TEST2RRD="cpu=la,disk,inode,qtree"
TEST2RRD+=",memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp"
TEST2RRD+=",time=ntpstat,vmstat,iostat,netstat,temperature,apache"

Or, I do this, if you are using the Terabithia rpm (you can do this without
it but would require some extra manual setup*), add content under
$XYMONSERVER/xymonserver.cfg.d/testname that has something like the
following example for a test named "threads":


#> cat xymonserver.cfg.d/threads
GRAPHS_threads="threads"

TEST2RRD+=",threads=ncv"

SPLITNCV_threads="*:NONE,total:GAUGE,consumed:GAUGE"

this keeps everything in nice, test specific configs.

=G=

* - add the following line to your xymonserver.cfg file:
directory /etc/xymon/xymonserver.cfg.d


On Tue, Apr 17, 2018 at 11:49 AM, John Thurston <user-ce4d79d99bab@xymon.invalid>
quoted from John Thurston
wrote:
On 4/17/2018 7:20 AM, Jimmy Aulestia wrote:
Can I split the TEST2RRD in two o more lines?

It is one variable, so I think it must appear on one logical line.
However, I don't see any reason you can't use line-continuation to improve
the legibility. Doing so will let your content span several short visual
lines in your text file.

From the man file for hosts.cfg (the first place I looked for
continuation):
"Long lines can be broken up by putting a backslash at the end of the line
and continuing the entry on the next line."

I expect white space in the line to be stripped by the parser, so I'd
expect to be able to insert "\" and " " characters liberally. You should be
able to make your lines appear however you like.
--
   Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska

list Wim Nelis · Tue, 17 Apr 2018 17:20:37 +0000 ·
quoted from Jimmy Aulestia
I have a lot of custom scripts  and the line of TEST2RRD is  very long, sometimes is hard to find the ncv definitions in the line.
Can I split the TEST2RRD in two o more lines?

Yes, you can. In file xymonserver.cfg, an "includir" directive is used. For each additional test in Xymon, a seperate file is created. For instance, for the additional test named "env", there is a file called "env.cfg", containing two lines:


TEST2RRD+=",env=devmon"
GRAPHS+=",env"


Note, the use of a comma at the beginning of those symbol definitions. See the documentation of xymonserver.cfg, the paragraph named DESCRIPTION. The same trick should be usable within file xymonserver.cfg too, enabling you to split up the definition of TEST2RRD.


HTH,

  Wim Nelis.
list John Thurston · Tue, 17 Apr 2018 09:31:44 -0800 ·
quoted from Galen Johnson
On 4/17/2018 9:17 AM, Galen Johnson wrote:
Another option would be to use string concatenation; such as:

TEST2RRD="cpu=la,disk,inode,qtree"
TEST2RRD+=",memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp"
TEST2RRD+=",time=ntpstat,vmstat,iostat,netstat,temperature,apache"
Ok, this is cool. I never suspected this would work. There's that big 
warning at the top of the file:
# NB : Even though it might look like a shell-script, it is NOT.

so it has never been clear to me what parsed these files.
quoted from Galen Johnson

--
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska
list Jimmy Aulestia · Tue, 17 Apr 2018 18:44:13 +0000 ·
Thanks,

I changed TEST2RRD in the same xymonserver.cfg with TEST2RRD+=",.." and it's working fine.

Greetings
TEST2RRD="cpu=la,disk,inode,qtree"
TEST2RRD+=",memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp"
TEST2RRD+=",time=ntpstat,vmstat,iostat,netstat,temperature,apache"
quoted from John Thurston
De: Xymon <xymon-bounces at xymon.com> en nombre de John Thurston <user-ce4d79d99bab@xymon.invalid>
Enviado: martes, 17 de abril de 2018 12:31
Cc: xymon >> xymon at xymon.com
Asunto: Re: [Xymon] TEST2RRD variable too long in xymonserver.cfg file

On 4/17/2018 9:17 AM, Galen Johnson wrote:
Another option would be to use string concatenation; such as:

TEST2RRD="cpu=la,disk,inode,qtree"
TEST2RRD+=",memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp"
TEST2RRD+=",time=ntpstat,vmstat,iostat,netstat,temperature,apache"
Ok, this is cool. I never suspected this would work. There's that big
warning at the top of the file:
# NB : Even though it might look like a shell-script, it is NOT.

so it has never been clear to me what parsed these files.

--
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Department of Administration
State of Alaska

Xymon -- Discussions about the Xymon monitor<
lists.xymon.com
The Xymon monitor - www.xymon.com - is an Open Source (GPL) licensed monitoring system. This mailing list is for discussions about installing and using Xymon.