TECHZEN Zenoss User Community ARCHIVE  

Zenoss XML-RPC API

Subject: Zenoss XML-RPC API
Author: Matt
Posted: 2014-11-05 13:58

I have a problem with the XML-RPC API of Zenoss.

I created a python script based on this guide, which adds devices automatically to Zenoss:
http://community.zenoss.org/docs/DOC-3805

It works, but I still have two issues:

1.)
Whenever a device gets added to Zenoss the response contains the log entries of zendisc.
Obviously the xml parser expects a xml response, so it fails with an exception, which causes my whole script to fail.

\n 2014-11-05 11:53:21 INFO zen.ZenDisc Connecting to localhost:8789 \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc Connected to ZenHub \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc Looking for 192.168.0.20 \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc Result: Discovered device 192.168.0.20. \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc skipping WMI-based collection, PySamba zenpack not installed \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc No Python plugins found for 192.168.0.20 \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc No command plugins found for 192.168.0.20 \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc SNMP collection device 192.168.0.20 \n \n\n 2014-11-05 11:53:21 INFO zen.ZenDisc plugins: zenoss.snmp.DeviceMap, zenoss.snmp.NewDeviceMap, zenoss.snmp.InterfaceMap, zenoss.snmp.IpServiceMap, zenoss.snmp.IpV6ServiceMap

2.)
The xml parser can't decode the response from Zenoss.
I always get a "ResponseError" exception from xmlrpclib.

\n\n\n\n1\n\n\n\n

This is most likely a problem of the xml parser, or it might be an encoding issue.

Hope someone can help me.

Thanks.



Subject: Zenoss XML-RPC API
Author: [Not Specified]
Posted: 2014-11-06 08:13

Have never used the xml-rpc api, but have success using the json interface. You would need to use the addDevice method within the DeviceRouter class.
There is an example script here, but the options within the json interfaces are many:
https://gist.github.com/hackeys/6368351#file-bulkdevicesadd-py
--Rob




Subject: Thanks for the tip!
Author: Matt
Posted: 2014-11-06 14:55

Thanks for the tip!

I transformed my script and now it's working fine. :)



< Previous
SNMP v3 issue with Proliant DL385G8 servers
  Next
Community Meeting Agenda
>