4
# * Licensed to the Apache Software Foundation (ASF) under one
5
# * or more contributor license agreements. See the NOTICE file
6
# * distributed with this work for additional information
7
# * regarding copyright ownership. The ASF licenses this file
8
# * to you under the Apache License, Version 2.0 (the
9
# * "License"); you may not use this file except in compliance
10
# * with the License. You may obtain a copy of the License at
12
# * http://www.apache.org/licenses/LICENSE-2.0
14
# * Unless required by applicable law or agreed to in writing, software
15
# * distributed under the License is distributed on an "AS IS" BASIS,
16
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
# * See the License for the specific language governing permissions and
18
# * limitations under the License.
23
# Slurp in all our user-customizable settings.
24
source ./gangliaEnv.sh;
26
# Get access to Ganglia-wide constants etc.
27
source ./gangliaLib.sh;
29
GMOND_BIN=/usr/sbin/gmond;
30
GMOND_CORE_CONF_FILE=gmond.core.conf;
31
GMOND_MASTER_CONF_FILE=gmond.master.conf;
32
GMOND_SLAVE_CONF_FILE=gmond.slave.conf;
33
GMOND_PID_FILE=gmond.pid;
36
function getGmondCoreConfFileName()
40
if [ "x" != "x${clusterName}" ]
42
# ${clusterName} is not empty.
43
echo "${GANGLIA_CONF_DIR}/${clusterName}/${GMOND_CORE_CONF_FILE}";
45
echo "${GANGLIA_CONF_DIR}/${GMOND_CORE_CONF_FILE}";
49
function getGmondMasterConfFileName()
53
if [ "x" != "x${clusterName}" ]
55
# ${clusterName} is not empty.
56
echo "${GANGLIA_CONF_DIR}/${clusterName}/conf.d/${GMOND_MASTER_CONF_FILE}";
58
echo "${GANGLIA_CONF_DIR}/conf.d/${GMOND_MASTER_CONF_FILE}";
62
function getGmondSlaveConfFileName()
66
if [ "x" != "x${clusterName}" ]
68
# ${clusterName} is not empty.
69
echo "${GANGLIA_CONF_DIR}/${clusterName}/conf.d/${GMOND_SLAVE_CONF_FILE}";
71
echo "${GANGLIA_CONF_DIR}/conf.d/${GMOND_SLAVE_CONF_FILE}";
75
function getGmondPidFileName()
79
if [ "x" != "x${clusterName}" ]
81
# ${clusterName} is not empty.
82
echo "${GANGLIA_RUNTIME_DIR}/${clusterName}/${GMOND_PID_FILE}";
84
echo "${GANGLIA_RUNTIME_DIR}/${GMOND_PID_FILE}";
88
function getGmondLoggedPid()
90
gmondPidFile=`getGmondPidFileName ${1}`;
92
if [ -e "${gmondPidFile}" ]
94
echo `cat ${gmondPidFile}`;
98
function getGmondRunningPid()
100
gmondLoggedPid=`getGmondLoggedPid ${1}`;
102
if [ -n "${gmondLoggedPid}" ]
104
echo `ps -o pid=MYPID -p ${gmondLoggedPid} | tail -1 | awk '{print $1}' | grep -v MYPID`;
108
function generateGmondCoreConf()
112
if [ "x" != "x${clusterName}" ]
114
read gmondClusterName gmondMasterIP gmondPort <<<`getGangliaClusterInfo ${clusterName}`;
116
# Check that all of ${gmondClusterName} and ${gmondMasterIP} and ${gmondPort} are populated.
117
if [ "x" != "x${gmondClusterName}" -a "x" != "x${gmondMasterIP}" -a "x" != "x${gmondPort}" ]
121
cat << END_OF_GMOND_CORE_CONF
122
#################### Generated by ${0} on ${now} ####################
124
/* This configuration is as close to 2.5.x default behavior as possible
125
The values closely match ./gmond/metric.h definitions in 2.5.x */
131
max_udp_msg_len = 1472
134
allow_extra_data = yes
135
host_dmax = 0 /*secs */
136
host_tmax = 20 /*secs */
137
cleanup_threshold = 300 /*secs */
139
send_metadata_interval = 30 /*secs */
143
* The cluster attributes specified will be used as part of the <CLUSTER>
144
* tag that will wrap all hosts collected by this instance.
147
name = "${gmondClusterName}"
148
owner = "unspecified"
149
latlong = "unspecified"
153
/* The host section describes attributes of the host, like the location */
155
location = "unspecified"
158
/* You can specify as many tcp_accept_channels as you like to share
159
* an XML description of the state of the cluster.
161
* At the very least, every gmond must expose its XML state to
162
* queriers from localhost.
169
/* Each metrics module that is referenced by gmond must be specified and
170
loaded. If the module has been statically linked with gmond, it does
171
not require a load path. However all dynamically loadable modules must
172
include a load path. */
175
name = "core_metrics"
207
/* The old internal 2.5.x metric array has been replaced by the following
208
collection_group directives. What follows is the default behavior for
209
collecting and sending metrics that is as close to 2.5.x behavior as
212
/* This collection group will cause a heartbeat (or beacon) to be sent every
213
20 seconds. In the heartbeat is the GMOND_STARTED data which expresses
214
the age of the running gmond. */
223
/* This collection group will send general info about this host total memory every
225
This information doesn't change between reboots and is only collected
226
once. This information needed for heatmap showing */
232
title = "Memory Total"
236
/* This collection group will send general info about this host every
238
This information doesn't change between reboots and is only collected
242
time_threshold = 1200
251
/* Should this be here? Swap can be added/removed between reboots. */
254
title = "Swap Space Total"
258
title = "Last Boot Time"
261
name = "machine_type"
262
title = "Machine Type"
266
title = "Operating System"
270
title = "Operating System Release"
278
/* This collection group will send the status of gexecd for this host
280
/* Unlike 2.5.x the default behavior is to report gexecd OFF. */
286
title = "Gexec Status"
290
/* This collection group will collect the CPU status info every 20 secs.
291
The time threshold is set to 90 seconds. In honesty, this
292
time_threshold could be set significantly higher to reduce
293
unneccessary network chatter. */
300
value_threshold = "1.0"
305
value_threshold = "1.0"
310
value_threshold = "5.0"
315
value_threshold = "1.0"
320
value_threshold = "5.0"
325
value_threshold = "1.0"
328
/* The next two metrics are optional if you want more detail...
329
... since they are accounted for in cpu_system.
332
value_threshold = "1.0"
337
value_threshold = "1.0"
349
value_threshold = "1.0"
350
title = "One Minute Load Average"
354
value_threshold = "1.0"
355
title = "Five Minute Load Average"
358
name = "load_fifteen"
359
value_threshold = "1.0"
360
title = "Fifteen Minute Load Average"
364
/* This group collects the number of running and total processes */
370
value_threshold = "1.0"
371
title = "Total Running Processes"
375
value_threshold = "1.0"
376
title = "Total Processes"
380
/* This collection group grabs the volatile memory metrics every 40 secs and
381
sends them at least every 180 secs. This time_threshold can be increased
382
significantly to reduce unneeded network traffic. */
388
value_threshold = "1024.0"
389
title = "Free Memory"
393
value_threshold = "1024.0"
394
title = "Shared Memory"
398
value_threshold = "1024.0"
399
title = "Memory Buffers"
403
value_threshold = "1024.0"
404
title = "Cached Memory"
408
value_threshold = "1024.0"
409
title = "Free Swap Space"
418
value_threshold = 4096
423
value_threshold = 4096
424
title = "Bytes Received"
428
value_threshold = 256
429
title = "Packets Received"
433
value_threshold = 256
434
title = "Packets Sent"
444
value_threshold = 1.0
445
title = "Disk Space Available"
448
name = "part_max_used"
449
value_threshold = 1.0
450
title = "Maximum Disk Space Used"
454
value_threshold = 1.0
455
title = "Total Disk Space"
464
include ("${GANGLIA_CONF_DIR}/${gmondClusterName}/conf.d/*.conf")
465
END_OF_GMOND_CORE_CONF
474
function generateGmondMasterConf
478
if [ "x" != "x${clusterName}" ]
480
read gmondClusterName gmondMasterIP gmondPort <<<`getGangliaClusterInfo ${clusterName}`;
482
# Check that all of ${gmondClusterName} and ${gmondMasterIP} and ${gmondPort} are populated.
483
if [ "x" != "x${gmondClusterName}" -a "x" != "x${gmondMasterIP}" -a "x" != "x${gmondPort}" ]
487
cat << END_OF_GMOND_MASTER_CONF
488
#################### Generated by ${0} on ${now} ####################
489
/* Masters only receive; they never send. */
491
bind = ${gmondMasterIP}
495
/* The gmond cluster master must additionally provide an XML
496
* description of the cluster to the gmetad that will query it.
499
bind = ${gmondMasterIP}
502
END_OF_GMOND_MASTER_CONF
511
function generateGmondSlaveConf
515
if [ "x" != "x${clusterName}" ]
517
read gmondClusterName gmondMasterIP gmondPort <<<`getGangliaClusterInfo ${clusterName}`;
519
# Check that all of ${gmondClusterName} and ${gmondMasterIP} and ${gmondPort} are populated.
520
if [ "x" != "x${gmondClusterName}" -a "x" != "x${gmondMasterIP}" -a "x" != "x${gmondPort}" ]
524
cat << END_OF_GMOND_SLAVE_CONF
525
#################### Generated by ${0} on ${now} ####################
526
/* Slaves only send; they never receive. */
528
#bind_hostname = yes # Highly recommended, soon to be default.
529
# This option tells gmond to use a source address
530
# that resolves to the machine's hostname. Without
531
# this, the metrics may appear to come from any
532
# interface and the DNS names associated with
533
# those IPs will be used to create the RRDs.
534
host = ${gmondMasterIP}
538
END_OF_GMOND_SLAVE_CONF