Who is this guide for?

  • You’ve already gone through the trouble of installing and configuring Zenoss.

  • You’ve since learned that things in your network - important things - occasionally break.

  • You would like to know when things do break. You have a mobile phone that can receieve SMS messages and can’t stop thinking “There must be a solution in here somewhere!”

What can be done?

SMS You Want

Amazing. Now how can I do this for myself?

Prerequisites

  • All your monitored devices in Zenoss are well organised into Locations, Systems, Groups, Networks, and - most importantly - Classes. If not, take some time to do this and come back to this guide later.

  • You have an account with Nexmo. Nexmo “is a cloud-based SMS API that lets you send and receive high volume of messages at wholesale rates.” They’re also the most cost-effective solution I know of for this task. Create an account with them, top with a bit of credit and make note of your API key and password for later.

  • 15 minutes

Get the code

Download the zenoss-nexmo code from github. There are two files of relevance:

Configure

Edit the hard-coded configuration details in nexmomessage.py on lines 29-32:

try:
     msg = sys.stdin.read()    
     r = "json"
     u = "API key"
     p = "password"
     f = "BaseblackHQ"
     payload = {'reqtype': r, 'password': p, 'from': f, 'to': t, 'username':u}
  • change “API key” to the 8-character alphanumberic API key provided to you by Nexmo
  • change “password” to the password you selected for your Nexmo account
  • change “BaseblackHQ” to what you want to see in the From: field in SMS
  • keep the quotation marks
  • yes, you should never code passwords into config files much less code
  1. Copy nexmomessage.py and your modified zen2nexmo to the bin directory beneath your $ZENHOME Zenoss installation directory, i.e. /opt/zenoss/zenoss/bin/.

  2. In your Zenoss settings, point the “Page Command” to zen2nexmo with the command: $ZENHOME/bin/zen2nexmo $RECIPIENT

    SMS Nexmo command

  3. Edit your user settings inside of Zenoss to include your mobile telephone number

  4. Again in your user settings, add a new Alerting Rule for yourself. Click on Alerting Rules in the leftmost column then choose “Add Alerting Rule…” from the cog menu above.

    SMS Nexmo alert create

  5. I recommend starting with this settings:

    SMS Nexmo alert configure

This translates to “send me an SMS if a Critical event affecting a Production-class device remains unresolved for 2 minutes or longer. This is why it’s very important to have organised your devices into appropriate Device Classes: you don’t want to be SMS spammed and use all your Nexmo credit when things like laptops are shut down and awakened.

Job done!

This should be all you need. Test it by creating an event on one of your Production-class devices perhaps by raising a test SNMP trap. 120 seconds later you should be seeing an SMS on the mobile number configured in your Zenoss user account.

If you need more help or have any suggestions how this document can be improved, please leave feedback using the link below.

-Paul

leave feedback on this post