Module. You can specify the timeout value for the ping so it should be much faster. The module is failry simple to use and there's good examples in the documentation. One word of caution: I'd recomend only useing the ICMP ping. I've had troubles with TCP and UDP pings. From what I've found on the web, ICMP ping is the only one that works reliably.