Ad Widget

Collapse

[MySQL][ZBX4.0.13] How to properly delete a host from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eljibe
    Member
    • Apr 2014
    • 31

    #1

    [MySQL][ZBX4.0.13] How to properly delete a host from database

    Hi all,

    For performance reasons, I cannot use the api (last time I tried, the web server collapsed under the load, because requests can come a 100 at a time).
    I want to delete a host from zabbix DB using a query, and I am looking for a way to do it properly. I'm guessing the API has it in its code but I can't find it yet.
    My first try ennded up like this:
    Code:
    DELETE FROM `hosts`
    WHERE hostid = 12936;
    
    /* Erreur SQL (1451) : Cannot delete or update a parent row: a foreign key constraint fails (`ZABBIXDB`.`items`, CONSTRAINT `c_items_4` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`)) */
    /* Lignes affectées : 0  Lignes trouvées : 0  Avertissements : 0  Durée pour 0 de 1 requête : 0,000 s */
    I'm looking for some guidance because I don't want to mess things up. Has anyone ever tried this succesfully ?

    Jean-Bernard

Working...