Skip to content

Commit

Permalink
Merge branch 'release/1.0.0beta3'
Browse files Browse the repository at this point in the history
  • Loading branch information
cluther committed Sep 12, 2013
2 parents 3720d9b + e2b691c commit 43e033e
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ Use the following steps to start monitoring XenServer using the Zenoss web inter
Alternatively you can use zenbatchload to add XenServer endpoints from the command line. To do this, you must create a file with contents similar to the following. Replace all values in angle brackets with your values minus the brackets. Multiple endpoints can be added under the same ''/Devices/XenServer'' section.

<syntaxhighlight lang="text">
/Devices/XenServer
test-xenserver-pool zXenServerAddresses=[&lt;address&gt;], zXenServerUsername='&lt;username&gt;', zXenServerPassword='&lt;password&gt;'
/Devices/XenServer loader='XenServer', loader_arg_keys=['name', 'address', 'username', 'password', 'collector']
my-xenserver-pool name='my-xenserver-pool', address='<address>', username='<username>', password='<password>', collector='localhost'
</syntaxhighlight>

You can then load the endpoint(s) with the following command.
Expand Down
7 changes: 7 additions & 0 deletions ZenPacks/zenoss/XenServer/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
permission="zenoss.View"
/>

<!-- Device Loaders -->
<utility
name="XenServer"
provides="Products.ZenModel.interfaces.IDeviceLoader"
component=".deviceloaders.XenServerEndpointLoader"
/>

<!-- API: Facades -->
<adapter
name="xenserver"
Expand Down
46 changes: 46 additions & 0 deletions ZenPacks/zenoss/XenServer/deviceloaders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2013, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

'''
XenServer device loaders.
'''

import logging
LOG = logging.getLogger('zen.XenServer')

from zope.interface import implements

from Products.Zuul import getFacade
from Products.ZenModel.interfaces import IDeviceLoader


class XenServerEndpointLoader(object):
'''
XenServer endpoint loader.
Used by including lines such as the following in a zenbatchload
input file::
/Devices/XenServer loader='XenServer', loader_arg_keys=['name', 'address', 'username', 'password', 'collector']
my-xenserver-endpoint name='my-xenserver-endpoint', address='xenserver1.example.com', username='root', password='Xen4TW', collector='localhost'
'''

implements(IDeviceLoader)

def load_device(self, dmd, name=None, address=None, username=None, password=None, collector='localhost'):
if name is None:
name = address

if not all((address, username, password)):
LOG.error(
"XenServerEndpointLoader: address, username and password are "
"required arguments")

return getFacade('xenserver', dmd).add_xenserver(
name, address, username, password, collector=collector)
19 changes: 11 additions & 8 deletions ZenPacks/zenoss/XenServer/modeler/incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import logging
LOG = logging.getLogger('zen.XenServer')

from collections import OrderedDict
from collections import defaultdict, OrderedDict

from twisted.internet.defer import inlineCallbacks, returnValue

Expand Down Expand Up @@ -114,7 +114,10 @@ def get_objectmap(self, event):
'''
Return the appropriate ObjectMap for event.
'''
model_class = XENAPI_CLASSMAP[event['class']]
model_class = XENAPI_CLASSMAP.get(event['class'])
if not model_class:
# This is not an object type we care about.
return

# Building the ObjectMap differs for _metrics classes
# because they unfortunately don't contain their own back-
Expand Down Expand Up @@ -149,15 +152,15 @@ def full_datamaps(self, events):
Return a list of datamaps representing a full model.
'''
sr_oms = []
vdi_oms = {}
vdi_oms = defaultdict(list)
host_oms = []
host_cpu_oms = {}
pbd_oms = {}
pif_oms = {}
host_cpu_oms = defaultdict(list)
pbd_oms = defaultdict(list)
pif_oms = defaultdict(list)
network_oms = []
vm_oms = []
vbd_oms = {}
vif_oms = {}
vbd_oms = defaultdict(list)
vif_oms = defaultdict(list)
vm_appliance_oms = []
pool_oms = []

Expand Down
8 changes: 4 additions & 4 deletions impact.yuml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
[VBD]1-0..1>[HardDisk;(virtual){bg:deepskyblue}]
//
// CloudStack Impacts
[note: CloudStack{bg:cadetblue}]-[CloudStack Host{bg:cadetblue}]
[note: CloudStack{bg:cadetblue}]-[CloudStack VM{bg:cadetblue}]
[note: CloudStack{bg:cadetblue}]-[SystemVM{bg:cadetblue}]
[note: CloudStack{bg:cadetblue}]-[RouterVM{bg:cadetblue}]
[note: CloudStack;ZenPack{bg:cadetblue}]-[CloudStack Host{bg:cadetblue}]
[note: CloudStack;ZenPack{bg:cadetblue}]-[CloudStack VM{bg:cadetblue}]
[note: CloudStack;ZenPack{bg:cadetblue}]-[SystemVM{bg:cadetblue}]
[note: CloudStack;ZenPack{bg:cadetblue}]-[RouterVM{bg:cadetblue}]
[Host{bg:aquamarine}]1-0..1>[CloudStack Host{bg:cadetblue}]
[VM{bg:aquamarine}]1-0..1>[CloudStack VM{bg:cadetblue}]
[VM{bg:aquamarine}]1-0..1>[SystemVM{bg:cadetblue}]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.zenoss.XenServer"
VERSION = "1.0.0beta2"
VERSION = "1.0.0beta3"
AUTHOR = "Zenoss"
LICENSE = "GPLv2"
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.zenoss']
Expand Down

0 comments on commit 43e033e

Please sign in to comment.