Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-16863

Query from timer when using tags in maintenance

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • None
    • Server (S)

      static void     db_get_query_tags(zbx_vector_ptr_t *event_queries)
      {
              DB_ROW                          row;
              DB_RESULT                       result;
              int                             i;
              char                            *sql = NULL;
              size_t                          sql_alloc = 0, sql_offset = 0;
              zbx_event_suppress_query_t      *query;
              zbx_vector_uint64_t             eventids;
              zbx_uint64_t                    eventid;
              zbx_tag_t                       *tag;
      
              zbx_vector_uint64_create(&eventids);
      
              for (i = 0; i < event_queries->values_num; i++)
              {
                      query = (zbx_event_suppress_query_t *)event_queries->values[i];
                      zbx_vector_uint64_append(&eventids, query->eventid);
              }
      
              zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, "select eventid,tag,value from problem_tag where");
              DBadd_condition_alloc(&sql, &sql_alloc, &sql_offset, "eventid", eventids.values, eventids.values_num);
              zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, " order by eventid");
      
              result = DBselect("%s", sql);
              zbx_free(sql);
      
              i = 0;
              query = (zbx_event_suppress_query_t *)event_queries->values[0];
      
      static void     db_get_query_events(zbx_vector_ptr_t *event_queries, zbx_vector_ptr_t *event_data)
      {
              DB_ROW                          row;
              DB_RESULT                       result;
              zbx_event_suppress_query_t      *query;
              zbx_event_suppress_data_t       *data = NULL;
              zbx_uint64_t                    eventid;
              zbx_uint64_pair_t               pair;
              zbx_vector_uint64_t             eventids;
      
              /* get open or recently closed problems */
      
              result = DBselect("select eventid,objectid,r_eventid"
                              " from problem"
                              " where source=%d"
                                      " and object=%d"
                                      " and " ZBX_SQL_MOD(eventid, %d) "=%d"
                              " order by eventid",
                              EVENT_SOURCE_TRIGGERS, EVENT_OBJECT_TRIGGER, CONFIG_TIMER_FORKS, process_num - 1);
      
              while (NULL != (row = DBfetch(result)))
              {
                      query = (zbx_event_suppress_query_t *)zbx_malloc(NULL, sizeof(zbx_event_suppress_query_t));
                      ZBX_STR2UINT64(query->eventid, row[0]);
                      ZBX_STR2UINT64(query->triggerid, row[1]);
                      ZBX_DBROW2UINT64(query->r_eventid, row[2]);
                      zbx_vector_uint64_create(&query->functionids);
                      zbx_vector_ptr_create(&query->tags);
                      zbx_vector_uint64_pair_create(&query->maintenances);
                      zbx_vector_ptr_append(event_queries, query);
              }
              DBfree_result(result);
      

            zabbix.dev Zabbix Development Team
            dlamberts Dmitrijs Lamberts
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: