- print "UPDATING Primary Zabbix server entry"
- zabbixserver.host=config.MONITOR_HOSTNAME
- zabbixserver.ip=config.MONITOR_IP
- zabbixserver.dns=config.MONITOR_HOSTNAME
- zabbixserver.useip=1
+ print "Removing default Zabbix server entry"
+ zabbixserver.delete()
+
+ # NOTE: creating a host and assigning a template cannot work
+ # due to the crazy item, trigger, action
+ # copying that the php code does during a host add.
+ # NOTE: Instead, reformat any *xml.in templates and import those
+ # during /etc/plc.d/monitor sync
+ for file in glob.glob("/usr/share/monitor/templates/*.xml.in"):
+ if 'zabbix_server' in file:
+ buf = loadFile(file)
+ args = {'hostname' : config.MONITOR_HOSTNAME, 'ip' : config.MONITOR_IP}
+ dumpFile(file[:-3], buf % args)