Objective
Ganglia is mainly used to monitor the performance of the software, through the curve is very easy to see the working state of each node, for reasonable adjustment, allocation of system resources, improve the overall performance of the system plays an important role in supporting browser access, but can not monitor node hardware technical indicators. Ganglia is a distributed monitoring system.
Redis now in the business application has been very extensive, but how to monitor redis, real-time observation redis performance, in search engine search "ganglia monitoring Redis", found that the 13 old articles, are said to https://github.com/ Ganglia/gmond_python_modules this third-party plug-in library to download the REDIS monitoring module
Solving method
But I found that gmond_python_modules
there is no Redis module under this repo, so I looked git log
and found that the Redis module has been integrated into the ganglia source pack.
So downloaded the source package, after the search found Redis module is located gmond/python_modules/db/redis.py
in the configuration file gmond/python_modules/conf.d/redis.pyconf.disabled
.
Modify the host and port two parameters in the configuration file to monitor Redis IP and port, and then copy two files to the corresponding directory. (typically redis.pyconf
copied to the ganglia installation directory /etc/conf.d/
, redis.py to the Ganglia installation directory /lib64/ganglia/python_modules
)
Restart the Gmond, you can see the redis figure out, but the data are empty.
So stop Gmond, use gmond -f -d 1
enable debug mode, found redis.py error
[PYTHON] Can ' t call the metric handler function for [connected_clients] in the Python module [Redis].
Traceback (most recent):
File "/opt/gmond/lib64/ganglia/python_modules/redis.py", line, in Metric_ Handler
N, v = line.split (":")
valueerror:need more than 1 value to unpack
View Context Code
For line in Info.splitlines () [1:]:
if "" = = line:
continue
N, v = line.split (":")
Probably means to redis info
use every non-empty line of the command output: Split, but I installed the Redis version is 2.8+,info command will output similar comments like #server, which causes the press: Split failure, so python error, Gmond can not get the value.
So the solution is also very simple, the above code can be modified as follows, that is, skip the blank line and the line beginning with #
For line in Info.splitlines () [1:]:
if "" = = line or line[0] = = ' # ':
continue
N, v = line.split (":")
Restart Gmond, and you'll see the data in ganglia in a minute.
==========================================
Looking at the ganglia code on the GitHub, I found that the latest code has fixed the bug, but it hasn't been release yet.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.