Redis- DataSource - Occasionally 'No Data'
Occasionally the Redis- DataSource returned no data for some or all of the DataPoints. Under test, it was noted that the key value store returned to cli.stdout was being truncated. It was further noted that the cli.expect string of 'r\n\r\n' occured at multiple points in stdout, not just at the end of the response. Under certain stress conditions (when the device response was slow) stdout was truncated by the groovy script.
It was noted that (in a successful return) the last key value returned was under the heading of "# Keyspace", followed by the key values, followed by a final 'r\n\r\n'.
To resolve this issue, the groovy collection script was modified with an additional cli.expect("# Keyspace"), prior to cli.expect('\r\n\r\n'). On the monitored devices this modification fully resolved the issue. The modified script is shown below:
import com.santaba.agent.groovyapi.expect.Expect;
cli = Expect.open("##HOSTNAME##", ##WILDVALUE##, 5)
if ( "##REDIS.PASS##" != "") {
cli.send("AUTH " + "##REDIS.PASS##" + "\r\n")
}
cli.send( "INFO\r\n" )
cli.expect("# Keyspace")
cli.expect('\r\n\r\n')
println cli.stdout()
cli.send( "QUIT\r\n" )
It is not known if this is caused by a recent change to the way that the INFO output is returned by Redis. All available devices exhibited the same behaviour and were at Redis version 3.2.8 on Linux.