ganglia XDR(eXternal Data Representation) protocol

XDR is a binary protocol that is used by not only gmetric but also gmond itself to pass
metric packets from one instance to another. The XDR protocol can also be used to
insert metric packets into the metric stream by a third-party utility. In fact, gmetric is
a good example of how the XDR protocol can be used in this manner. gmetric, being
an external utility, uses the XDR protocol to submit metrics directly to a gmond instance
in the form of a binary packet. The metric information is submitted as a series of two
UDP packets: one containing metadata regarding the metric in question, and a second
packet containing the metric value. Table 5-3explains the lower-level format of XDR
integer and string values. See Table 5-4and Table 5-5for descriptions of the metadata
and value formats.

gmetric, gmond都是通过xdr协议发送监控的消息包的, 包含metadata, data packet.

详见 : 

Types

Type    Representation
INT          Integer values in XDR are represented as a series of four sequential 8-bit values that, taken together,
             form a single 32-bit integer value. The value is ordered high byte to low byte.
STRING       String values in XDR are represented as an integer XDR “length” value, being the length of the target
                     string followed by a series of characters forming the string. These values are padded to a string length
                     that is a multiple of 4 by 0 byte values. Null string values are represented as a zero-length value,
                     followed by four 0 bytes.

Metadata packet : 

Name            Type          Value
Packet type       INT           “gmetadata_full”, represented as 128
Hostname       STRING       Source hostname for this metric. This should be represented in “spoof” form (IP address
                             + “:” + hostname) if the packet represents spoofed data.
Metric name        STRING       Textual name of the metric presented. Any nonalphanumeric characters will be translated                                                            into underscore characters by gmond in modern versions of the monitoring core.
Spoof              INT       1 if the packet is being spoofed, 0 if it is not a spoofed packet.
Type representation
                       STRING       One of the following: unknown, string, uint16, int16, uint32, int32, float, double.
Metric name            STRING       Repetition of the earlier metric name field.
Units         STRING         Textual name of the units being used for this metric.
Slope         INT                  ? 0: zero slope
                                   ? 1: positive slope (creates a COUNTER style metric)
                                   ? 2: negative slope
                                   ? 3: both (should be the default for most metrics)
                                   ? 4: unspecified
tmax        INT        Maximum time in seconds between gmetric values submitted. The minimum value of
                       this should be 60.
dmax       INT         Lifetime in seconds of this metric. 0 indicates an unlimited lifetime.
Extra data qualifier           INT       This “magic” value specifies how many repetitions of the two following values are in
                                                      the packet. Most packets contain at least a GROUP value, if not a SPOOF_NAME one.
                                                     This value can be 0 if there are no additional extra data values being passed.
Extra data name
(repeats)
                                   STRING                 Additional data name to be submitted with this packet. Common keys are “GROUP”
                                                                  and “SPOOF_NAME”.
Extra data value
(repeats)
                                    STRING                  Corresponding value for extra data.

Value packet : 

Name                Type                 Value
Packet type         INT                   133 (128 + 5)
Hostname            STRING           Should match the hostname in the preceding metadata packet.
Metric name         STRING           Should match the metric name in the preceding metadata packet.
Spoof               INT                  Should match the spoof value in the preceding metadata packet.
Format string       STRING             “%s”.     Note: ideally, this should be the printf/scanf-style format of the value being
                                                    passed, but in reality, all are presently passed as string values, and are then converted
                                                    to their specified types by gmond.
Metric value         STRING        Reported metric value.

Packets

A  metadata packet is an XDR packet that contains the definition of an individual metric.
Before a metric can be understood and viewed by the Ganglia monitoring system, its
metadata must have been communicated throughout the system by a metadata packet.
When an instance of gmond is started, the first thing it does is send a metadata packet
over the network for each metric for which it intends to provide a value. If the configuration directive,  send_metadata_interval, is set to a positive value, the instance of
gmond will resend each metric’s metadata according to the interval value.
A value packet contains only enough information to communicate a metric value. In
order to reduce the amount of data that an instance of gmond produces, the actual metric values are communicated through a much smaller packet, which allows gmond
to communicate the much larger metric metadata on an as-needed basis while maintaining a very small footprint when communicating metric values.

[参考]
1. http://blog.163.com/digoal@126/blog/static/1638770402014819102825333/

时间: 2024-08-17 03:12:05

ganglia XDR(eXternal Data Representation) protocol的相关文章

data representation layer

 上个周末我去了一个技术的沙龙,主要的内容是关于开源软件框架应用与软件架构.很有意思的一个讲座以后还要再去听.目前我国的软件有很多的平台和编程语言,比如.net  j2ee等,在每个语言里面还有相应的框架,比如struts,aop...我们的编程一般不用从头开始,而是运用某一种平台,给予某一种框架,进行开发,现在的框架比较多,也不能都应用,在应用中要注意的问题就是,最好直接继承自pojo对象,我们用起来直接用就好,而不用实现他的某一个特定的接口. 在o/r mapping的层面上,有几个比较好的

ganglia - distributed monitor system

传统的监控系统, 通常采用agent+server的方式, agent负责收集监控信息, 主动或被动发送给server, server负责向agent请求监控数据(agent被动), server和agent都通常使用TCP来进行连接.  传统监控的主要弊端, 当被监控的主机很多的情况下, server端的压力会很大, 例如要监控2万台主机的30个监控项, 就有60万个监控数据要从agent收集, 假设每分钟收集一次监控数据, 每秒需要上千次的metric get请求.  ganglia的设计思

【工具】ganglia 监控技术分析

    Ganglia是一个分布式的监控工具,用来对Grid和Cluster上面的节点进行监控,利用它提供的web界面可以看到每个节点状态,并且可以输出图形化的表示. Ganglia 是 UC Berkeley 发起的一个开源监视项目,设计用于测量数以千计的节点.每台计算机都运行一个收集和发送度量数据(如处理器速度.内存使用量等)的名为 gmond 的守护进程.它将从操作系统和指定主机中收集.接收所有度量数据的主机可以显示这些数据并且可以将这些数据的精简表单传递到层次结构中.正因为有这种层次结构

GO语言的开源库

Indexes and search engines These sites provide indexes and search engines for Go packages: godoc.org gowalker gosearch Sourcegraph Contributing To edit this page you must be a contributor to the go-wiki project. To get contributor access, send mail t

大话存储系列15——NFS 和 CIFS 文件系统

1.NFS 文件系统 本文整理自:http://www.ibm.com/developerworks/cn/linux/l-cn-nfs/index.html?ca=drs- Sun公司估计现在大约有超过310万个系统在运行NFS,大到大型计算机.小至PC机,其中至少有80%的系统是非Sun平台.NFS是由SUN公司发展, 并於1984年推出, NFS是一个RPC service ,它使我们能够达到档案的共享, 它的设计是为了在不同的系统间使用, 所以它的通讯协定设计与主机及作业系统无关.当使用

RPC、RMI、SOAP的区别详解_其它综合

============================================================================RPC与RMI的区别 ============================================================================RPC:(Remote Procedure Call) 被设计为在应用程序间通信的平台中立的方式,它不理会操作系统之间以及语言之间的差异. 支持多语言. RMI:(Remot

The Log: What every software engineer should know about real-time data's unifying abstraction

主要的思想,  将所有的系统都可以看作两部分,真正的数据log系统和各种各样的query engine  所有的一致性由log系统来保证,其他各种query engine不需要考虑一致性,安全性,只需要不停的从log系统来同步数据,如果数据丢失或crash可以从log系统replay来恢复  可以看出kafka系统在linkedin中的重要地位,不光是data aggregation,而是整个系统的核心 Part One: What Is a Log? log定义 很简单的结构,最关键的属性是,

【原创】什么是 wire protocol

究竟 wire protocol 是指什么?下面这段话可以比较清楚的解释(原本来自 这里 ).  In a network, a wire protocol is the mechanism for transmitting data from point a to point b. The term is a bit confusing, because it sounds like layer 1 of the network, which physically places the bit

.NET 对 J2EE[2]

j2ee Picking a Winner: .NET vs. J2EE Although both frameworks stand on a foundation of programming languages, object models and virtual machines, they are strikingly different when you consider the design goals of their runtime environment. The Java