Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to configure Nagios 3 to monitor a server via HTTP by searching for a certain string by using the check_http command as follows.

define command {
    command_name check_http-mysite
    command_line /usr/lib/nagios/plugins/check_http -H -s "Some text" }

The HTTP check for a particular string works fine after I tested it. I have been trying unsuccessfully to configure the email-to-SMS notification by using the Clickatell SMTP API. How can I make it work?

I have come across an example in Tweak - Nagios SMS Messaging, though I seem to miss something.

I guess my explanation before was very vague. I am trying to monitor a web server in such a way that I want to search for a particular string on a page via HTTP. The command is defined in command.cfg as follows

    # 'check_http-mysite command definition'
    define command {
        command_name check_http-mysite
        command_line /usr/lib/nagios/plugins/check_http -H -s "Some text" 

    # 'notify-host-by-sms' command definition
    define command {
        command_name  notify-host-by-sms
        command_line  /usr/bin/send_sms $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$ :Host$HOSTALIAS$ is $HOSTSTATE$ ($OUTPUT$)"

    # 'notify-service-by-sms' command definition
    define command {
        command_name  notify-service-by-sms
        command_line  /usr/bin/send_sms $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ($OUTPUT$)"

Now if Nagios doesn't find "Some text" on the home page, Nagios should notify a contact via SMS through the Clickatell HTTP API which I have a script for that I have tested and found that it works fine.

Whenever I change the command definition to search for a string which is not on the page, and restart Nagios, I can see on the web interface that the string was not found. What I don't understand is why isn't the notification sent though I have defined the host, hostgroup, contact, contactgroup, service and so forth. What I'm missing, these are my definitions,


define host {
    use              generic-host
    host_name        HAL
    alias            IBM-1
    check_command    check_http-mysite


# my website
define hostgroup{
    hostgroup_name   my-servers
    alias            All My Servers
    members          HAL


define contact {
    contact_name                    colin
    alias                           Colin Y
    service_notification_period     24x7
    host_notification_period        24x7
    service_notification_options    w,u,c,r,f,s
    host_notification_options       d,u,r,f,s
    service_notification_commands   notify-service-by-email,notify-service-by-sms
    host_notification_commands      notify-host-by-email,notify-host-by-sms
    pager                           +254xxxxxxxxx

define contactgroup {
    contactgroup_name               site_admin
    alias                           Site Administrator
    members                         colin


# Check for particular string in page via HTTP.
define service {
    hostgroup_name                  my-servers
    service_description             STRING CHECK
    check_command                   check_http-mysite
    use                             generic-service
    notification_interval           0 ; Set > 0 if you want to be renotified.
    contacts                        colin
    contact_groups                  site_admin

I hope I've explained my problem clearly this time :-)

share|improve this question
You don't really explain what problem you are having, are you getting errors with the clickatell api? – Sam Nov 6 '09 at 14:02
If you are using the send_sms script I think you are using: If you test the script by running it as some other user than the nagios user, remember to delete /tmp/sms.html else the wget in send_sms will fail when run by nagios. Better yet, change the send_sms script to delete the tempfile at the end. – Roy Mar 28 '13 at 13:41

1 Answer 1

  1. Run the /usr/bin/send_sms from command line to make sure the Clickatell works.
  2. Take a look at nagios.log or /var/log/messages to see you have nagios: SERVICE NOTIFICATION whenever you got "string was not found" on the Web UI.
share|improve this answer
See my comment above about deleting the temporary file after running send_sms from the command line. This had me puzzled for a while. – Roy Mar 28 '13 at 13:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.