Bienvenido a la comunidad de Pandora FMS › Forums › Community support › XML-AUTOMATISATION
-
XML-AUTOMATISATION
Posted by meriem on julio 1, 2025 at 14:29Hii, I have implemented an automated supervision deployment system under Pandora FMS by generating XML files that are injected into the<div>
/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? </div>Sergio B. replied 1 year, 1 month ago 2 Members · 4 Replies -
4 Replies
-
-
::
I first created a CSV file :
agent_name,ip,group,modules
CAMERA_Q1,192.168.10.11,<wbr>Station_Q1,ping,tcp80
CAMERA_Q2,192.168.10.12,<wbr>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>
<name>{module}_{agent_name}</<wbr>name>
<type>{module_type}</type>
<data>{ip}</data>
</module>\n»»»
xml_content = f»»»<?xml version=»1.0″ encoding=»UTF-8″?>
<agent_data>
<agent_name>{agent_name}</<wbr>agent_name>
<group>{group}</group>
<address>{ip}</address>
{module_entries}</agent_data>»<wbr>»»
return xml_contentwith open(«equipements_station.csv»<wbr>, newline=») as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
xml_data = generate_xml(row[«agent_name»]<wbr>, row[«ip»], row[«group»], row[«modules»])
with open(f»{data_in_path}{row[‘<wbr>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.»)
-
-
::
and that’s the XML file generated
<?xml version=»1.0″ encoding=»UTF-8″?>
<agent_data>
<agent_name>switch_q1</agent_<wbr>name>
<group>Station_3</group>
<address>192.168.10.105</<wbr>address>
<module>
<name>ping_switch_q1</name>
<type>generic_data</type>
<data>ping</data>
</module>
</agent_data> -
::
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.
Log in to reply.