Ad Widget

Collapse

how to get last 20 issues with zabbix API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ronny
    Junior Member
    • Aug 2013
    • 2

    #1

    how to get last 20 issues with zabbix API?

    how can i get last 20 issues like dashboard with zabbix api?
  • chrischris
    Junior Member
    • Apr 2013
    • 2

    #2
    Looking at the source (2.0.7): frontends/php/dashboard.php#L51-L110 configure `make_latest_issues` in frontends/php/include/blocks.inc.php#L774-L986 .

    Depending on your settings it looks like trigger.get gives you most of what you need:

    (Snippet from above mentioned source..)
    PHP Code:
    //...
        // get triggers
        
    $options = array(
            
    'groupids' => $filter['groupids'],
            
    'hostids' => isset($filter['hostids']) ? $filter['hostids'] : null,
            
    'monitored' => true,
            
    'maintenance' => $filter['maintenance'],
            
    'withLastEventUnacknowledged' => (!empty($filter['extAck']) && $filter['extAck'] == EXTACK_OPTION_UNACK) ? true null,
            
    'skipDependent' => true,
            
    'filter' => array(
                
    'priority' => $filter['severity'],
                
    'value' => TRIGGER_VALUE_TRUE
            
    ),
            
    'selectHosts' => array('hostid''name'),
            
    'output' => array('triggerid''value_flags''error''url''expression''description''priority''type'),
            
    'sortfield' => $filter['sortfield'],
            
    'sortorder' => $filter['sortorder'],
            
    'limit' => isset($filter['limit']) ? $filter['limit'] : DEFAULT_LATEST_ISSUES_CNT
        
    );
        
    $triggers API::Trigger()->get($options);
    //... 

    Comment

    • ronny
      Junior Member
      • Aug 2013
      • 2

      #3
      Originally posted by chrischris
      Looking at the source (2.0.7): frontends/php/dashboard.php#L51-L110 configure `make_latest_issues` in frontends/php/include/blocks.inc.php#L774-L986 .

      Depending on your settings it looks like trigger.get gives you most of what you need:

      (Snippet from above mentioned source..)
      PHP Code:
      //...
          // get triggers
          
      $options = array(
              
      'groupids' => $filter['groupids'],
              
      'hostids' => isset($filter['hostids']) ? $filter['hostids'] : null,
              
      'monitored' => true,
              
      'maintenance' => $filter['maintenance'],
              
      'withLastEventUnacknowledged' => (!empty($filter['extAck']) && $filter['extAck'] == EXTACK_OPTION_UNACK) ? true null,
              
      'skipDependent' => true,
              
      'filter' => array(
                  
      'priority' => $filter['severity'],
                  
      'value' => TRIGGER_VALUE_TRUE
              
      ),
              
      'selectHosts' => array('hostid''name'),
              
      'output' => array('triggerid''value_flags''error''url''expression''description''priority''type'),
              
      'sortfield' => $filter['sortfield'],
              
      'sortorder' => $filter['sortorder'],
              
      'limit' => isset($filter['limit']) ? $filter['limit'] : DEFAULT_LATEST_ISSUES_CNT
          
      );
          
      $triggers API::Trigger()->get($options);
      //... 
      Thanks for the reply chrischris, But what parameter should I use to get host name, issue and age like dashboard?

      Comment

      Working...