Not the answer you need?
Register and ask your own question!

Bug in ss_get_by_ssh.php --type=redis

mohmoh EntrantCurrent User Role Beginner
I've found that my cacti graph of redis commands executed was jumping around like crazy. After a lot of debugging it turns out that the redis_get function usually will return about half of the INFO response from redis. The crazy thing is it would stop at the second-to-last digit of the total_commands_processed value.

To illustrate; if the actual redis info response was:
# Stats

The $data variable in redis_get would end up with:
# Stats

Every 10th poll or so the implementation would work as intended, causing a huge delta because of the extra digit, and a big spike in the Cacti graph.

I've changed the script at line 1307 (in redis_get) to send a PING after the info, and keep reading the response until PONG is received:

$res = fwrite($sock, "INFO\r\nPING\r\n");
if (!$res ) {
echo("Can't write to socket");

$data = '';
while (($line = fgets($sock)) && trim($line) != '+PONG') {
$data .= $line;

Which caused a b0rked graph like this:
Attachment not found. become more reasonable (fix applied 11:31 + graph is zoomed in the avoid the earlier extreme values):
Attachment not found.

Hope it can help someone. Cheers.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.