Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

  • BAD XML – why?

    Posted by qus on May 21, 2009 at 02:25

    Hello,

    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
  • daniels

    Member
    May 21, 2009 at 05:59
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi qus,

    Well, the XML format that I have in my server differ from yours… Are you generating this by yourself? Could you post your pandora_agent.conf file here?

    Try to force encoding in the header:

    Follow an example of the beggining of my XML file at the server:








    Regards.

  • qus

    Member
    May 21, 2009 at 06:04
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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 re

    try:
    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=0

    while 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 ”

  • daniels

    Member
    May 21, 2009 at 06:31
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Ok Qus… Unfortunatly, I’m using basicaly agents to set my monitors… I think I will not able to help you with this issue. Hope some other guy appear here to give as an explanation of what is happening…

    Good luck.

  • raul

    Member
    May 21, 2009 at 12:19
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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”.

  • qus

    Member
    May 22, 2009 at 02:45
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Well – it works perfectly. Shows me a neat table:

    Name Type Data Description
    status generic_proc 0 Czy dziala

    Without any error. Which was obvious from the beginning, as this xml doesn’t differ from the one that works. So it seems – it’s a bug in Pandora…

  • Sancho

    Administrator
    June 1, 2009 at 04:54
    2321 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Seems that you don’t have the encoding header.

    Also datetime format is with “-” instead with “/”.

    Anyway, have you checked your pandora_server.error file and pandora_server.log ?. It probably give us a clue.

  • qus

    Member
    June 1, 2009 at 04:57
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    OK, I will check these logs. Note that I pass many different messages without headers and with “-” date separator without any problem.

  • Sancho

    Administrator
    June 1, 2009 at 05:29
    2321 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Uff, I have no idea without more information. If you don’t get anything, try to raise log verbosity to 10.

  • qus

    Member
    June 2, 2009 at 03:35
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    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.

  • Sancho

    Administrator
    June 2, 2009 at 16:11
    2321 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    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 ¿?¿?