forked from OpenTSDB/tcollector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move hbase and hadoop to http /jmx collection
* remove the old java jars * Create an http base class for hadoop metrics2 * Create hadoop namenode and datanode subclasses * create hbase master and regionserver subclasses * refactor some functions into utils. Signed-off-by: Benoit Sigoure <[email protected]>
- Loading branch information
1 parent
2af3de6
commit 8bb22d6
Showing
18 changed files
with
400 additions
and
1,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/python | ||
# This file is part of tcollector. | ||
# Copyright (C) 2010 The tcollector Authors. | ||
# | ||
# This program is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or (at your | ||
# option) any later version. This program is distributed in the hope that it | ||
# will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
# General Public License for more details. You should have received a copy | ||
# of the GNU Lesser General Public License along with this program. If not, | ||
# see <http://www.gnu.org/licenses/>. | ||
|
||
import sys | ||
import time | ||
|
||
try: | ||
import json | ||
except ImportError: | ||
json = None | ||
|
||
from collectors.lib import utils | ||
from collectors.lib.hadoop_http import HadoopHttp | ||
|
||
|
||
REPLACEMENTS = { | ||
"datanodeactivity-": ["activity"], | ||
"fsdatasetstate-ds-": ["fs_data_set_state"], | ||
"rpcdetailedactivityforport": ["rpc_activity"], | ||
"rpcactivityforport": ["rpc_activity"] | ||
} | ||
|
||
|
||
class HadoopDataNode(HadoopHttp): | ||
""" | ||
Class that will retrieve metrics from an Apache Hadoop DataNode's jmx page. | ||
This requires Apache Hadoop 1.0+ or Hadoop 2.0+. | ||
Anything that has the jmx page will work but the best results will com from Hadoop 2.1.0+ | ||
""" | ||
|
||
def __init__(self): | ||
super(HadoopDataNode, self).__init__('hadoop', 'datanode', 'localhost', 50075) | ||
|
||
def emit(self): | ||
current_time = int(time.time()) | ||
metrics = self.poll() | ||
for context, metric_name, value in metrics: | ||
for k, v in REPLACEMENTS.iteritems(): | ||
if any(c.startswith(k) for c in context): | ||
context = v | ||
self.emit_metric(context, current_time, metric_name, value) | ||
|
||
|
||
def main(args): | ||
utils.drop_privileges() | ||
if json is None: | ||
utils.err("This collector requires the `json' Python module.") | ||
return 13 # Ask tcollector not to respawn us | ||
datanode_service = HadoopDataNode() | ||
while True: | ||
datanode_service.emit() | ||
time.sleep(15) | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv)) | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.