John,
That is exactly what I was thinking.
Xymon version 4.3.0
In my script I get the results as follows:
- Echo $BBALPHAMSG (everything is fine – except for
formatting which is what I am trying to correct)
- Echo “$BBALPHAMSG” >file (message is written to file and
formatting is as I would like but the “\*” characters are converted as
described below)
- Echo $BBALPHAMSG >file (same as above but message is not
formatted)
So it's in a shell script you're writing? Just don't enclose $BBALPHAMSG
in double quotes and you'll be fine.
If it's a BASH script, then the behaviour above is as documented - see
'man bash' under QUOTING:
...
Enclosing characters in double quotes preserves the literal
value of all characters within the quotes,
with the exception of $, ‘, \, and, when history expansion is
enabled, !. The characters $ and ‘ retain
their special meaning within double quotes. The backslash
retains its special meaning only when fol-
lowed by one of the following characters: $, ‘, ", \, or
<newline>. A double quote may be quoted within
double quotes by preceding it with a backslash. If enabled,
history expansion will be performed unless
an ! appearing in double quotes is escaped using a backslash.
The backslash preceding the ! is not
removed.
...
Words of the form $'string' are treated specially. The word
expands to string, with backslash-escaped
characters replaced as specified by the ANSI C standard.
Backslash escape sequences, if present, are
decoded as follows:
\a alert (bell)
\b backspace
\e an escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\' single quote
\nnn the eight-bit character whose value is the octal
value nnn (one to three digits)
\xHH the eight-bit character whose value is the
hexadecimal value HH (one or two hex digits)
\cx a control-x character
...
David.
I have tried to pipe both of these through sed before sending to the
file but that still isn’t working as the characters are converted
prior to the pipe.
There has got to be a way that I can write these to a file but I am
just missing something simple.
Thanks,
John
John Rothlisberger
Senior Analyst
Application & Technology Integration
Implementation & Managed Services for Business Process Outsourcing
IT Strategy, Infrastructure & Security - Technology Growth Platform
Accenture
XXX.XXX.XXXX office**
*From:*David Baldwin [mailto:user-cbbf693f2c89@xymon.invalid]
*Sent:* Wednesday, July 27, 2011 5:10 PM
*To:* Rothlisberger, John R.
*Cc:* xymon at xymon.com
*Subject:* Re: [Xymon] Corrupted data in BBALPHAMSG?
John,
The "corrupted characters" you are seeing are the ASCII characters
corresponding to the number after the \ character. e.g. \4 -> ^D, \44
-> $, etc. It looks like the string is being passed to something like
a string formatting function (e.g. sprintf) without being properly
quoted to escape '\' characters.
What version of Xymon are you using?
David.
Has anyone noticed what appears to be corruption in BBALPHAMSG? I
have only noticed this behavior (so far) on disk checks and it always
follows the backslash between the Total Space and Available Space. It
also seems to be consistent from host to host (ex. The host below
will have the same corruption for each disk check other hosts may show
slightly different characters but not all hosts exhibit errors).
Within my email script all I am doing is ‘echo “$BBALPHAMSG” >tmpfile’.
Xymon Server: Ubuntu 10.04
Client (in this instance): W2k3 Server
The actual client data appears to be just as expected with no odd
characters (this is pulled from the “Client data” link on the Xymon page):
[disk]
Filesystem 1K-blocks Used Avail Capacity
Mounted Summary(Total\Avail)
C 20241899 11256291 8985608 55%
/FIXED/C 19.31gb\8.58gb
D 856979392 641409136 215570256 74%
/FIXED/D 817.28gb\205.59gb
F 179205040 54697624 124507416 30%
/FIXED/F 170.92gb\118.75gb
G 179205072 174737304 4467768 97%
/FIXED/G 170.92gb\4.26gb
H 179205072 174778264 4426808 97%
/FIXED/H 170.92gb\4.22gb
I 176064364 129088448 46975916 73%
/FIXED/I 167.92gb\44.81gb
J 1756490840 41785572 1714705268 2%
/FIXED/J 1.65tb\1.61tb
O 976771068 95844 976675224 0%
/FIXED/O 931.53gb\931.44gb
But then when I use BBALPHAMSG within an email script there can be odd
corruption:
yellow Wed Jul 27 09:24:50 2011 - Filesystems NOT ok
&yellow G (97% used) has reached the WARNING level (97%)
&yellow H (97% used) has reached the WARNING level (97%)
Filesystem 1K-blocks Used Avail Capacity
Mounted Summary(Total\Avail)
C 20241899 11256291 8985608 55%
/FIXED/C 19.31gb\8.58gb
D 856979392 641409136 215570256 74%
/FIXED/D 817.28gb<85>.59gb
F 179205040 54697624 124507416 30%
/FIXED/F 170.92gb 8.75gb
G 179205072 174737304 4467768 97%
/FIXED/G 170.92gb^D.26gb
H 179205072 174778264 4426808 97%
/FIXED/H 170.92gb^D.22gb
I 176064364 129088448 46975916 73%
/FIXED/I 167.92gb$.81gb
J 1756490840 41785572 1714705268 2%
/FIXED/J 1.65tb^A.61tb
O 976771068 95844 976675224 0%
/FIXED/O 931.53gb\931.44gb
See
http://xymonserver/xymon-cgi/svcstatus.sh?HOST=ServerA&SERVICE=disk
<http://xymonserver/xymon-cgi/svcstatus.sh?HOST=ServerA&SERVICE=disk>
Thanks,
John
John Rothlisberger
Senior Analyst
Application & Technology Integration
Implementation & Managed Services for Business Process Outsourcing
IT Strategy, Infrastructure & Security - Technology Growth Platform
Accenture
XXX.XXX.XXXX office
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete
the original. Any other use of the email by you is prohibited.
--
David Baldwin - Assistant Director, Infrastructure (acting)
Information and Communication Technology Services
Australian Sports Commission http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830 PO Box 176 Belconnen ACT 2616
user-cbbf693f2c89@xymon.invalid <mailto:user-cbbf693f2c89@xymon.invalid> Leverrier Street Bruce ACT 2617
Keep up to date with what's happening in Australian sport visit
www.ausport.gov.au <http://www.ausport.gov.au>
This message is intended for the addressee named and may contain
confidential and privileged information. If you are not the intended
recipient please note that any form of distribution, copying or use of
this communication or the information in it is strictly prohibited and
may be unlawful. If you receive this message in error, please delete
it and notify the sender.
--
David Baldwin - Assistant Director, Infrastructure (acting)
Information and Communication Technology Services
Australian Sports Commission http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830 PO Box 176 Belconnen ACT 2616
user-cbbf693f2c89@xymon.invalid Leverrier Street Bruce ACT 2617