JD McCloud from Praetorian Prefect wrote two articles that explain very well how the agentless monitoring works on OSSEC.
The first one, OSSEC: Agentless to save the day, explains how to setup and use agentless to monitor any remote device via ssh.
The second one, OSSEC: Agentless scripts, goes a bit deeper and explains how they work internally and how you can make your own scripts for agentless monitoring.
Recommended read for every OSSEC user.