Re: Http post issue
Ronald Roskens <[email protected]> Tue, 24 Jul 2018 11:52:04 -0500
| Newsgroups | gmane.network.opennms.general |
|---|---|
| Message-ID | <[email protected]> |
In notifications.xml its not varbind/vbvalue but parameter. See the example in $OPENNMS_HOME/etc/examples/notifications.xml:
<notification name="httpPost" status="on" >
<uei>uei.opennms.org/nodes/nodeDown</uei>
<rule>IPADDR != '0.0.0.0'</rule>
<destinationPath>httpPostNotifier</destinationPath>
<text-message>All services are down on node %nodeid%</text-message>
<subject>node: %nodeid% down</subject>
<parameter name="url" value="http://172.16.1.1/cgi-bin/noauth/rt.pl" />
<parameter name="timeout" value="2000" />
<parameter name="retries" value="1" />
<parameter name="post-NodeID" value="%nodeid%" />
<parameter name="post-event" value="%eventid%" />
<parameter name="post-message" value="-tm" />
<parameter name="result-match" value="(?s).*OK\\s+([0-9]+).*" />
<parameter name="sql" value="UPDATE alarms SET tticketID=${1} WHERE lastEventID = %eventid%" />
</notification>
Ron
> On Jul 23, 2018, at 11:49 PM, simba <[email protected]> wrote:
>
> I'm new to openNMS and am running the Windows version 22.0.1. I'm trying to
> do an http post to an external server when an alarm is detected in openNMS.
> I'm trying to http post to an axis io module to pulse an input when an SNMP
> trap for power failure on a server triggers an alarm.
>
> Snapshots of my configuration are as follows:
>
> NOTIFICATIONCOMMANDS.XML
>
> <command binary="false">
> <name>httpPost</name>
>
> <execute>org.opennms.netmgt.notifd.HttpNotificationStrategy</execute>
> <comment>Class for sending notifications with an HTTP Post</comment>
> <argument streamed="false">
> <switch>url</switch>
> </argument>
> <argument streamed="false">
> <switch>timeout</switch>
> </argument>
> <argument streamed="false">
> <switch>retries</switch>
> </argument>
> <argument streamed="false">
> <switch>-tm</switch>
> </argument>
> <argument streamed="false">
> <switch>result-match</switch>
> </argument>
> <argument streamed="false">
> <switch>sql</switch>
> </argument>
> <argument streamed="false">
> <switch>post-NodeID</switch>
> </argument>
> <argument streamed="false">
> <switch>post-event</switch>
> </argument>
> <argument streamed="false">
> <switch>post-nasid</switch>
> </argument>
> <argument streamed="false">
> <switch>post-queue</switch>
> </argument>
> <argument streamed="false">
> <switch>post-message</switch>
> </argument>
> </command>
> </notification-commands>
>
> NOTIFICATIONS.XML
>
> <notification name="PowerSupplyFault" status="on" writeable="yes">
>
> <uei>uei.opennms.org/traps/IDRAC-MIB-SMIv2/alertPowerSupplyFailure</uei>
> <description>Power supply failure</description>
> <rule>(IPADDR IPLIKE 172.255.2.*)</rule>
> <destinationPath>PowerSupplyFault</destinationPath>
> <text-message>Power failure detected</text-message>
> <subject>Notice #%noticeid%</subject>
> <numeric-message>111-%noticeid%</numeric-message>
> <varbind>
> <vbname>url</vbname>
>
> <vbvalue>http://172.255.2.17/axis-cgi/io/output.cgi?action=1:1000/300\500/300\</vbvalue>
> </varbind>
> </notification>
> </notifications>
>
> DESTINATION PATHS.XML
>
> </path>
> <path name="PowerSupplyFault" initial-delay="0s">
> <target>
> <name>admin</name>
> <autoNotify>on</autoNotify>
> <command>httpPost</command>
> </target>
> <target interval="0m">
> <name>Admin</name>
> <autoNotify>on</autoNotify>
> <command>httpPost</command>
> </target>
>
> My notifd log file is showing the following:
>
> org.opennms.netmgt.notifd.HttpNotificationStrategy.send(HttpNotificationStrategy.java:109)
> [opennms-services-22.0.1.jar:?]
> at org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69)
> [opennms-services-22.0.1.jar:?]
> at
> org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274)
> [opennms-services-22.0.1.jar:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_172]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_172]
> at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
> Caused by: org.apache.http.ProtocolException: Target host is not specified
> at
> org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:70)
> ~[httpclient-4.5.2.jar:4.5.2]
> at
> org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
> ~[httpclient-4.5.2.jar:4.5.2]
> at
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
> ~[httpclient-4.5.2.jar:4.5.2]
> ... 9 more
> 2018-07-24 13:00:50,676 ERROR [NotificationTask-10] o.o.n.n.ClassExecutor:
> Throwable received while sending message
> java.lang.RuntimeException: Problem with HTTP post: null
> at
> org.opennms.netmgt.notifd.HttpNotificationStrategy.send(HttpNotificationStrategy.java:115)
> ~[opennms-services-22.0.1.jar:?]
> at org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69)
> [opennms-services-22.0.1.jar:?]
> at
> org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274)
> [opennms-services-22.0.1.jar:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_172]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_172]
> at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
>
> I can't tell where I'm getting it wrong. Can you assist?
>
> Regards,
>
> Simba
>
>
>
>
>
> --
> Sent from: http://opennms.530661.n2.nabble.com/OpenNMS-discuss-f529575.html
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Please read the OpenNMS Mailing List FAQ:
> http://www.opennms.org/index.php/Mailing_List_FAQ
>
> opennms-discuss mailing list
>
> To *unsubscribe* or change your subscription options, see the bottom of this page:
> https://lists.sourceforge.net/lists/listinfo/opennms-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss