Pandora FMS Community

XML-AUTOMATISATION

meriem · 1 jul 2025, 14:29 · 5 mensajes · 218 visitas

  1. Inicio del debate

    Hii, I have implemented an automated supervision deployment system under Pandora FMS by generating XML files that are injected into the

    /var/spool/pandora/data_in/ directory to create monitoring agents automatically. However, despite the correct generation and placement of these XML files, the agents do not appear in the Pandora FMS interface after injection. What configuration aspects or operational behaviors of Pandora FMS could prevent these XML files from being processed?

  2. Hello,

    Have you made sure that the generated XML format is correct?

    Can you share one of those XMLs to validate if they are formatted correctly as .data?

    Kind regards,

    Sergio B.

  3. I first created a CSV file :

    agent_name,ip,group,modules
    CAMERA_Q1,192.168.10.11,Station_Q1,ping,tcp80
    CAMERA_Q2,192.168.10.12,Station_Q1,ping,tcp80

    , then wrote a Python script to convert the CSV data into XML format:

    import csv

    data_in_path = "/var/spool/pandora/data_in/"

    def generate_xml(agent_name, ip, group, modules):
    module_entries = ""
    for module in modules.split(','):
    if module == "ping":
    module_type = "icmp_proc"
    elif module.startswith("tcp"):
    module_type = "tcp_proc"
    else:
    module_type = "generic_data"

    **module_entries += f"""
    {module}_{agent_name}</name>
    {module_type}
    {ip}
    \n"""
    xml_content = f"""
    <agent_data>
    <agent_name>{agent_name}</agent_name>
    {group}

    {ip}
    {module\_entries}""" return xml\_content**

    with open("equipements_station.csv", newline='') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
    xml_data = generate_xml(row["agent_name"], row["ip"], row["group"], row["modules"])
    with open(f"{data_in_path}{row['agent_name']}.xml", "w") as f:
    f.write(xml_data)

    print("[INFO] Tous les fichiers XML ont été générés et placés dans data_in.")

  4. and that's the XML file generated

    <agent_data>
    <agent_name>switch_q1</agent_name>
    Station_3

    192.168.10.105address> ping\_switch\_q1 generic\_data ping
  5. Hello,

    Yes, the format of the XML is not correct as it needs to hold CDATA variables:

    <module>    <name><![CDATA[Ping]]></name>    <type>generic_proc</type>    <data><![CDATA[1]]></data>    <description><![CDATA[Ping check to vCenter]]></description>    <unit><![CDATA[]]></unit>    <min_warning><![CDATA[0]]></min_warning>    <max_warning><![CDATA[0]]></max_warning>    <min_critical><![CDATA[0]]></min_critical>    <max_critical><![CDATA[0]]></max_critical>    <str_warning><![CDATA[]]></str_warning>    <str_critical><![CDATA[]]></str_critical></module>
    

    Here's an example.

    Kind regards,

    Sergio B.

Entra en tu cuenta para publicar.