Open Pobice opened 12 years ago
change init.py:
row = { 'Device': d.getPrettyLink(), 'Failed Pings': d.getPingStatusString() }
to
row = { 'Device': d.getPrettyLink(), 'Failed Pings': d.getPingStatusNumber() }
Also there is a bug in the getPingStatus and getPingStatusNumber it show always 1 ping count.
Thanks - I suspected as much.
Looks like I may be able to do something with the 'facades' to get the failed pint count zep_facade = getFacade('zep') zep_facade.getDevicePingIssues() [('user-TOSH.home', 1, 51)]
This works for me:
import json def getJSONDownDevices(self, path='', prodstate=''): """ Given a report class path, returns a list of links to child reports in a format suitable for a TableDatasource. """
# references to self should be taken as referring to zport
# Add the base path to the path given
path = '/zport/dmd/Devices/' + path.strip('/')
if prodstate=='':
prodstate='1000'
# Create the empty structure of the response object
response = { 'columns': ['Device','Failed Pings'], 'data': [] }
# Retrieve the ReportClass object for the path given. If
# nothing can be found, return an empty response
try:
deviceClass = self.dmd.unrestrictedTraverse(path)
except KeyError:
return json.dumps(response)
zep_facade = getFacade('zep')
issues = zep_facade.getDevicePingIssues()
for x in issues:
device = x[0]
d = self.dmd.Devices.findDevice(device)
if d.getPingStatus()>0 and d.productionState>=int(prodstate) :
devicesinclass = deviceClass.getSubDevices()
if d in devicesinclass:
row = { 'Device': d.getPrettyLink(), 'Failed Pings': x[2] }
response['data'].append(row)
return json.dumps(response)
Zenpack works ok in Zenoss 4 - apart from ping count only shows "Down"