GRAY background for the commands to execute (cut&paste)
GREEN background for the output sample of the executed commands
BLUE background for the configuration files (cut&paste)
#!/bin/bash yum -y install ganglia ganglia-gmond httpd php ganglia-gmetad ganglia-web # Modify Apache configuration to define incoming accesses to the web-frontend sed -i "s/<\/Location>/ Allow from cern.ch\n <\/Location>/g" /etc/httpd/conf.d/ganglia.conf # Configuring the firewall might be needed, mostly for Apache. This depends on the system's local configurations # If the headnode is within a private network and the nodes are outside, public firewall authorizations are needed as well setsebool httpd_can_network_connect 1 chkconfig gmond on service httpd restart service gmond restart service gmetad restart
#!/bin/bash yum -y install ganglia ganglia-gmond chkconfig gmond on service gmond restart
Red —
= UDP connectionsBlue —
= TCP connections This is Ganglia's default layout. The standard gmond installation (as stated above) will provide this multicast broadcasting mechanism between VM's by default. While gmond uses multicast channels in a peer-to-peer way, gmetad pulls the XML description from Ganglia data sources (normally these data sources are one or more VM's within the same pool) via XML over unicast routes. In this case there's only the need to change gmetad configuration in the headnode. This is done through the file /etc/ganglia/gmetad.conf. Open this file#!/bin/bash vim /etc/ganglia/gmetad.confand add the data sources
# comment the default data_source # data_source "another source" 1.3.4.7:8655 1.3.4.8 data_source "Cloud A" a1.domain:port1 ax.domain:portx # Redundancy is allowed # (same for Cloud B and Cloud C...etc) # other configurations can be added but their are not essential for a good Ganglia behavior in multicastNOTE: it is good practice to change the cluster name in gmond as well, to be the same as the one referred in gmetad configuration. Here's some points worth considering when using multicast: Advantages
Red —
= UDP connectionsBlue —
= TCP connections Another way of setting up Ganglia is through unicast instead of multicast. Unicast means that every gmond will report its metric directly with an endpoint, instead of broadcasting this information to every gmond on its network. The official documentation suggests that to do this, we make use of a (one or more) receiving gmond to where all the other nodes report to and from where the gmetad get the data from. These receiving gmonds act like intermediate collectors, and the machine where they are running are the ones which should be mentioned as data sources in gmetad. For the above scheme here's how we would configure Ganglia: In the headnode#!/bin/bash vim /etc/ganglia/gmetad.conf
# comment the default data_source # data_source "another source" 1.3.4.7:8655 1.3.4.8 data_source "Cloud A" a1.domain:port1 # (same for Cloud B and Cloud C...etc)Now, the difference is in the nodes,
#!/bin/bash vim /etc/ganglia/gmond.conf
udp_send_channel { #mcast_join = 239.2.11.72 host = a1.domain port = port1 ttl = 1 } /* You can specify as many udp_recv_channels as you like as well. */ udp_recv_channel { #mcast_join = 239.2.11.72 port = port1 bind = 239.2.11.71 }A good question is: is there a difference between the reporting gmonds and the receiving ones? Yes, BUT, it is a non-crucial difference for the system behavior. Basically, in the reporting nodes, the channels "udp_recv_channel" and "tcp_accept_channel" can be left empty. NOTE: it is good practice to change the cluster name in gmond as well, to be the same as the one referred in gmetad configuration. A quick evaluation in this configuration can be made by looking at the following points: Advantages
Red —
= UDP connectionsBlue —
= TCP connections A recurring disadvantage of the past two configurations is the lifetime of the gmond nodes within a cloud environment, which leads to constant changes in the headnode and other nodes. For this reasons there is one small modification which can be made to the common unicast deployment which is moving the receiving gmond node outside the working environment and make it a dedicated collector&sender server. The configuration for gmond in this dedicated machine is exactly the same as shown in the common unicast example above. AdvantagesRed —
= UDP connectionsBlue —
= TCP connections This layout is a custom version of the above, where some of the disadvantages are hereby eliminated. Considering the disadvantages of using multicast and baring in mind that this document mainly focus on Cloud environments, unicast is the way to go. In the previous unicast scheme it was noticed that having an "middleman" gmond would basically harm as much as using multicast, since gmetad would still be collecting the data from a dedicated node. Basically, keeping a dedicated node inside a Cloud (or even outside) is a waste of resources and money. This approach without the receiving gmond makes use of the headnode to collect all the data from all clusters. It is basically a moving of the "middleman" gmond from the previous layout to the headnode. What happens here is that, the gmond nodes will still behave as before, but now there will be a gmond configuration in the headnode as well. Technically speaking, in the headnode:#!/bin/bash vim /etc/ganglia/gmetad.conf
# comment the default data_source # data_source "another source" 1.3.4.7:8655 1.3.4.8 data_source "Cloud A" localhost:port1 data_source "Cloud B" localhost:port2 # etcand now, by adding new gmond configuration files in the same machine we're saying that this is where all the data should coming directly to.
#!/bin/bash vim /etc/ganglia/gmond_cloudA.conf
cluster { name = "Cloud A" owner = "unspecified" latlong = "unspecified" url = "unspecified" } /* The host section describes attributes of the host, like the location */ host { location = "unspecified" } udp_send_channel { host = localhost port = port1 ttl = 1 } udp_recv_channel { port = port1 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = port1 }
#!/bin/bash vim /etc/ganglia/gmond_cloudB.conf
cluster { name = "Cloud B" owner = "unspecified" latlong = "unspecified" url = "unspecified" } /* The host section describes attributes of the host, like the location */ host { location = "unspecified" } udp_send_channel { host = localhost port = port2 ttl = 1 } udp_recv_channel { port = port2 } /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ tcp_accept_channel { port = port2 }Then, finally, there's just the need to daemonize these new gmond configurations and restart gmetad:
#!/bin/bash . /etc/rc.d/init.d/functions daemon gmond -c gmond_cloudA.conf daemon gmond -c gmond_cloudB.conf service gmetad restartIn the Cloud nodes, the gmond configuration will be exactly the same as in the regular unicast example, being the host endpoint parameter the only thing in need of changing. Advantages
Black —
= TCP connections One very practical example is to create a layer on top of other gmetads. Usually one headnode monitors multiple clusters. This kind of setup can be called a Grid. Once one has multiple Grids, it is possible to deploy another gmetad on top of the existing ones, creating a "Grid-of-Grids", where each gmetad will answer requests for XML through a specific port (8651 by default). To configure this layout one should:# List of machines this gmetad will share XML with. Localhost # is always trusted. # default: There is no default value trusted_hosts 127.0.0.1 top-level-gmetad.domain
#!/bin/bash vim /etc/ganglia/gmetad.conf
#... # data_source "another source" 1.3.4.7:8655 1.3.4.8 data_source "gmetad1 grid" gmetad1.domain:8651 data_source "gmetad2 grid" gmetad2.domain:8651 # # Round-Robin Archives # You can specify custom Round-Robin archives here (defaults are listed below) #... # The name of this Grid. All the data sources above will be wrapped in a GRID # tag with this name. # default: unspecified gridname "MyGridofGrids" #... #------------------------------------------------------------------------------- # If you want any host which connects to the gmetad XML to receive # data, then set this value to "on" # default: off all_trusted on #... #...Please note what is said in gmetad configuration
# The data_source tag specifies either a cluster or a grid toAdvantages
# monitor. If we detect the source is a cluster, we will maintain a complete
# set of RRD databases for it, which can be used to create historical
# graphs of the metrics. If the source is a grid (it comes from another gmetad),
# we will only maintain summary RRDs for it.
#!/bin/bash vim /etc/ganglia/gmond.conf
udp_send_channel { host = g1.domain port = port1 ttl = 1 } udp_send_channel { host = g2.domain port = port2 ttl = 1 }
#!/bin/bash vim /etc/ganglia/gmond.conf
udp_send_channel { host = gmetadx.domain port = portx ttl = 1 }
#!/bin/bash vim /etc/ganglia/gmetad.conf
#... data_source "gx" gx.domain:portx #Advantages
#!/bin/bash vim /etc/ganglia/gmond.conf
udp_send_channel { host = gmetad1.domain port = port1 ttl = 1 } udp_send_channel { host = gmetad2.domain port = port2 ttl = 1 }
#!/bin/bash vim /etc/ganglia/gmetad.conf
#... data_source "g1" g1.domain:portx #Advantages
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
Ganglia_Deployment_Guide.pdf | r1 | manage | 98.1 K | 2014-03-25 - 14:43 | CristovaoCordeiro | Ganglia deployment guide for the unicast (without middle gmond) method |