# Bug in ss\_get\_by\_ssh.php --type=redis

**URL:** <https://forums.percona.com/t/bug-in-ss-get-by-ssh-php-type-redis/4289>\
**Category:** Percona Monitoring Plugins\
**Created:** [July 8, 2015, 6:08am UTC](https://forums.percona.com/t/bug-in-ss-get-by-ssh-php-type-redis/4289 "2015-07-08T06:08:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![moh](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/moh/32/1074_2.png) [@moh](https://forums.percona.com/u/moh)\
**Post date:** [July 8, 2015, 6:08am UTC](https://forums.percona.com/t/bug-in-ss-get-by-ssh-php-type-redis/4289/1 "2015-07-08T06:08:47Z")

</div>

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:

```auto

(...snip...)
# Stats
total_connections_received:7378492
total_commands_processed:2724014579
instantaneous_ops_per_sec:23
(...snip...)

```

The $data variable in redis\_get would end up with:

```auto

(...snip...)
# Stats
total_connections_received:7378492
total_commands_processed:272401457

```

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:

[PHP]  
$res = fwrite($sock, “INFO\r\nPING\r\n”);  
if (!$res ) {  
echo(“Can’t write to socket”);  
return;  
}

$data = ‘’;  
while (($line = fgets($sock)) && trim($line) != ‘+PONG’) {  
$data .= $line;  
}  
[/PHP]

Which caused a b0rked graph like this:  
[ATTACH=CONFIG]n41053[/ATTACH]

…to become more reasonable (fix applied 11:31 + graph is zoomed in the avoid the earlier extreme values):  
[ATTACH=CONFIG]n41054[/ATTACH]

Hope it can help someone. Cheers.
