Subject: |
RE: REST method for overall device status? |
Author: |
Patrick McMahon |
Posted: |
2017-07-31 18:20 |
Checkout the zenoss json api, the "status" property in "data" might be what you're after
https://www.zenoss.com/services-support/documentation/zenoss-json-api-0
You can Google for more Documentation / Examples scattered through github, zenoss knowledge base, zenoss wiki, etc...
Rough example that uses json_api.sh:
zenoss_api device_router DeviceRouter getInfo '{"keys":["status"], "uid":"/zport/dmd/Devices/The/Device/Class/devices/yourdevicename"}'
Expect output like...
{{ "uuid": "blah", "action": "DeviceRouter", "result": { "disabled": false, "data": { "status": true, "uid": "/zport/dmd/Devices/The/Device/Class/devices/yourdevicename" }, "success": true }, "tid": 1, "type": "rpc", "method": "getInfo"}
------------------------------
Patrick McMahon
Sr. Client Services Engineer
Zenoss
------------------------------
Subject: |
RE: REST method for overall device status? |
Author: |
Kapil Khanduja |
Posted: |
2018-04-26 05:19 |
Hi Patrick,
I had the similar requirement of fetching zenoss device's information through "getInfo" method under "DeviceRouter" action. However this method seems to be working only in Device Organizer and not at Device level.
Everytime I try to execute this method I get - "msg": "ObjectNotFoundException: Cannot find \"/zport/dmd/Devices/Server/Windows/XYZServer\". KeyError: 'XYZServer'", "type": "exception", "success": false}, "tid": 1, "type": "rpc", "method": "getInfo"
And if I execute the same method on Device Organizer till "/zport/dmd/Devices/Server/Windows", I get the desired results.
I am seeking a device information in particular.
Can you please suggest something here.
------------------------------
Kapil Khanduja
Developer
------------------------------
Subject: |
RE: REST method for overall device status? |
Author: |
Jay Stanley |
Posted: |
2018-06-28 08:09 |
@KapilIt looks like you are not using the proper Uid.
If
XYZServer is the device name and
/Server/Windows/ is the device class, the Uid is most likely:
/zport/dmd/Devices/Server/Windows/devices/XYZServer
You can get the Uid by using the getDevices API call or by looking at the Url when viewing a device.

------------------------------
jstanley
------------------------------
Subject: |
RE: REST method for overall device status? |
Author: |
randy clark |
Posted: |
2018-08-15 03:15 |
Like my
wireless home security systems, I make sure it's app is working fine.
------------------------------
randy clark
sas
San Fernando
------------------------------
Subject: |
RE: REST method for overall device status? |
Author: |
Steve Aiello |
Posted: |
2018-08-24 12:40 |
Leveraging
zenApiLib, you could use the following code to get the devices in a deviceClass and their statuses in a
single API call.
#!/bin/env python
import zenApiLib
zenApi = zenApiLib.zenConnector()
zenApi.setRouter('DeviceRouter')
for pagedResult in zenApi.pagingMethodCall('getDevices', uid='/zport/dmd/Devices', keys=['name', 'status']):
if pagedResult['result']:
for dev in pagedResult['result']['devices']:
print "{} - {}".format(dev['name'], dev['status'])
else:
print "API call success was false"
For Reference, raw API call payload:
{"action":"DeviceRouter","method":"getDevices","data":[{"params":{},"uid":"/zport/dmd/Devices","keys":["name","status"],"page":1,"start":0,"limit":100,"sort":"name","dir":"ASC"}],"type":"rpc","tid":1}
------------------------------
Steve Aiello
Zenoss
------------------------------