How to configure nagios realtime SMS alert

Solution 1:

Convert nagios.log timestamp to a human-readable format:

perl -pe 's/(\d+)/localtime($1)/e' nagios.log

[Wed Aug 29 16:58:30 2012] SERVICE ALERT: localhost;SSH;CRITICAL;HARD;4;Connection refused
[Wed Aug 29 16:58:30 2012] SERVICE NOTIFICATION: localhost;localhost;SSH;CRITICAL;notify-service-by-email;Connection refused
[Wed Aug 29 16:58:38 2012] SERVICE NOTIFICATION: localhost;localhost;SSH;CRITICAL;notify-service-by-sms;Connection refused

You can see that it send an email notification immediately and takes only... 8 seconds to send a SMS. The delay (as @John Gardeniers pointed out) is in your SMS system, not Nagios.