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才能生效

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天外流星

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值