Ad Widget

Collapse

Bug (1.8.2) : Deleting map with the API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sebastien
    Junior Member
    • May 2010
    • 2

    #1

    Bug (1.8.2) : Deleting map with the API

    There is a bug when you try to delete a map with the API. Elements concerning this map are not deleted in the other maps.

    In the file class.cmap.php, line 677, I think you have to change :
    ' WHERE '.DBcondition('sysmapid',$sysmapids).
    by
    ' WHERE '.DBcondition('elementid',$sysmapids).

    Thank you for the API. With python, it's a real pleasure to interface our system with zabbix.
  • Aly
    ZABBIX developer
    • May 2007
    • 1126

    #2
    Yes, you are right. It'll be fixed. Thank you. Registered as ZBX-2412
    Zabbix | ex GUI developer

    Comment

    • sebastien
      Junior Member
      • May 2010
      • 2

      #3
      I don't know if this is the right place to post a new feature but I added the deleteElements function in the file class.cmap.php. Is it possible to add it in the next version ?

      PHP Code:
      /**
       * Delete Element from map
       *
       * {@source}
       * @access public
       * @static
       * @since 1.8
       * @version 1
       *
       * @param array $selements multidimensional array with selement objects
       * @param array $selements[0, ...]['selementid'] selementid to delete
       */
          
      public static function deleteElements($selements){
              
      $selements zbx_toArray($selements);

              
      $selementids = array();
              foreach(
      $selements as $num => $selement){
                  
      $selementids[] = $selement['selementid'];
              }
              
              
      self::BeginTransaction(__METHOD__);

              
      $result delete_sysmaps_element($selementids);

              
      $result self::EndTransaction($result__METHOD__);

              if(
      $result)
                  return 
      true;
              else{
                  
      self::setError(__METHOD__);
                  return 
      false;
              }
          } 

      Comment

      • Aly
        ZABBIX developer
        • May 2007
        • 1126

        #4
        1. You should post it at "Patches" thread.
        2. Such method will be added but in future, map elements manipulation will flow through Map::update method.
        Zabbix | ex GUI developer

        Comment

        Working...