Exemple #1
0
void
free_agent_list (void)
{
  GHashTable *ht = get_storage_metric (HOSTS, MTRC_AGENTS);

  g_hash_table_foreach (ht, (GHFunc) free_agent_values, NULL);
}
Exemple #2
0
int
get_int_from_keymap (const char *key, GModule module)
{
  GHashTable *ht = get_storage_metric (module, MTRC_KEYMAP);

  return get_int_from_str_key (ht, key);
}
Exemple #3
0
uint32_t
get_ht_size_by_metric (GModule module, GMetric metric)
{
  GHashTable *ht = get_storage_metric (module, metric);

  return get_ht_size (ht);
}
Exemple #4
0
void
free_agent_list (void)
{
  TCADB *adb = get_storage_metric (HOSTS, MTRC_AGENTS);

  tc_db_foreach (adb, free_agent_values, NULL);
}
Exemple #5
0
void *
get_host_agent_list (int data_nkey)
{
#ifdef TCB_MEMHASH
  TCADB *db;
  void *list;
  int sp = 0;
#endif
#ifdef TCB_BTREE
  TCBDB *db;
  TCLIST *tclist;
#endif

  db = get_storage_metric (HOSTS, MTRC_AGENTS);
#ifdef TCB_MEMHASH
  if ((list = tcadbget (db, &data_nkey, sizeof (data_nkey), &sp)))
    return list;
#endif
#ifdef TCB_BTREE
  if ((tclist = tcbdbget4 (db, &data_nkey, sizeof (int))) != NULL) {
    return tclist;
  }
#endif

  return NULL;
}
Exemple #6
0
int
get_int_from_keymap (const char *key, GModule module)
{
  TCADB *adb = get_storage_metric (module, MTRC_KEYMAP);

  return get_int_from_str_key (adb, key);
}
Exemple #7
0
uint32_t
get_ht_size_by_metric (GModule module, GMetric metric)
{
  TCADB *adb = get_storage_metric (module, metric);

  return get_ht_size (adb);
}
Exemple #8
0
void *
get_host_agent_list (int data_nkey)
{
  GHashTable *ht;
  void *list;

  ht = get_storage_metric (HOSTS, MTRC_AGENTS);
  if ((list = g_hash_table_lookup (ht, &data_nkey)))
    return list;
  return NULL;
}
Exemple #9
0
void *
get_host_agent_list (int data_nkey)
{
  TCADB *adb;
  void *list;
  int sp = 0;

  adb = get_storage_metric (HOSTS, MTRC_AGENTS);
  if ((list = tcadbget (adb, &data_nkey, sizeof (data_nkey), &sp)))
    return list;
  return NULL;
}
Exemple #10
0
static void
house_keeping (void)
{
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  GModule module;
#endif

#ifndef TCB_BTREE
  if (conf.list_agents)
    free_agent_list ();
#endif

  /* REVERSE DNS THREAD */
  pthread_mutex_lock (&gdns_thread.mutex);
  /* kill dns pthread */
  active_gdns = 0;
  free_holder (&holder);
  gdns_free_queue ();

  /* free uniqmap */
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  for (module = 0; module < TOTAL_MODULES; module++) {
    free_db_key (get_storage_metric (module, MTRC_UNIQMAP));
  }
#endif
  free_storage ();

  pthread_mutex_unlock (&gdns_thread.mutex);

  /* DASHBOARD */
  if (dash && !conf.output_html) {
    free_dashboard (dash);
    reset_find ();
  }

  /* GEOLOCATION */
#ifdef HAVE_LIBGEOIP
  if (geo_location_data != NULL)
    GeoIP_delete (geo_location_data);
#endif

  /* LOGGER */
  free (logger);

  /* CONFIGURATION */
  if (conf.debug_log) {
    LOG_DEBUG (("Bye.\n"));
    dbg_log_close ();
  }
  free_cmd_args ();
}
Exemple #11
0
char *
get_root_from_key (int root_nkey, GModule module)
{
  GHashTable *ht = NULL;
  gpointer value_ptr;

  ht = get_storage_metric (module, MTRC_ROOTMAP);
  if (ht == NULL)
    return NULL;

  value_ptr = g_hash_table_lookup (ht, &root_nkey);
  if (value_ptr != NULL)
    return xstrdup ((char *) value_ptr);

  return NULL;
}
Exemple #12
0
char *
get_root_from_key (int root_nkey, GModule module)
{
  TCADB *adb = NULL;
  void *value_ptr;
  int sp = 0;

  adb = get_storage_metric (module, MTRC_ROOTMAP);
  if (adb == NULL)
    return NULL;

  value_ptr = tcadbget (adb, &root_nkey, sizeof (int), &sp);
  if (value_ptr != NULL)
    return (char *) value_ptr;

  return NULL;
}
Exemple #13
0
/* allocate memory for an instance of holder */
static void
allocate_holder_by_module (GModule module)
{
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  TCADB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GRawData *raw_data;
  unsigned int ht_size = 0;

  /* extract data from the corresponding hash table */
  ht = get_storage_metric (module, MTRC_HITS);
  ht_size = get_ht_size (ht);
  raw_data = parse_raw_data (ht, ht_size, module);
  load_holder_data (raw_data, holder + module, module, module_sort[module]);
}
Exemple #14
0
/* allocate memory for an instance of holder */
static void
allocate_holder (void)
{
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  TCADB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GModule module;
  GRawData *raw_data;
  unsigned int ht_size = 0;

  holder = new_gholder (TOTAL_MODULES);
  for (module = 0; module < TOTAL_MODULES; module++) {
    /* extract data from the corresponding hits hash table */
    ht = get_storage_metric (module, MTRC_HITS);

    ht_size = get_ht_size (ht);
    raw_data = parse_raw_data (ht, ht_size, module);
    load_holder_data (raw_data, holder + module, module, module_sort[module]);
  }
}