`
diy8187
  • 浏览: 76642 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

OpenNMS扩展 - SMS通知

阅读更多

OpenNMS扩展 - SMS通知

1. 概述(Overview

OpenNMS事件产生后,通过相应的配置,可以通过SMS告知事件。

通知能够发送到用户、组及任何合法的SMS PIN。短信包含文字信息,文字信息可以根据特定的事件进行定制,比如可以定制节点的名字,IP地址,服务名,错误信息等等。

2. SMS Server Tool配置

SMS Server Tool 见《Configure GSM Send SMS Guide》文档。

在配置好SMS Server Tool后,在命令行测试是否可以发送:i.e. sendsms <mobile#> ‘text message’,如果可以,则进行OpenNMS SMS配置。

3. SMS通知配置(SMS Configuration

为了给相应的用户发送SMS通知,用户需要设置一个合法的Numeric PIN,针对admin用户,设置Numeric PIN步骤:以admin身份登录,进入菜单Admin ->设置Notification StatusOn,单击Update按钮-> 进入Configure Users and Groups->Configure Users->单击Modify修改用户信息,填写用户合法Numeric PIN,如:8613662265481,单击Finish保存完成设置。

2.1 配置文件(Configuration File

通知通过守护进程“notifd”进行处理。这个守护进程默认情况下通过destinationPaths.xmlnotifd-configuration.xmlnotifications.xml三个配置文件运行管理,而三个配置文件的内容可以通知Web UI来进修改设置,最主要的配置是notificationCommands.xml,此文件是SMS的入口。

2.1.1 destinationPaths.xml

设定目标路径,指定谁得到任何通知和扩展(escalations),如下是使用smsgw建立一个destinationPaths的例子。

<path name="SMS-L1" initial-delay="1s">

<target interval="0s">

<name xmlns="">l1-support</name>

<autoNotify xmlns="">auto</autoNotify>

<command xmlns="">javaEmail</command>

</target>

<escalate delay="30s">

<target interval="0m">

<name xmlns="">DaySupportDesk</name>

<autoNotify xmlns="">auto</autoNotify>

<command xmlns="">smsgw</command>

</target>

</escalate>

<escalate delay="5m">

<target interval="0m">

<name xmlns="">NightSupportDesk</name>

<autoNotify xmlns="">auto</autoNotify>

<command xmlns="">smsgw</command>

</target>

</escalate>

</path>

2.1.2 notifd-configuration.xml

为通知守护进程配置全局属性,如:处理事件队列和自动发现(映射下降的事件与向上的事件,自动发现事件,承认(acknowledge)通知,无需执行更多的扩展)。

2.1.3 notifications.xml

实际配置的通知。配置发送通知IP地址过滤规则,目标路径及主题与内容信息,如下表示一个结点down时的通知配置:

<notification name="nodeDown" status="on">

<uei>uei.opennms.org/nodes/nodeDown</uei>

<rule>IPADDR IPLIKE *.*.*.*</rule>

<destinationPath>Email-Admin</destinationPath>

<text-message>All services are down on node %nodelabel%. New Outage records have

been created and service level availability calculations will

be impacted until this outage is resolved.

</text-message>

<subject>Notice #%noticeid%: node %nodelabel% down.</subject>

<numeric-message>111-%noticeid%</numeric-message>

</notification>

2.1.4 notificationCommands.xml

定义如何达成在destinationPaths.xml中所使用的各种配置通知方式. Email,Java Mail,页面, XMPP协议, SNMP陷阱等,Java的通知方式通常是首选,因为他们有更高的性能,更重要的低开销比调用一个外部程序。最通知方式实施这种方式。一个标准的接口存在, org.opennms.netmgt.notifd.notificationstrategy ,可以用来执行定制的Java通知方式。当然,通过命令行程序和shell脚本也是允许的。

,此文件包括了可执行文件的所在位置, 各种联络方式的别名(aliases), 以及特定传送方式尚需的其它信息等。

<command binary="true">

<name>smsgw</name>

<execute>/usr/local/bin/sendsms</execute>

<comment>for sending GSM SMS notifications</comment>

<argument streamed="false">

<switch>-np</switch>

</argument>

<argument streamed="false">

<switch>-tm</switch>

</argument>

</command>

说明:

1. <command binary="true">表示发送短信是以命令行的方式(/usr/local/bin/sendsms)来执行

2. <argument streamed="false">,表示发送的短信不以流的方式发送,即如果短信长度超出范围,会分几条发送。

注:相关的XML配置文件修改后需重启OpenNMS才能生效

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics