--- /var/www/zabbix/include/import.inc.php 2008-02-19 16:37:42.000000000 +0100 +++ /root/import.inc.php 2008-02-29 11:02:35.000000000 +0100 @@ -125,6 +125,9 @@ $this->sub_node = null; array_push($this->main_node, $name); break; // case +// mod by scricca + case XML_TAG_HOSTPROFILE: +// end mod by scricca case XML_TAG_ITEM: case XML_TAG_TRIGGER: case XML_TAG_GRAPH_ELEMENT: @@ -162,26 +165,48 @@ global $USER_DETAILS; $data = &$this->data[$name]; - switch($name) { case XML_TAG_HOST: if($data['skip'] || !$data['hostid']) break; // case - if(!isset($data['port'])) $data['port'] = 10050; if(!isset($data['status'])) $data['status'] = 0; if(!isset($data['useip'])) $data['useip'] = 0; if(!isset($data['dns'])) $data['dns'] = ""; if(!isset($data['ip'])) $data['ip'] = ""; - if(update_host($data['hostid'], $data['name'], $data['port'], $data['status'], $data['useip'], $data['dns'], $data['ip'], $data['templates'], null, $data['groups'])) { info('Host ['.$data['name'].'] updated'); } + break; // case + // mod by scricca + case XML_TAG_HOSTPROFILE: + if(!isset($this->data[XML_TAG_HOST]['hostid']) || !$this->data[XML_TAG_HOST]['hostid']) + break; //case + + if(!isset($data['p_devicetype'])) $data['p_devicetype'] = ""; + if(!isset($data['p_name'])) $data['p_name'] = ""; + if(!isset($data['p_os'])) $data['p_os'] = ""; + if(!isset($data['p_serialno'])) $data['p_serialno'] = ""; + if(!isset($data['p_tag'])) $data['p_tag'] = ""; + if(!isset($data['p_macaddress'])) $data['p_macaddress'] = ""; + if(!isset($data['p_hardware'])) $data['p_hardware'] = ""; + if(!isset($data['p_software'])) $data['p_software'] = ""; + if(!isset($data['p_contact'])) $data['p_contact'] = ""; + if(!isset($data['p_location'])) $data['p_location'] = ""; + if(!isset($data['p_notes'])) $data['p_notes'] = ""; + delete_host_profile($this->data[XML_TAG_HOST]['hostid']); + if(add_host_profile($this->data[XML_TAG_HOST]['hostid'], $data['p_devicetype'], $data['p_name'], $data['p_os'], + $data['p_serialno'], $data['p_tag'], $data['p_macaddress'], $data['p_hardware'], $data['p_software'], + $data['p_contact'], $data['p_location'], $data['p_notes'])) + { + info('Host Profile ['.$this->data[XML_TAG_HOST]['name'].'] updated '); + } break; // case + // end mod by scricca case XML_TAG_GROUP: if(!isset($this->data[XML_TAG_HOST]['hostid']) || !$this->data[XML_TAG_HOST]['hostid']) break; //case