#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ganglia.h> /* for the libgmond messaging */
#include <gm_metric.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <math.h>
#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
#ifdef LINUX
#include <sys/utsname.h>
#endif
#include <zlib.h>
#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>
#include <apr_tables.h>
#include <apr_dso.h>
#include <apr_version.h>
#ifdef HAVE_LIBPCRE
#if defined (HAVE_PCRE_PCRE_H)
#include <pcre/pcre.h>
#else
#include <pcre.h>
#endif
#endif
#include "cmdline.h" /* generated by cmdline.sh which runs gengetopt */
#include "become_a_nobody.h"
#include "apr_net.h" /* our private network functions based on apr */
#include "dtd.h" /* the DTD definition for our XML */
#include "g25_config.h" /* for converting old file formats to new */
#include "update_pidfile.h"
#include "gm_scoreboard.h"
#include "ganglia_priv.h"
/* Specifies a single value metric callback */
#define CB_NOINDEX -1
/* If a bind fails, and retry_bind is true, this is the interval to sleep
before retry. Specified in seconds */
#define RETRY_BIND_DELAY 60
/* The key in the apr_socket_t struct where our gzipped data is stored */
#define GZIP_KEY "gzip"
/* When this gmond was started */
apr_time_t started;
/* My name */
char myname[APRMAXHOSTLEN+1];
/* The commandline options */
struct gengetopt_args_info args_info;
/* The configuration file */
cfg_t *config_file;
/* The debug level (in debug_msg.c) */
static int debug_level;
/* The global context */
apr_pool_t *global_context = NULL;
/* Deaf mode boolean */
int deaf;
/* Mute mode boolean */
int mute;
/* Allow extra data boolean */
int allow_extra_data;
/* last time we received any data */
apr_time_t udp_last_heard;
/* Cluster tag boolean */
int cluster_tag = 0;
/* This host's location */
char *host_location = NULL;
/* This host name, spoofed */
char *override_hostname = NULL;
/* This host ip, spoofed */
char *override_ip = NULL;
/* Tags */
char *tags = NULL;
/* Boolean. Will this host received gexec requests? */
int gexec_on = 0;
/* This is tweakable by globals{max_udp_msg_len=...} */
int max_udp_message_len = 1472;
/* The default configuration for gmond. Found in conf.c. */
extern char *default_gmond_configuration;
/* The number of seconds to hold "dead" hosts in the hosts hash */
int host_dmax = 0;
/* The number of seconds to wait for a message before considering it down */
int host_tmax = 20;
/* The amount of time between cleanups */
int cleanup_threshold = 300;
/* Time interval before send another metadata packet */
int send_metadata_interval = 0;
/* The directory where DSO modules are located */
char *module_dir = NULL;
/* The array for outgoing UDP message channels */
Ganglia_udp_send_channels udp_send_channels = NULL;
/* TODO: The array for outgoing TCP message channels (later) */
apr_array_header_t *tcp_send_array = NULL;
enum Ganglia_action_types {
GANGLIA_ACCESS_DENY = 0,
GANGLIA_ACCESS_ALLOW = 1
};
typedef enum Ganglia_action_types Ganglia_action_types;
/* This is the structure used for the access control lists */
struct Ganglia_access {
apr_ipsubnet_t *ipsub;
Ganglia_action_types action;
};
typedef struct Ganglia_access Ganglia_access;
struct Ganglia_acl {
apr_array_header_t *access_array;
Ganglia_action_types default_action;
};
typedef struct Ganglia_acl Ganglia_acl;
/* This is the channel definitions */
enum Ganglia_channel_types {
TCP_ACCEPT_CHANNEL,
UDP_RECV_CHANNEL
};
typedef enum Ganglia_channel_types Ganglia_channel_types;
struct Ganglia_channel {
Ganglia_channel_types type;
Ganglia_acl *acl;
int timeout;
int gzip_output;
};
typedef struct Ganglia_channel Ganglia_channel;
/* Two separate pollsets hold the tcp_accept and udp_recv channels */
apr_pollset_t *udp_listen_channels = NULL;
apr_pollset_t *tcp_listen_channels = NULL;
/* These are the TCP listen channels */
apr_socket_t **tcp_sockets = NULL;
/* These are the UDP sockets */
apr_socket_t **udp_recv_sockets = NULL;
/* The hash to hold the hosts (key = host IP) */
apr_hash_t *hosts = NULL;
apr_thread_mutex_t *hosts_mutex = NULL;
/* The "hosts" hash contains values of type "hostdata" */
#ifdef SFLOW
#include "sflow.h"
uint16_t sflow_udp_port = SFLOW_IANA_REGISTERED_PORT;
#endif
#include "gmond_internal.h"
/* This is the structure of the data save to each host->metric hash */
struct Ganglia_metadata {
/* The pool used for allocating memory */
apr_pool_t *pool;
/* The name of the metric */
char *name;
union {
/* The ganglia message */
Ganglia_metadata_msg f_message;
Ganglia_value_msg v_message;
} message_u;
/* Last heard from */
apr_time_t last_heard_from;
};
typedef struct Ganglia_metadata Ganglia_metadata;
/* The hash to hold the metrics available on this platform */
apr_hash_t *metric_callbacks = NULL;
/* The "metrics" hash contains values of type "Ganglia_metric_callback" */
/* This is where libmetrics meets gmond */
struct Ganglia_metric_callback {
char *name; /* metric name */
float value_threshold;/* the value threshold */
char *title; /* Altername metric name or short description */
Ganglia_25metric *info;/* the information about this metric */
metric_func_void cb; /* callback function (deprecated) */
metric_func cbindexed; /* multi-metric callback function */
g_val_t now; /* the current value */
g_val_t last; /* the last value */
Ganglia_value_msg msg; /* the message to send */
mmodule *modp; /* dynamic module info struct */
int multi_metric_index; /* index identifying which metric is wanted */
apr_time_t metadata_last_sent; /* when the metadata was last sent */
};
typedef struct Ganglia_metric_callback Ganglia_metric_callback;
/* This is the structure of a collection group */
struct Ganglia_collection_group {
apr_time_t next_collect; /* When to collect next */
apr_time_t next_send; /* When to send next (tmax) */
int once;
int collect_every;
int time_threshold;
apr_array_header_t *metric_array;
};
typedef struct Ganglia_collection_group Ganglia_collection_group;
/* This is the array of collection groups that we are processing... */
apr_array_header_t *collection_groups = NULL;
mmodule *metric_modules = NULL;
extern int daemon_proc; /* defined in error.c */
char **gmond_argv;
extern char **environ;
/* apr_socket_send can't assure all characters in buf been sent. */
static apr_status_t
socket_send_raw(apr_socket_t *sock, const char *buf, apr_size_t *len)
{
apr_size_t total = *len;
apr_size_t thisTime = total;
const char* p = buf;
apr_status_t ret;
for(ret=apr_socket_send(sock, p, &thisTime); ret == APR_SUCCESS;
ret=apr_socket_send(sock, p, &thisTime))
{
if(thisTime < total)
{
total -= thisTime;
p += thisTime;
thisTime = total;
}
else
break;
}
return ret;
}
/* wrap socket_send_raw with gzip deflate if enabled. */
static apr_status_t
socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
{
char outputbuffer[2048];
const int outputlen = sizeof(outputbuffer);
apr_size_t wlen;
apr_status_t ret;
z_stream *strm;
int z_ret;
ret = apr_socket_data_get((void**)&strm, GZIP_KEY, sock);
if (ret != APR_SUCCESS)
{
return ret;
}
if (!strm)
{
ret = socket_send_raw( sock, buf, len );
}
else
{
strm->next_in = (Bytef *)buf;
strm->avail_in = *len;
while( strm->avail_in )
{
strm->next_out = (Bytef *)outputbuffer;
strm->avail_out = outputlen;
z_ret
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共725个文件
o:90个
in:76个
c:72个
ganglia 3.7.2 基于centos7可安装rpm包(rpmbuild/RPMS/x86_64目录中) 配合ganglia-web-3.7.2.tar.gz使用 参考:https://blog.csdn.net/lswnew/article/details/79175539
资源推荐
资源详情
资源评论
收起资源包目录
ganglia 3.7.2 基于centos7可安装rpm包 (725个子文件)
libganglia.so.0.0.0 322KB
libganglia.so.0 322KB
gmetric.1 3KB
gmond.1 3KB
gstat.1 2KB
gmetad.1 2KB
gmetad.py.1 1KB
gmond.conf.5 29KB
libganglia.a 517KB
modcpu.a 159KB
modmem.a 158KB
modsys.a 157KB
modnet.a 156KB
moddisk.a 156KB
modload.a 156KB
modproc.a 156KB
libmetrics.a 140KB
libmetric25.a 107KB
modpython.a 88KB
modmulticpu.a 49KB
modgstatus.a 22KB
modexample.a 19KB
libgetopthelper.a 10KB
configure.ac 31KB
configure.ac 4KB
ganglia.spec.aix 6KB
README.AIX 5KB
Makefile.am 3KB
Makefile.am 3KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 978B
Makefile.am 970B
Makefile.am 866B
Makefile.am 799B
Makefile.am 625B
Makefile.am 610B
Makefile.am 465B
Makefile.am 459B
Makefile.am 451B
Makefile.am 450B
Makefile.am 432B
Makefile.am 419B
Makefile.am 408B
Makefile.am 383B
Makefile.am 228B
Makefile.am 169B
Makefile.am 165B
Makefile.am 165B
Makefile.am 121B
Makefile.am 121B
Makefile.am 121B
Makefile.am 121B
Makefile.am 116B
Makefile.am 109B
Makefile.am 109B
Makefile.am 109B
Makefile.am 109B
Makefile.am 109B
Makefile.am 109B
Makefile.am 101B
Makefile.am 97B
Makefile.am 63B
Makefile.am 63B
Makefile.am 62B
Makefile.am 54B
Makefile.am 51B
Makefile.am 43B
Makefile.am 39B
Makefile.am 39B
Makefile.am 39B
Makefile.am 38B
Makefile.am 38B
Makefile.am 38B
Makefile.am 38B
Makefile.am 37B
Makefile.am 37B
Makefile.am 24B
AUTHORS 170B
AUTHORS 72B
bootstrap 418B
BUGS 100B
buildpkg 3KB
gmond.c 111KB
sflow.c 77KB
process_xml.c 43KB
server.c 41KB
metrics.c 35KB
getopt.c 33KB
dotconf.c 33KB
metrics.c 33KB
metrics.c 33KB
metrics.c 29KB
metrics.c 28KB
libgmond.c 26KB
mod_python.c 25KB
metrics.c 24KB
cmdline.c 24KB
metrics.c 23KB
export_helpers.c 22KB
共 725 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- love131358162018-11-27正好集群不能访问外网 需要
蜗牛756
- 粉丝: 8
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功