I realized that it was a big problem to set zGangliaHost for my Hadoop clusters, totally 55 servers.
Fortunately, Zenoss is powerful if you can write some small Python code. Here is my solution:
Load them using
zenbatchload like this:
$ zenbatchload dev-cluster.txt
Here is the
dev-cluster.txt:
/Devices/Server/SSH/Linux/Ganglia
devnode001 comments="My Hadoop DEV cluster, client node", zGangliaHost="devnode001", setGroups='/Hadoop/DEV/ClientNode'
devnode002 comments="My Hadoop DEV cluster, master node", zGangliaHost="devnode001", setGroups='/Hadoop/DEV/MasterNode'
devnode003 comments="My Hadoop DEV cluster, data node", zGangliaHost="devnode001", setGroups='/Hadoop/DEV/DataNode'
You can set zGangliaHost and groups in a file. It is perfect.
You can generate this file easily using a script.
ZENBATCHLOAD HOW TO may be obsolete. My Zenoss version (3.1.0) doesn't use
-i.
My Zenoss administrator created the devices for my clusters without zGangliaHost. I don't want him to delete those devices and use
zenbatchload. Here is my solution.
$ zendmd --script=set_gangliahost.py
Here is
set_gangliahost.py:
import re
dev = re.compile('(hdcl001|had002|had01[0-2]).*', re.IGNORE
CASE)
test = re.compile('(hdcledw002|had001|had01[0-2]).*', re.IGNOR
ECASE)
prod = re.compile('prod.*', re.IGNORECASE)
for item in dmd.Devices.Server.SSH.Linux.Ganglia.devices.objectItems():
(name, device) = item
if dev.match(name):
device.zGangliaHost = 'dev-gmond'
elif test.match(name):
device.zGangliaHost = 'test-gmond'
elif prod.match(name):
device.zGangliaHost = 'prod-gmond'
commit()
dev-gmond is the server name where you run
gmond
No comments:
Post a Comment