Building on what's been said you can just use what's already there (by mimicing the default rules to do what you want).
Using the counters found here:
I used the counter "ConnectedSockets" (which may or may not be what you want).
And I created a ruleset to generate a message when the ConnectedSockets reaches 20,000.
You then have other options to use syslog, send an email, or send an SNMP trap.
See screenshot below:
Attached is the ruleset itself for conveinence.