用于订阅Arista遥测事件和发送电子邮件警报的脚本。

telemetry-email-alerter的Python项目详细描述


python脚本,允许您订阅arista遥测事件,然后将它们发送到smtp服务器以获取电子邮件通知。

电子邮件是为警报程序运行时发生的事件发送的,您不会收到过去事件的警报。

我们建议您设置电子邮件筛选器以限制通知。例如,您可以设置过滤器以忽略基于电子邮件主题的“信息”事件。

安装

python 2.7和pip是必需的。

通过运行pip install telemetry-email-alerter,您可以通过pip下载警报程序。

用法

您可以通过运行以下命令启动报警器:

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

下面列出了脚本接受的参数的完整列表。

NameRequired?DefaultDescription
telemetryUrlyesThe IP address or hostname of your CVP Telemetry instance
smtpServeryesThe IP address or hostname of your SMTP (email) server
sendToAddressyesThe emails to send notifications to. You can specify multiple emails
–sendCcAddress a@example.comb@example.comnoEmails to CC notifications for. You can specify multiple emails
–port 1234no465The 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
–noSmtpSslnooff (SSL is used)Disable SSL for SMTP connections
–smtpUsername a@example.comnoSMTP server username if authentication is required
–smtpPassword secretnoSMTP server password if authentication is required. You will be prompted at startup if this is not provided
–noTelemetrySslnooff (SSL is used)Disable SSL for Telemetry connections
–telemetryUsername examplenoTelemetry username if authentication is required
–telemetryPassword secretnoTelemetry password if authentication is required. You will be prompted at startup if this is not provided
–noSslValidationnooff (validation is used)Disables validation of SSL certificates. For debugging purposes. Not advised to use in real environments
–verbosenooffShow logging messages

使用SMTP服务器

我们建议您使用自己运行和维护的SMTP服务器。你的公司可能有一个你可以用的。

或者可以使用the Gmail SMTP server。你可以使用你的gmail用户名和an app password。注意它的发送限制,尽管你肯定有可能超过它们。

开发信息

您将需要带有pipvirtualenv的python 2.7。你可以在the Python packaging documentation中阅读更多关于这些的内容。创建一个virtualenv来容纳此项目的依赖项。完成后,可以通过从项目根目录运行pip install -r requirements.pip来安装依赖项。

您可以使用Using an SMTP server中提到的gmail smtp服务器来测试电子邮件通知。或者,您可以在本地计算机上使用类似mailslurper的应用程序。

要在本地运行脚本,可以从项目根目录运行telemetry_email_alerter包:

python telemetry_email_alerter [...args]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Java中运行时在两个枚举类之间切换   java如何让PicoContainer启动/停止/处置工厂注入的组件?   带有Recyclerview onClick的java多活动   java如何从TestNG tests和Selenium接口调用默认方法?   java无法在Eclipse3.5.2中折叠注释   RR和SJF CPU调度算法的Java代码   java从属性文件配置记录器   java Notify传输在字符更改后超过20个字节完成   java阵列究竟是如何工作的   java跨类/包维护全局但可变的变量   java向setMessageListener注册侦听器服务   java按钮单击不在片段中工作   java GSSExException:使用spnego在GSSAPI上未指定故障(机制级别:不支持/启用带有HMAC SHA196的加密类型AES256CTS模式)   用java绘制虚线的图形   java从networkdrive启动windows捆绑包使用不包括JRE?   多线程java线程体系结构与应用程序设计