2007-01-04 Sancho Lerena <slerena@artica.es>

* Linux/pandora_agent.sh: Solved problem with encoding. Now XML
        its parsed before sending it, replacing all & characters.

NOTE: This changes needs to be copied to AIX, Solaris, HPUX and BSD agents.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@350 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-01-04 07:56:34 +00:00
parent 109b0c9184
commit 4fecef783c
2 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2007-01-04 Sancho Lerena <slerena@artica.es>
* Linux/pandora_agent.sh: Solved problem with encoding. Now XML
its parsed before sending it, replacing all & characters.
2007-01-03 Sancho Lerena <slerena@artica.es>
* Linux/pandora_agent.conf: Added more tokens to config

View File

@ -42,10 +42,11 @@ CHECKSUM_MODE=1
DEBUG_MODE=0
SERVER_PORT=22
INTERVAL=300
ENCODING=`echo $LANG | cut -f 2 -d "."`
if [ -z "$ENCODING" ]
if [ -z "`echo $LANG | grep '\.'`" ]
then
ENCODING="iso-8859-1"
else
ENCODING=`echo $LANG | cut -f 2 -d "."`
fi
NOMBRE_HOST=`/bin/hostname`
OS_NAME=`uname -s`
@ -146,6 +147,7 @@ fi
# Script banner at start
echo "Pandora FMS Agent $AGENT_VERSION (c) Sancho Lerena, and others 2007"
echo "This program is licensed under GPL Terms. http://pandora.sf.net"
echo "Running in $NOMBRE_HOST at $TIMESTAMP \n"
echo " "
if [ "$DEBUG_MODE" == "1" ]
@ -290,6 +292,13 @@ do
# Finish data packet
echo "</agent_data>" >> $DATA
echo "" >> $DATA
# Replace & chars in XML (should not to be any) to avoid syntax problems
sed "s/&/&amp;/g" $DATA > $TEMP/finalxml.tmp
rm -f $DATA
mv $TEMP/finalxml.tmp $DATA
if [ "$DEBUG_MODE" == "1" ]
then
echo "$TIMESTAMP - Finish writing XML $DATA" >> $PANDORA_LOGFILE