7

Hello I would like to enquire if there is an API that can be used to retrieve Ganglia stats for all clients from a single ganglia server?

laycat
  • 5,381
  • 7
  • 31
  • 46

3 Answers3

13

The Ganglia gmetad component listens on ports 8651 and 8652 by default and replies with XML metric data. The XML data type definition can be seen on GitHub here.

Gmetad needs to be configured to allow XML replies to be sent to specific hosts or all hosts. By default only localhost is allowed. This can be changed in /etc/ganglia/gmetad.conf.

Connecting to port 8651 will get you a default XML report of all metrics as a response.

Port 8652 is the interactive port which allows for customized queries. Gmetad will recognize raw text queries sent to this port, i.e. not HTTP requests.

Here are examples of some queries:

  • /?filter=summary (returns a summary of the whole grid, i.e. all clusters)
  • /clusterName (returns raw data of a cluster called "clusterName")
  • /clusterName/hostName (returns raw data for host "hostName" in cluster "clusterName")
  • /clusterName?filter=summary (returns a summary of only cluster "clusterName")

The ?filter=summary parameter changes the output to contain the sum of each metric value over all hosts. The number of hosts is also provided for each metric so that the mean value may be calculated.

mmajis
  • 545
  • 4
  • 10
  • I configured the ganglia to provide data for rest api calls. I call this url: http://:8080/ganglia/api/v1/metrics? This only returns data for 6 hosts. I have over 100 hosts on that server. Any ideas what might be happening? How would I query so that I receive data for all the hosts from the ganglia? – user1471980 Sep 23 '14 at 12:49
9

Yes, there's an API for Ganglia: https://github.com/guardian/ganglia-api

You should check this presentation from 2012 Velocity Europe - it was really a great talk: http://www.guardian.co.uk/info/developer-blog/2012/oct/04/winning-the-metrics-battle

Maciej Lasyk
  • 101
  • 4
0

There is also an API you can install from pypi with 'pip install gangliarest' and sets up a configurable API backed with a Redis cache and indexer to improve performance.

https://pypi.python.org/pypi/gangliarest