Here’s a small script I threw together to check the number of DHCP leases on an Ubiquiti EdgeRouter. It’s made for use with Nagios.
It basically connects to the router via SSH, executes
show dhcp leases and returns OK, WARNING, or CRITICAL depending on how many leases exist. See the comments for a little bit of documentation.