Git Product home page Git Product logo

py-nagios-wa's Introduction

py-nagios-wa

py-nagios-wa is a small Python script that enables sysadmins to receive Nagios notifications on WhatsApp. Teams can also configure it to send notifications to group chats.

Dependencies

  • Python 2.7
  • Yowsup 2.2

A virtualenv is recommended. Dependencies can easily be installed through pip. For rapid installation, the setup script can also be used.

Installation

Simple set up a new virtualenv and install the requirements.txt through pip. Alternatively, for easy installation, you can simply execute the setup script. This will set up a new virtualenv for you, and install all dependencies by running pip in that new virtualenv.

$ chmod +x ./setup_env.sh
$ ./setup_env.sh

Usage

Configuring py-nagios-wa

You will first need to create your local_settings.py. Have a look at example_settings.py and configure your loca settings accordingly. For easy installation, you can also copy the example configuration into the local settings file. You'll then only have to change your login credentials and the DEFAULT_RECIPIENTS.

  • CREDENTIALS - Your Whatsapp username and base64 password.
  • DEFAULT_RECIPIENTS - Notifications will be sent to these jids.
  • HOST_NOTIFICATION - Your host notification template.
  • SERVICE_NOTIFICATION - Your service notification template.

To test out whether your configuration is working, you can simply execute the notify script. This will send a default notification to the default recipients configured in your local_settings.py.

A succesful configuration will yield something like this:

$ source env/bin/activate
$ cd src/
$ python notify.py
Succesfully connected to the WhatsApp service.
Sending to [email protected]
Sending to [email protected]
All messages have been sent. Disconnecting now!

Configuring Nagios

Configuring Nagios should at this point not be too difficult. Edit your commands.cfg and add the following entries:

define command {
    command_name    host-wa
    command_line    /path-to/py-nagios-wa/env/bin/python /path-to/py-nagios-wa/src/notify.py host
}

define command {
    command_name    service-wa
    command_line    /path-to/py-nagios-wa/env/bin/python /path-to/py-nagios-wa/src/notify.py service
}

Don't forget to command line paths, of course :-) That's it - you're all set to use WhatsApp for your Nagios notifications now!

Screenshot

Screenshot

License

MIT

py-nagios-wa's People

Contributors

robbietjuh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.