TEST2RRD variable too long in xymonserver.cfg file
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,
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 907-465-8591 John.Thurston at alaska.gov Department of Administration State of Alaska
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 <john.thurston at alaska.gov> 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 907-465-8591 John.Thurston at alaska.gov Department of Administration State of Alaska
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
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 907-465-8591 John.Thurston at alaska.gov Department of Administration State of Alaska
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"
De: Xymon <xymon-bounces at xymon.com> en nombre de John Thurston <john.thurston at alaska.gov> 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 907-465-8591 John.Thurston at alaska.gov Department of Administration State of Alaska
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon Xymon -- Discussions about the Xymon monitor<http://lists.xymon.com/mailman/listinfo/xymon> 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.
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.
participants (4)
-
jimmy.aulestia@hotmail.com
-
john.thurston@alaska.gov
-
solitaryr@gmail.com
-
Wim.Nelis@nlr.nl