| Home | Docs | Support | Buy | Blog | Forums |
|
Send EventsHow to send an event from an external source Events can be sent to Zenoss through the UI but also through a programmatic interface. This how to will describe adding a device using that interface. Using a REST callSending an event through a rest call can be done by a simple web get. In this example we will use wget to send an event. If you use wget don't for get to escape the "&" or wrap the URL in single quotes. [zenos@zenoss $] wget 'http://admin:zenoss@MYHOST:8080/zport/dmd/ZenEventManager/manage_addEvent?device=MYDEVICE&component=MYCOMPONENT&summary=MYSUMMARY&severity=4&eclass=EVENTCLASS&eventClassKey=EVENTCLASSKEY Using zensendeventzensendevent is a handy little tool that should work on any system that has python available. It allows you to send an event to your Zenoss system and associate it with Device/Component. zensendevent --device MYDEVICE --component DEVICECOMPONENT --classkey MYEVENTCLASSKET --severity Info|Debug|Clear|Error|Warning|Critical --class MYEVENTCLASS --server MYZENOSSSERVER --auth admin:zenoss (default) Using XML-RPCTo send an event to zenoss using XML-RPC you will first need to create a dictionary (in perl a hash) that will represent the event. Zenoss will need at a minimum the following fields:
You can send an event to Zenoss via an interactive session with the python interpreter as follows: >>> from xmlrpclib import ServerProxy See below for examples in other languages. Event Database Dictionary
Example Usage in Other LanguagesPlease note that we are a python shop and may not be able to answer specific questions about XML-RPC clients written in other languages. PerlSend an event via perl using RPC::XML::Client: require RPC::XML; RubyThis is an example of an interactive ruby session (the returns have been omitted for the sake of clarity). Note, however, that the Ruby standard library is under active development in general, and specifically, the XML-RPC lib in Ruby is not stable. As of Feb 2007, there is a great deal of on-going discussion regarding XML-RPC in Ruby by Ruby developers and contributors. The following is known to work in previous versions of Ruby: irb(main):001:0> require "xmlrpc/client" JavaI spent too much time trying to get a Java example running (using the lastest 3.x XML-RPC libs from Apache). Using their example as well as many I found on the net, I consistently got lots of errors, only some of which I was able to fix. I tried with Java 1.3, 1.4.2, and 1.5 -- all returned nearly identical results. If someone can provide a modern, working example, we will post it here. But we don't have to time to figure this one out right now. |
