Archived community.zenoss.org | full text search
Skip navigation
1 2 Previous Next 74813 Views 15 Replies Latest reply: Aug 1, 2012 11:48 AM by Shane Scott RSS
Shane Scott ZenossMaster 1,373 posts since
Jul 6, 2009
Currently Being Moderated

Jul 15, 2009 1:58 PM

Zenoss Interface Errors Report (Interface Util Report style)

Interest was expressed about my interface report which creates an output much like that of the interfaces utilization report found under performance reports. Corrections, comments, suggestions and otherwise are welcome. Have fun.

Create the two files below. One is a plugin [interfaceerrs.py] which gathers the data points (in/out errors in this case), the second is the report [Interface_Errors.rpt] which uses the plugin to populate the screen.

_______[/opt/zenoss/Products/ZenReports/plugins/interfaceerrs.py]
import Globals
from Products.ZenReports import Utils, Utilization
import re

class interfaceerrs:
"The interface error report"

def run(self, dmd, args):
summary = Utilization.getSummaryArgs(dmd, args)
report = []
for d in Utilization.filteredDevices(dmd, args):

isLocal = re.compile(d.zLocalInterfaceNames)
for i in d.os.interfaces():
if isLocal.match(i.name()): continue
if not i.monitored(): continue
if i.snmpIgnore(): continue
if not i.speed: continue

results = i.getRRDValues(['ifInErrors',
'ifOutErrors'],
**summary)
inerror = results.get('ifInErrors',
results.get('ifInErrors', None))
outerror = results.get('ifOutErrors',
results.get('ifOutErrors', None))

r = Utils.Record(device=d,
interface=i,
speed=i.speed,
inerror=inerror,
outerror=outerror)
report.append(r)
return report
_______________________[end interfaceerrs.py]

_______[/opt/zenoss/Products/ZenReports/reports/Performance_Reports/Interface_Errors.rpt]
<tal:block tal:define="
tableName string: interfaceerrorsreport;
tm here/ZenTableManager;
tableState python:tm.getTableState(tableName, sortedHeader='inerror',
sortedSence='desc');
objects python:here.ReportServer.plugin('interfaceerrs', tableState);
objects python: (hasattr(request, 'doExport') and list(objects)) or objects;
exportFields python:['device', 'speed', 'interface', 'inerror', 'outerror'];
batch python:here.ZenTableManager.getBatch(tableName,objects,sortedHeader='inerror', sortedSence='desc');
">
<tal:block metal:use-macro="here/reportMacros/macros/exportableReport">
<tal:block metal:fill-slot="report">

<tal:block metal:use-macro="here/templates/macros/page1">
<tal:block metal:fill-slot="breadCrumbPane">
<span metal:use-macro="here/miscmacros/macros/reportBreadCrumbsList"/>
</tal:block>
<tal:block metal:fill-slot="contentPane">

<tal:block metal:use-macro="here/reportMacros/macros/utilizationForm"/>

<form method="POST" tal:attributes="action request/URL; name string:deviceList"
tal:define="tabletitle string:Overall Network Errors;
showfilterbox python:False;
tblcolspan string:7">
<tal:block metal:use-macro="here/zenuimacros/macros/zentable">
<tal:block metal:fill-slot="zentablecontents">

<tr>
<th tal:replace="structure python:here.ZenTableManager.getTableHeader(
tableName,'device','Device')"/>
<th tal:replace="structure python:here.ZenTableManager.getTableHeader(
tableName,'interface','Interface')"/>
<th tal:replace="structure python:here.ZenTableManager.getTableHeader(
tableName,'speed','Speed')"/>
<th tal:replace="structure python:here.ZenTableManager.getTableHeader(
tableName,'inerror','Incoming Errors')"/>
<th tal:replace="structure python:here.ZenTableManager.getTableHeader(
tableName,'outerror','Outgoing Errors')"/>
</tr>
<tal:block tal:repeat="r batch">
<tr tal:define="odd repeat/r/odd"
tal:attributes="class python:test(odd,'odd','even')">
<td><a tal:attributes="href r/device/getPrimaryUrlPath"
tal:content="r/device/id"/></td>
<td><a tal:attributes="href r/interface/getPrimaryUrlPath"
tal:content="r/interface/id"/></td>
<td tal:content="python: r.humanBits(r.speed)"/>
<td tal:content="python: r.fmt('%8.2f', r.inerror)"/>
<td tal:content="python: r.fmt('%8.2f', r.outerror)"/>
</tr>
</tal:block>
<tr>
<td colspan="7" class="tableheader" align='center'>
<form metal:use-macro="here/zenTableNavigation/macros/navtool"/>
</td>
</tr>
</tal:block>
</tal:block>
</form>

</tal:block>
</tal:block>
</tal:block>

</tal:block>
</tal:block>
_______________________[end Interface_Errors.rpt]

Once the two files are created, execute as zenoss user 'python /opt/zenoss/Products/ZenReports/ReportLoader.py --force' to install the rpt [Interface_Errors.rpt]. You'll likely need to restart zenoss to cycle the reportserver (if anyone knows how to restart the report server please post it.) This is needed so it can find the new plugin [interfaceerrs.py].

Please post your results, or let me know if you have any trouble.

BTW, I developed the report for Zenoss 2.4.1 / 2.4.2, so if you have 2.4 or higher you should be good.

--Hackman238
1 2 Previous Next

More Like This

  • Retrieving data ...