Welcome to Pandora FMS Community › Forums › Community support › BAD XML – why?
-
BAD XML – why?
Posted by qus on May 21, 2009 at 02:25Hello,
Here’s an XML message I am passing to my Pandora server, this message works and gives no errors:
queue
generic_data
0
kolejka
status
generic_proc
1
Czy dziala
But this message doesn’t get processed, it stays in data_in directory, renamed to BADXML:
status
generic_proc
0
Czy dziala
Only thing I can suspect is that there might be some invisible special characters. I am attaching a file here, so you can check it. (this is of course not doc, but palin text, but I couldn’t attach it without renaming)
Sancho replied 15 years, 8 months ago 4 Members · 10 Replies -
10 Replies
-
-
::
This is not generated by pandora_agent.conf, it is generated by perl (or python) monitor. As you see there are two files – one that works (without this strange ![CDATA[]] formatting), another one doesn’t… That’s all there is…
OK, it is Python. See for yourself:
#!/usr/bin/env python
import time
import pexpect
import sys
import retry:
child = pexpect.spawn(‘ftp 10.139.106.38’)
child.expect(‘(?i)name .*: ‘)
child.sendline(‘0000’)
child.expect(‘(?i)password’)
child.sendline(‘0000’)
child.expect(‘ftp> ‘)
#child.sendline(‘cd /Sent’)
#child.expect(‘ftp> ‘)
child.sendline(‘dir’)ktory=child.readline() #dupa
que=0
sent=0while not re.search(‘226 Closing data’,ktory):
if ktory[53:54]==”O”:
que=que+1
elif ktory[53:54]==”S”:
sent=sent+1
ktory=child.readline()if child.isalive():
child.sendline(‘bye’) # Try to ask ftp child to exit.
child.close()timestring = time.strftime(“%Y-%m-%d %H:%M:%S”, time.localtime(time.time()))
print ‘
‘ % timestring
print ‘‘ ‘
print ‘queue ‘
print ‘generic_data ‘
print ‘%s‘ % que
print ‘kolejka ‘
print ‘print ‘
‘ ‘
print ‘status ‘
print ‘generic_proc ‘
print ‘1‘
print ‘Czy dziala ‘
print ‘
print ‘‘except pexpect.TIMEOUT:
timestring = time.strftime(“%Y-%m-%d %H:%M:%S”, time.localtime(time.time()))
print ‘‘ % timestring ‘
print ‘‘ ‘
print ‘status ‘
print ‘generic_proc ‘
print ‘0‘
print ‘Czy dziala ‘
print ‘
print ‘
print ” -
-
::
Take a look at http://www.openideas.info/wiki/index.php?title=Pandora_2.0:Solution_to_Common_Problems
Try to debug the xml that fails following the instructions given there:
You can see in your browser the content of the data files, just adding the next files and changing the headers of the .data file (they are, in the end, xml files):
* Add to the data file:
* Create file pandora_agent.dtd:
* Create file pandora_agent.xsl:
Pandora Agent
Name Type Data Description
Then, you can open the data file in your browser, easier to debug.
If you have any problem showing some characters, try to put encoding to “ISO-8859-1”.
-
-
-
-
-
::
There’s nothing interesting in .log (from today), bur .error is full of errors (this log is 134038185 bytes!), they look more or less like this:
Argument “83%” isn’t numeric in sprintf at /usr/lib/perl5/site_perl/5.10.0/PandoraFMS/DB.pm line 905.
Argument “100%” isn’t numeric in sprintf at /usr/lib/perl5/site_perl/5.10.0/PandoraFMS/DB.pm line 905.
Argument “88%” isn’t numeric in sprintf at /usr/lib/perl5/site_perl/5.10.0/PandoraFMS/DB.pm line 905. -
::
Delete the entire log, try to parse only the xml that are giving you problems and put here the contents of the log (and the XML, if this is different from the first you put here). Seems to be a problem because is receiving numerical data as “83%” and the “%” is not understood and discards it, but you XML don’t have any % character ¿?¿?