Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding groupreporting zenpack for the first time

git-svn-id: http://zenpacks.zenoss.org/svn/zenpacks@593 db08cffe-75b9-45d1-af1a-46ad9ef135f6
  • Loading branch information...
commit 4c12011392c9249f6f4587bcc006faa866a6481a 0 parents
David Nicklay authored
Showing with 263 additions and 0 deletions.
  1. +16 −0 COPYRIGHT.txt
  2. +1 −0  MANIFEST.in
  3. +10 −0 ZenPacks.community.groupreporting.egg-info/PKG-INFO
  4. +19 −0 ZenPacks.community.groupreporting.egg-info/SOURCES.txt
  5. +1 −0  ZenPacks.community.groupreporting.egg-info/dependency_links.txt
  6. +3 −0  ZenPacks.community.groupreporting.egg-info/entry_points.txt
  7. +2 −0  ZenPacks.community.groupreporting.egg-info/namespace_packages.txt
  8. +1 −0  ZenPacks.community.groupreporting.egg-info/not-zip-safe
  9. +1 −0  ZenPacks.community.groupreporting.egg-info/top_level.txt
  10. +1 −0  ZenPacks/__init__.py
  11. +1 −0  ZenPacks/community/__init__.py
  12. +17 −0 ZenPacks/community/groupreporting/__init__.py
  13. +2 −0  ZenPacks/community/groupreporting/datasources/__init__.py
  14. +1 −0  ZenPacks/community/groupreporting/lib/__init__.py
  15. +1 −0  ZenPacks/community/groupreporting/migrate/__init__.py
  16. 0  ZenPacks/community/groupreporting/modeler/__init__.py
  17. 0  ZenPacks/community/groupreporting/modeler/plugins/__init__.py
  18. +6 −0 ZenPacks/community/groupreporting/objects/objects.xml
  19. +43 −0 ZenPacks/community/groupreporting/reports/Device Reports/groupResourcesReport.rpt
  20. +68 −0 ZenPacks/community/groupreporting/reports/plugins/allResources.py
  21. 0  ZenPacks/community/groupreporting/skins/ZenPacks.community.groupreporting/placeholder.txt
  22. +69 −0 setup.py
16 COPYRIGHT.txt
@@ -0,0 +1,16 @@
+All files in this directory and below are:
+
+Copyright (c) 2010 Zenoss, Inc. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1  MANIFEST.in
@@ -0,0 +1 @@
+graft ZenPacks
10 ZenPacks.community.groupreporting.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
+Metadata-Version: 1.1
+Name: ZenPacks.community.groupreporting
+Version: 1.10
+Summary: Group Reporting of Server Resources
+Home-page: UNKNOWN
+Author: David Nicklay
+Author-email: david.nicklay@turner.com
+License: GPLv2
+Description: This modules does reporting of Server Resources by Group or System tags
+Platform: UNKNOWN
19 ZenPacks.community.groupreporting.egg-info/SOURCES.txt
@@ -0,0 +1,19 @@
+MANIFEST.in
+README.txt
+setup.py
+ZenPacks/__init__.py
+ZenPacks.community.groupreporting.egg-info/PKG-INFO
+ZenPacks.community.groupreporting.egg-info/SOURCES.txt
+ZenPacks.community.groupreporting.egg-info/dependency_links.txt
+ZenPacks.community.groupreporting.egg-info/entry_points.txt
+ZenPacks.community.groupreporting.egg-info/namespace_packages.txt
+ZenPacks.community.groupreporting.egg-info/not-zip-safe
+ZenPacks.community.groupreporting.egg-info/top_level.txt
+ZenPacks/community/__init__.py
+ZenPacks/community/groupreporting/__init__.py
+ZenPacks/community/groupreporting/datasources/__init__.py
+ZenPacks/community/groupreporting/lib/__init__.py
+ZenPacks/community/groupreporting/migrate/__init__.py
+ZenPacks/community/groupreporting/modeler/__init__.py
+ZenPacks/community/groupreporting/modeler/plugins/__init__.py
+ZenPacks/community/groupreporting/objects/objects.xml
1  ZenPacks.community.groupreporting.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
3  ZenPacks.community.groupreporting.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[zenoss.zenpacks]
+ZenPacks.community.groupreporting = ZenPacks.community.groupreporting
+
2  ZenPacks.community.groupreporting.egg-info/namespace_packages.txt
@@ -0,0 +1,2 @@
+ZenPacks
+ZenPacks.community
1  ZenPacks.community.groupreporting.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
1  ZenPacks.community.groupreporting.egg-info/top_level.txt
@@ -0,0 +1 @@
+ZenPacks
1  ZenPacks/__init__.py
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)
1  ZenPacks/community/__init__.py
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)
17 ZenPacks/community/groupreporting/__init__.py
@@ -0,0 +1,17 @@
+
+__doc__="Group Reporting ZenPack"
+
+import Globals
+import os
+
+from Products.CMFCore.DirectoryView import registerDirectory
+
+skinsDir = os.path.join(os.path.dirname(__file__), 'skins')
+if os.path.isdir(skinsDir):
+ registerDirectory(skinsDir, globals())
+
+from Products.ZenModel.ZenPack import ZenPackBase
+
+import ZenPacks.community.groupreporting
+
+
2  ZenPacks/community/groupreporting/datasources/__init__.py
@@ -0,0 +1,2 @@
+# __init__.py
+
1  ZenPacks/community/groupreporting/lib/__init__.py
@@ -0,0 +1 @@
+# __init__.py
1  ZenPacks/community/groupreporting/migrate/__init__.py
@@ -0,0 +1 @@
+# __init__.py
0  ZenPacks/community/groupreporting/modeler/__init__.py
No changes.
0  ZenPacks/community/groupreporting/modeler/plugins/__init__.py
No changes.
6 ZenPacks/community/groupreporting/objects/objects.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<objects>
+<!-- ('', 'zport', 'dmd', 'Reports', 'Device Reports', 'groupResourcesReport') -->
+<object id='/zport/dmd/Reports/Device Reports/groupResourcesReport' module='Products.ZenModel.Report' class='Report'>
+</object>
+</objects>
43 ZenPacks/community/groupreporting/reports/Device Reports/groupResourcesReport.rpt
@@ -0,0 +1,43 @@
+<tal:block metal:use-macro="here/templates/macros/page2">
+<tal:block metal:fill-slot="contentPane">
+
+<tal:block
+ tal:define="tableName string:allResourceByGroupReport;
+ objects python:here.ReportServer.plugin('allResources', here.REQUEST);
+ tabletitle string:Group Resource Information;
+ batch python:here.ZenTableManager.getBatch(tableName,objects)">
+<tal:block metal:use-macro="here/zenuimacros/macros/zentable">
+
+<tal:block metal:fill-slot="zentablecontents">
+<!-- BEGIN TABLE CONTENTS -->
+ <tr>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'Group','Group')"/>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'Memory','Memory (MB)')"/>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'DiskSpaceUsed','Disk - Used (GB)')"/>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'DiskSpaceTotal','Disk - Total (GB)')"/>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'CPUSpeed','CPU Speed (MHz)')"/>
+ <th tal:replace="structure python:here.ZenTableManager.getTableHeader(tableName,'Devices','Devices')"/>
+ </tr>
+ <tal:block tal:repeat="r batch">
+ <tr>
+ <td class="tablevalues" tal:content="structure python:r.group.urlLink()"/>
+ <td class="tablevalues" tal:content="structure python:r.tmem"/>
+ <td class="tablevalues" tal:content="structure python:r.tdiskused"/>
+ <td class="tablevalues" tal:content="structure python:r.tdisktotal"/>
+ <td class="tablevalues" tal:content="structure python:r.tcpuspeed"/>
+ <td class="tablevalues" tal:content="structure python:r.tdevices"/>
+ </tr>
+ </tal:block>
+ <tr>
+ <td colspan="8" class="tableheader" align='center'>
+ <form metal:use-macro="here/zenTableNavigation/macros/navtool"></form>
+ </td>
+ </tr>
+<!-- END TABLE CONTENTS -->
+</tal:block>
+
+</tal:block>
+</tal:block>
+
+</tal:block>
+</tal:block>
68 ZenPacks/community/groupreporting/reports/plugins/allResources.py
@@ -0,0 +1,68 @@
+import Globals
+
+from Products.ZenReports import Utils
+
+class allResources:
+ def getCPUSpeed(self,device):
+ clockspeed = 0
+ for cpu in device.hw.cpus():
+ try:
+ clockspeed += int(cpu.clockspeed)
+ except:
+ pass
+ return clockspeed
+
+ def getDiskSpaceUsed(self,device):
+ space = 0
+ for fs in device.os.filesystems():
+ try:
+ space += int(fs.cacheRRDValue('usedBlocks')) * int(fs.blockSize)
+ except:
+ pass
+ return space
+
+ def getDiskSpaceTotal(self,device):
+ space = 0
+ for fs in device.os.filesystems():
+ try:
+ space += int(fs.totalBytes())
+ except:
+ pass
+ return space
+
+ def getMemory(self,device):
+ mem = device.hw.totalMemory
+ if mem is None or mem < 0:
+ mem = 0
+ return mem
+
+ def run(self, dmd, args):
+ report = []
+ for g in dmd.Groups.getSubOrganizers():
+ t_mem = 0
+ t_disk_used = 0
+ t_disk_total = 0
+ t_devices = 0
+ t_cpuspeed = 0
+ for d in g.getSubDevices():
+ t_mem += self.getMemory(d)
+ t_disk_used += self.getDiskSpaceUsed(d)
+ t_disk_total += self.getDiskSpaceTotal(d)
+ t_devices += 1
+ t_cpuspeed += self.getCPUSpeed(d)
+ t_disk_used = int(t_disk_used / 1024 / 1024 / 1024)
+ t_disk_total = int(t_disk_total / 1024 / 1024 / 1024)
+ t_mem = int(t_mem / 1024 / 1024)
+ report.append(
+ Utils.Record(
+ group = g,
+ groupname = g.getOrganizerName(),
+ tmem = t_mem,
+ tdiskused = t_disk_used,
+ tdisktotal = t_disk_total,
+ tcpuspeed = t_cpuspeed,
+ tdevices = t_devices
+ )
+ )
+ return report
+
0  ZenPacks/community/groupreporting/skins/ZenPacks.community.groupreporting/placeholder.txt
No changes.
69 setup.py
@@ -0,0 +1,69 @@
+################################
+# These variables are overwritten by Zenoss when the ZenPack is exported
+# or saved. Do not modify them directly here.
+# NB: PACKAGES is deprecated
+NAME = "ZenPacks.community.groupreporting"
+VERSION = "1.1"
+AUTHOR = "David Nicklay"
+LICENSE = "GPLv2"
+NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.community']
+PACKAGES = ['ZenPacks', 'ZenPacks.community', 'ZenPacks.community.groupreporting']
+INSTALL_REQUIRES = []
+COMPAT_ZENOSS_VERS = '>=2.5'
+PREV_ZENPACK_NAME = ""
+# STOP_REPLACEMENTS
+################################
+# Zenoss will not overwrite any changes you make below here.
+
+from setuptools import setup, find_packages
+
+setup(
+ # This ZenPack metadata should usually be edited with the Zenoss
+ # ZenPack edit page. Whenever the edit page is submitted it will
+ # overwrite the values below (the ones it knows about) with new values.
+ name = NAME,
+ version = VERSION,
+ author = AUTHOR,
+ license = LICENSE,
+
+ # This is the version spec which indicates what versions of Zenoss
+ # this ZenPack is compatible with
+ compatZenossVers = COMPAT_ZENOSS_VERS,
+
+ # previousZenPackName is a facility for telling Zenoss that the name
+ # of this ZenPack has changed. If no ZenPack with the current name is
+ # installed then a zenpack of this name if installed will be upgraded.
+ prevZenPackName = PREV_ZENPACK_NAME,
+
+ # Indicate to setuptools which namespace packages the zenpack
+ # participates in
+ namespace_packages = NAMESPACE_PACKAGES,
+
+ # Tell setuptools what packages this zenpack provides.
+ packages = find_packages(),
+
+ # Tell setuptools to figure out for itself which files to include
+ # in the binary egg when it is built.
+ include_package_data = True,
+
+ # The MANIFEST.in file is the recommended way of including additional files
+ # in your ZenPack. package_data is another.
+ #package_data = {}
+
+ # Indicate dependencies on other python modules or ZenPacks. This line
+ # is modified by zenoss when the ZenPack edit page is submitted. Zenoss
+ # tries to put add/delete the names it manages at the beginning of this
+ # list, so any manual additions should be added to the end. Things will
+ # go poorly if this line is broken into multiple lines or modified to
+ # dramatically.
+ install_requires = INSTALL_REQUIRES,
+
+ # Every ZenPack egg must define exactly one zenoss.zenpacks entry point
+ # of this form.
+ entry_points = {
+ 'zenoss.zenpacks': '%s = %s' % (NAME, NAME),
+ },
+
+ # All ZenPack eggs must be installed in unzipped form.
+ zip_safe = False,
+)
Please sign in to comment.
Something went wrong with that request. Please try again.