Monitor the latest redis solutions with ganglia

  • 2020-05-15 02:30:15
  • OfStack

preface

Ganglia is mainly used to monitor the system performance of the software, through the curve is easy to see the working state of each node, reasonable adjustment, allocation of system resources, improve the overall performance of the system plays an important role, support browser access, but can not monitor the node hardware technical indicators. Ganglia is a distributed monitoring system.

Redis now has been widely applied in the business, but how to monitor redis, real-time observation redis performance, in the search engine search "ganglia monitoring redis", found that is 13 years old, is said to https: / / github com/ganglia/gmond_python_modules this third party plug-in library download redis monitoring module

The solution

But what I found gmond_python_modules There is no redis module below repo, so check git log , found that the redis module has been integrated into the ganglia source package

I downloaded the source package and found the redis module after searching gmond/python_modules/db/redis.py , configuration file in gmond/python_modules/conf.d/redis.pyconf.disabled .

Modify the host and port parameters in the configuration file to monitor the ip and port of redis, and then copy the two files to the corresponding directory. (usually redis.pyconf Copy to the ganglia installation directory /etc/conf.d/ Next, copy redis.py to the ganglia installation directory /lib64/ganglia/python_modules )

When you restart gmond, you can see that there is a graph of redis, but the data is empty.

So you stop gmond and use it gmond -f -d 1 Enable debug mode, find redis.py error


[PYTHON] Can't call the metric handler function for [connected_clients] in the python module [redis].

Traceback (most recent call last):
File  " /opt/gmond/lib64/ganglia/python_modules/redis.py " , line 21, 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(":")

It probably means take redis info The command outputs each non-blank line with: split, but the version of redis I installed is 2.8+, info will output comments like #Server, which will result in: split failure, so python reports an error, gmond cannot get a value.

So the solution is as simple as changing the code above to the following, which is to skip blank lines and lines beginning with #


for line in info.splitlines()[1:]:
 if "" == line or line[0] == '#':
  continue
 n, v = line.split(":")

Restart gmond again, and you will see the data in ganglia after 1 minute

==========================================

A look at the code for ganglia on github shows that the latest code has fixed this bug, but it doesn't have release yet

conclusion

The above is the whole content of this article, I hope the content of this article to your study or work can bring 1 definite help, if you have questions you can leave a message to communicate.


Related articles: