forked from outlyerapp/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyarn.nodemgr.py
More file actions
executable file
·39 lines (30 loc) · 849 Bytes
/
yarn.nodemgr.py
File metadata and controls
executable file
·39 lines (30 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import sys
import requests
import json
import socket
names = ['*']
excludes = ['tag.context',
'modelertype',
'tag.port',
'tag.processname',
'tag.sessionid',
'name',
'tag.hostname']
metrics = {}
node_data = {}
for n in names:
URL = 'http://%s:8042/jmx?qry=Hadoop:service=NodeManager,name=%s' % (socket.getfqdn(), n)
try:
resp = requests.get(URL, timeout=60).json()['beans']
for i in range(len(resp)):
for k, v in resp[i].iteritems():
if k.lower() not in excludes:
metrics[k] = v
except:
print "Plugin Failed!"
sys.exit(2)
output = "OK | "
for k, v in metrics.iteritems():
output += str(k).lower() + '=' + str(v).lower() + ';;;; '
print output