Merge lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/ganglia_metrics into lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/trunk

Proposed by Andrew McLeod
Status: Merged
Merged at revision: 102
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/ganglia_metrics
Merge into: lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/trunk
Diff against target: 252 lines (+176/-1) (has conflicts)
8 files modified
DEV-README.md (+5/-0)
config.yaml (+4/-0)
hooks/callbacks.py (+30/-1)
hooks/common.py (+14/-0)
hooks/ganglia-relation-broken (+26/-0)
hooks/ganglia-relation-changed (+26/-0)
metadata.yaml (+2/-0)
templates/hadoop-metrics2.properties.j2 (+69/-0)
Text conflict in DEV-README.md
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/apache-hadoop-hdfs-master/ganglia_metrics
Reviewer Review Type Date Requested Status
Juju Big Data Development Pending
Review via email: mp+268524@code.launchpad.net

Description of the change

Send hadoop metrics to ganglia server

To post a comment you must log in.
Revision history for this message
Andrew McLeod (admcleod) wrote :

Potential discussion point: hdfs starts before the values are configured, and I have not made the relationship restart HDFS due to potential for service disruption. What is best practice in this case? (ganglia metrics will not be sent until action restart-hdfs is issued)

Revision history for this message
Cory Johns (johnsca) wrote :

I think we should do the restart automatically, since otherwise not even the bundles will work. My understanding is that the restart-hdfs action is fairly graceful, though, so as long as we use that, it should be fine. We don't expect relations to be coming and going that frequently, anyway.

92. By Andrew McLeod

added ganglia_metrics config value, default false

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'DEV-README.md'
--- DEV-README.md 2015-08-20 21:54:27 +0000
+++ DEV-README.md 2015-08-24 12:09:29 +0000
@@ -61,8 +61,13 @@
6161
62## Manual Deployment62## Manual Deployment
6363
64<<<<<<< TREE
64The easiest way to deploy an Apache Hadoop platform is to use one of65The easiest way to deploy an Apache Hadoop platform is to use one of
65the [apache bundles](https://jujucharms.com/u/bigdata-charmers/#bundles).66the [apache bundles](https://jujucharms.com/u/bigdata-charmers/#bundles).
67=======
68The easiest way to deploy the core Apache Hadoop platform is to use one of
69the [apache bundles](https://jujucharms.com/u/bigdata-charmers/#bundles).
70>>>>>>> MERGE-SOURCE
66However, to manually deploy the base Apache Hadoop platform without using one71However, to manually deploy the base Apache Hadoop platform without using one
67of the bundles, you can use the following:72of the bundles, you can use the following:
6873
6974
=== modified file 'config.yaml'
--- config.yaml 2015-04-03 16:49:17 +0000
+++ config.yaml 2015-08-24 12:09:29 +0000
@@ -17,3 +17,7 @@
17 default: ''17 default: ''
18 description: |18 description: |
19 URL from which to fetch resources (e.g., Hadoop binaries) instead of Launchpad.19 URL from which to fetch resources (e.g., Hadoop binaries) instead of Launchpad.
20 ganglia_metrics:
21 type: boolean
22 default: false
23 description: if relationship exists to ganglia:master, enable ganglia metrics
2024
=== modified file 'hooks/callbacks.py'
--- hooks/callbacks.py 2015-08-10 22:59:27 +0000
+++ hooks/callbacks.py 2015-08-24 12:09:29 +0000
@@ -18,7 +18,10 @@
1818
19from charmhelpers.core import hookenv19from charmhelpers.core import hookenv
20from charmhelpers.core import unitdata20from charmhelpers.core import unitdata
21from jujubigdata.relations import DataNode21from jujubigdata.relations import DataNode, Ganglia
22from charmhelpers.core.templating import render
23from functools import partial
24from subprocess import check_call
2225
2326
24def update_working_status():27def update_working_status():
@@ -39,5 +42,31 @@
39 hookenv.status_set('blocked', 'Waiting for relation to compute slaves')42 hookenv.status_set('blocked', 'Waiting for relation to compute slaves')
4043
4144
45def conf_ganglia_metrics(purgeConf=False):
46 """
47 Send hadoop specific metrics to a ganglia server
48 """
49 config = hookenv.config()
50 ganglia_metrics = config['ganglia_metrics'] and not purgeConf
51 ganglia_metrics_changed = ganglia_metrics != unitdata.kv().get('ganglia_metrics', False)
52 unitdata.kv().set('ganglia_metrics', ganglia_metrics)
53 comment = '#' if not ganglia_metrics else ''
54 ganglia_host = 'UNSET_BY_JUJU' if not ganglia_metrics else Ganglia().host()
55 ganglia_sink_str = comment + '*.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31'
56 hookenv.log("Configuring ganglia sink in /etc/hadoop/conf/hadoop-metrics2.properties", level=None)
57 render(
58 source='hadoop-metrics2.properties.j2',
59 target='/etc/hadoop/conf/hadoop-metrics2.properties',
60 context={
61 'ganglia_host': ganglia_host,
62 'ganglia_sink_str': ganglia_sink_str,
63 },
64 ),
65 if ganglia_metrics_changed:
66 check_call(['actions/restart-hdfs'])
67
68
69purge_ganglia_metrics = partial(conf_ganglia_metrics, purgeConf=True)
70
42def clear_active_flag():71def clear_active_flag():
43 unitdata.kv().set('charm.active', False)72 unitdata.kv().set('charm.active', False)
4473
=== modified file 'hooks/common.py'
--- hooks/common.py 2015-08-10 22:59:27 +0000
+++ hooks/common.py 2015-08-24 12:09:29 +0000
@@ -106,6 +106,20 @@
106 callbacks.update_active_status,106 callbacks.update_active_status,
107 ],107 ],
108 },108 },
109 {
110 'name': 'ganglia',
111 'requires': [
112 hadoop.is_installed,
113 jujubigdata.relations.Ganglia,
114 ],
115 'callbacks': [
116 callbacks.conf_ganglia_metrics,
117 ],
118 'cleanup': [
119 callbacks.purge_ganglia_metrics
120 ],
121
122 },
109 ])123 ])
110 manager.manage()124 manager.manage()
111125
112126
=== added file 'hooks/ganglia-relation-broken'
--- hooks/ganglia-relation-broken 1970-01-01 00:00:00 +0000
+++ hooks/ganglia-relation-broken 2015-08-24 12:09:29 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/env python
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14"""
15All hooks in this charm are managed by the Charm Framework.
16The framework helps manage dependencies and preconditions to ensure that
17steps are only executed when they can be successful. As such, no additional
18code should be added to this hook; instead, please integrate new functionality
19into the 'callbacks' list in hooks/common.py. New callbacks can be placed
20in hooks/callbacks.py, if necessary.
21
22See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html
23for more information.
24"""
25import common
26common.manage()
027
=== added file 'hooks/ganglia-relation-changed'
--- hooks/ganglia-relation-changed 1970-01-01 00:00:00 +0000
+++ hooks/ganglia-relation-changed 2015-08-24 12:09:29 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/env python
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14"""
15All hooks in this charm are managed by the Charm Framework.
16The framework helps manage dependencies and preconditions to ensure that
17steps are only executed when they can be successful. As such, no additional
18code should be added to this hook; instead, please integrate new functionality
19into the 'callbacks' list in hooks/common.py. New callbacks can be placed
20in hooks/callbacks.py, if necessary.
21
22See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html
23for more information.
24"""
25import common
26common.manage()
027
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-05-12 21:56:03 +0000
+++ metadata.yaml 2015-08-24 12:09:29 +0000
@@ -10,6 +10,8 @@
10provides:10provides:
11 namenode:11 namenode:
12 interface: dfs12 interface: dfs
13 ganglia:
14 interface: monitor
13requires:15requires:
14 datanode:16 datanode:
15 interface: dfs-slave17 interface: dfs-slave
1618
=== added directory 'templates'
=== added file 'templates/hadoop-metrics2.properties.j2'
--- templates/hadoop-metrics2.properties.j2 1970-01-01 00:00:00 +0000
+++ templates/hadoop-metrics2.properties.j2 2015-08-24 12:09:29 +0000
@@ -0,0 +1,69 @@
1#
2# Licensed to the Apache Software Foundation (ASF) under one or more
3# contributor license agreements. See the NOTICE file distributed with
4# this work for additional information regarding copyright ownership.
5# The ASF licenses this file to You under the Apache License, Version 2.0
6# (the "License"); you may not use this file except in compliance with
7# the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18# syntax: [prefix].[source|sink].[instance].[options]
19# See javadoc of package-info.java for org.apache.hadoop.metrics2 for details
20
21*.sink.file.class=org.apache.hadoop.metrics2.sink.FileSink
22# default sampling period, in seconds
23*.period=10
24
25# Defining sink for Ganglia 3.1
26{{ ganglia_sink_str }}
27
28# Default polling period for GangliaSink
29*.sink.ganglia.period=10
30
31# default for supportsparse is false
32*.sink.ganglia.supportsparse=true
33
34# Directing output to ganglia servers
35
36*.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both
37*.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
38
39namenode.sink.ganglia.servers={{ ganglia_host }}:8649
40datanode.sink.ganglia.servers={{ ganglia_host }}:8649
41jobtracker.sink.ganglia.servers={{ ganglia_host }}:8649
42tasktracker.sink.ganglia.servers={{ ganglia_host }}:8649
43maptask.sink.ganglia.servers={{ ganglia_host }}:8649
44reducetask.sink.ganglia.servers={{ ganglia_host }}:8649
45resourcemanager.sink.ganglia.servers={{ ganglia_host }}:8649
46nodemanager.sink.ganglia.servers={{ ganglia_host }}:8649
47historyserver.sink.ganglia.servers={{ ganglia_host }}:8649
48journalnode.sink.ganglia.servers={{ ganglia_host }}:8649
49resourcemanager.sink.ganglia.tagsForPrefix.yarn=Queue
50
51# The namen de-metrics. ut will contain metrics from all context
52#namenode.sink.file.filename=namenode-metrics.out
53# Specifying a special sampling period for namenode:
54#namenode.sink.*.period=8
55
56#datanode.sink.file.filename=datanode-metrics.out
57
58# the following example split metrics of different
59# context to different sinks (in this case files)
60#jobtracker.sink.file_jvm.context=jvm
61#jobtracker.sink.file_jvm.filename=jobtracker-jvm-metrics.out
62#jobtracker.sink.file_mapred.context=mapred
63#jobtracker.sink.file_mapred.filename=jobtracker-mapred-metrics.out
64
65#tasktracker.sink.file.filename=tasktracker-metrics.out
66
67#maptask.sink.file.filename=maptask-metrics.out
68
69#reducetask.sink.file.filename=reducetask-metrics.out

Subscribers

People subscribed via source and target branches

to all changes: