Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 54 lines (40 sloc) 1.338 kB
11a5d59 @igrigorik update readme with group example
authored
1 # GMetric
2
3 A pure Ruby client for generating Ganglia 3.1.x+ gmetric meta and metric packets and talking to your gmond / gmetad nodes over UDP protocol. Supports host spoofing, and all the same parameters as the gmetric command line executable.
4
5 [http://www.igvita.com/2010/01/28/cluster-monitoring-with-ganglia-ruby/](http://www.igvita.com/2010/01/28/cluster-monitoring-with-ganglia-ruby/)
6
7 ## Example: Sending a gmetric to a gmond over UDP
8
9 ```ruby
10 Ganglia::GMetric.send("127.0.0.1", 8670, {
11 :name => 'pageviews',
12 :units => 'req/min',
13 :type => 'uint8',
14 :value => 7000,
15 :tmax => 60,
16 :dmax => 300,
6d82a91 @igrigorik fix formatting in example
authored
17 :group => 'test'
11a5d59 @igrigorik update readme with group example
authored
18 })
713198b @evilensky Update README.md
evilensky authored
19 ```
11a5d59 @igrigorik update readme with group example
authored
20 ## Example: Generating the Meta and Metric packets
21
22 ```ruby
23 g = Ganglia::GMetric.pack(
24 :slope => 'positive',
25 :name => 'ruby',
26 :value => rand(100),
27 :tmax => 60,
28 :units => '',
29 :dmax => 60,
30 :type => 'uint8'
31 )
32
33 # g[0] = meta packet
34 # g[1] = gmetric packet
35
36 s = UDPSocket.new
37 s.connect("127.0.0.1", 8670)
38 s.send g[0], 0
39 s.send g[1], 0
40 ```
41
3bbb9fb fix formating
Ilan Rabinovitch authored
42 ## Spoofing a hostname in gmetrics ##
43
e19fdcd document how to spoof
Ilan Rabinovitch authored
44 To spoof a hostname with the gmetric library you will need to add the following keys to your gmetric.
45 This works with both GMetric.send() and GMetric.pack().
46
47 * spoof - takes a value of 1 or True
3bbb9fb fix formating
Ilan Rabinovitch authored
48 * hostname - expects a value of ip_address:hostname.
e19fdcd document how to spoof
Ilan Rabinovitch authored
49
50
11a5d59 @igrigorik update readme with group example
authored
51 ### License
52
6d82a91 @igrigorik fix formatting in example
authored
53 The MIT License, Copyright (c) 2009 Ilya Grigorik
Something went wrong with that request. Please try again.