Skip to content

brokenpackets/telemetry-email-alerter

 
 

Repository files navigation

Telemetry email alerter

Python script that allows you to subscribe to Arista Telemetry events and then send them to an SMTP server for email notifications.

Emails are sent for events that occur while the alerter is running—you won't get alerts for past events.

We recommend you set up email filters to limit notifications. For example, you can set up filters to ignore "INFO" events based on the email subject.

Installation

Python 2.7 and pip are required.

You can download the alerter via pip by running pip install telemetry-email-alerter.

Usage

You can start up the alerter by running:

telemetry-email-alerter <telemetry-server> <smtp-server> <email-1> <email-2> ... <email-n>

The full list of arguments accepted by the script are listed below.

Name Required? Default Description
telemetryUrl yes The IP address or hostname of your CVP Telemetry instance
smtpServer yes The IP address or hostname of your SMTP (email) server
sendToAddress yes The emails to send notifications to. You can specify multiple emails
--sendCcAddress a@example.com b@example.com no Emails to CC notifications for. You can specify multiple emails
--port 1234 no 465 The port your SMTP server listens to if it use a non-standard port
--subjectPrefix 'CVP Alert' no [CloudVision Telemetry] A message to prepend to email subjects
--noSmtpSsl no off (SSL is used) Disable SSL for SMTP connections
--smtpUsername a@example.com no SMTP server username if authentication is required
--smtpPassword secret no SMTP server password if authentication is required. You will be prompted at startup if this is not provided
--noTelemetrySsl no off (SSL is used) Disable SSL for Telemetry connections
--telemetryUsername example no Telemetry username if authentication is required
--telemetryPassword secret no Telemetry password if authentication is required. You will be prompted at startup if this is not provided
--noSslValidation no off (validation is used) Disables validation of SSL certificates. For debugging purposes. Not advised to use in real environments
--verbose no off Show logging messages

Using an SMTP server

We recommend you use an SMTP server you run and maintain yourself. Your company might have one you can use.

Alternatively you can use the Gmail SMTP server. You can use your Gmail username and an app password. Be aware of its send limits though—it's certainly possible you might exceed them.

Development info

You will need Python 2.7 with pip and virtualenv. You can read more about these in the Python packaging documentation. Create a virtualenv to house the dependencies of this project. Once that's done, you can install dependencies by running pip install -r requirements.pip from the project root.

You can test email notifications by using the Gmail SMTP server mentioned in Using an SMTP server. Alternatively you can use an app like mailslurper on your machine locally.

To run the script locally, you can run the telemetry_email_alerter package from the project root:

python telemetry_email_alerter [...args]

About

Python script that allows you to subscribe to Arista Telemetry Events and then send them to an SMTP server for email notifications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%