File: gmond_internal.h

package info (click to toggle)
ganglia 3.6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 6,484 kB
  • ctags: 3,880
  • sloc: ansic: 27,874; sh: 11,052; python: 6,695; makefile: 565; perl: 366; php: 126; xml: 28
file content (79 lines) | stat: -rw-r--r-- 2,207 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/** @file gmond_internal.h
 *  @brief expose just enough of gmond internals to allow tightly-coupled receivers (such as sflow.c) to submit metrics
 *  @author Neil McKee */

#ifndef GMOND_INTERNAL_H
#define GMOND_INTERNAL_H

/* If we use autoconf.  */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#ifdef SOLARIS
#define fabsf(f) ((float)fabs(f))
#endif
#ifdef _AIX
#ifndef _AIX52
/* _AIX52 is defined on all versions of AIX >= 5.2
   fabsf doesn't exist on versions prior to 5.2 */
#define fabsf(f) ((float)fabs(f))
#endif
#endif

#include <apr.h>
#include <apr_strings.h>
#include <apr_hash.h>
#include <apr_time.h>
#include <apr_pools.h>
#include <apr_poll.h>
#include <apr_network_io.h>
#include <apr_signal.h>       
#include <apr_thread_proc.h>  /* for apr_proc_detach(). no threads used. */
#include <apr_tables.h>
#include <apr_dso.h>
#include <apr_version.h>

/* The "hosts" hash contains values of type "hostdata" */
struct Ganglia_host {
  /* Name of the host */
  char *hostname;
  /* The IP of this host */
  char *ip;
  /* The location of this host */
  char *location;
  /* Timestamp of when the remote host gmond started */
  unsigned int gmond_started;
  /* The pool used to malloc memory for this host */
  apr_pool_t *pool;
  /* A hash containing the full metric data from the host */
  apr_hash_t *metrics;
  /* A hash containing the last data update from the host */
  apr_hash_t *gmetrics;
  /* First heard from */
  apr_time_t first_heard_from;
  /* Last heard from */
  apr_time_t last_heard_from;
  /* Thread mutex */
  apr_thread_mutex_t *mutex;
#ifdef SFLOW
  struct _SFlowAgent *sflow;
#endif
};
typedef struct Ganglia_host Ganglia_host;

Ganglia_host *Ganglia_host_get( char *remIP, apr_sockaddr_t *sa, Ganglia_metric_id *metric_id);

void Ganglia_metadata_save( Ganglia_host *host, Ganglia_metadata_msg *message );
void Ganglia_value_save( Ganglia_host *host, Ganglia_value_msg *message );
void Ganglia_update_vidals( Ganglia_host *host, Ganglia_value_msg *vmsg);
void Ganglia_metadata_check(Ganglia_host *host, Ganglia_value_msg *vmsg );

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GMOND_INTERNAL_H */