Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seven logo

seven SMS for Nagios Core

Plugin for Nagios Core that sends SMS notifications via the seven gateway.

MIT License Nagios Core Python 2 | 3


Features

  • Native Nagios Plugin - Drop-in seven.py script for notify-host-by-sms and notify-service-by-sms commands
  • Custom Sender - Override the displayed sender via --from
  • Advanced SMS Options - Flash, TTL, performance tracking, foreign ID, label

Prerequisites

Installation

Copy seven.py into the Nagios plugins directory (typically /usr/local/nagios/libexec).

Configuration

1. Wire the contact

Edit /usr/local/nagios/etc/objects/contacts.cfg:

define contact {
    # ...
    pager                         +491234567890
    host_notification_commands    notify-host-by-sms
    service_notification_commands notify-service-by-sms
}

2. Define commands

Append to /usr/local/nagios/etc/objects/commands.cfg:

define command {
    command_name notify-service-by-sms
    command_line python $USER1$/seven.py MY_SEVEN_API_KEY $CONTACTPAGER$ "$NOTIFICATIONTYPE$:$SERVICEDESC$ on $HOSTADDRESS$@$HOSTNAME$, State $SERVICESTATE$, Output: $SERVICEOUTPUT$, Date: $SHORTDATETIME$" --from=Nagios
}

define command {
    command_name notify-host-by-sms
    command_line python $USER1$/seven.py MY_SEVEN_API_KEY $CONTACTPAGER$ "$NOTIFICATIONTYPE$ on $HOSTADDRESS$@$HOSTNAME$, State: $HOSTSTATE$, Output: $HOSTOUTPUT$, Date: $SHORTDATETIME$" --from=Nagios
}

3. (optional) Add a quick-test service

Append to /usr/local/nagios/etc/objects/localhost.cfg:

define service {
    use                  local-service
    host_name            localhost
    service_description  SMS
    check_command        notify-host-by-sms
}

Usage

seven.py [-h] [--delay DELAY] [--flash] [--foreign_id FOREIGN_ID]
         [--from FROM] [--label LABEL] [--performance_tracking]
         [--ttl TTL] [--udh UDH]
         api_key to text

Support

Need help? Feel free to contact us or open an issue.

License

MIT

Releases

Used by

Contributors

Languages