Created
October 5, 2009 18:32
-
-
Save cluther/202327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 64492bf0117eb1649aad1f6b1cec1b281ea88938 Mon Sep 17 00:00:00 2001 | |
From: Chet Luther <[email protected]> | |
Date: Mon, 5 Oct 2009 14:30:25 -0400 | |
Subject: [PATCH] Various ZenAWS fixes. | |
Fixes #5597, Fixes #5601. Reviewed by ian. | |
--- | |
.../ZenPacks/zenoss/ZenAWS/EC2Manager.py | 5 +- | |
.../zenoss/ZenAWS/libexec/zenec2modeler.py | 29 ++++-- | |
.../modeler/plugins/zenoss/aws/EC2InstanceMap.py | 5 +- | |
.../ZenPacks/zenoss/ZenAWS/objects/objects.xml | 120 +++++++++++-------- | |
.../ZenPacks.zenoss.ZenAWS/ec2InstanceStatus.pt | 4 +- | |
.../skins/ZenPacks.zenoss.ZenAWS/editEC2Manager.pt | 4 +- | |
6 files changed, 101 insertions(+), 66 deletions(-) | |
diff --git a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/EC2Manager.py b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/EC2Manager.py | |
index cd79b36..12848b8 100644 | |
--- a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/EC2Manager.py | |
+++ b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/EC2Manager.py | |
@@ -151,12 +151,13 @@ class EC2Manager(Device): | |
- def manage_editEC2Manager(self, access_id, secret, **kwargs): | |
+ def manage_editEC2Manager(self, access_id, secret, REQUEST=None, **kwargs): | |
"""edit a ec2manager""" | |
self.access_id = access_id | |
if secret and secret != self.zEC2Secret: | |
self.setZenProperty('zEC2Secret', secret) | |
- super(EC2Manager, self).manage_editDevice(**kwargs) | |
+ return super(EC2Manager, self).manage_editDevice( | |
+ REQUEST=REQUEST, **kwargs) | |
diff --git a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/libexec/zenec2modeler.py b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/libexec/zenec2modeler.py | |
index 9603e8a..0107faa 100755 | |
--- a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/libexec/zenec2modeler.py | |
+++ b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/libexec/zenec2modeler.py | |
@@ -46,22 +46,33 @@ class ZenEC2Modeler(object): | |
if self.opts.file: | |
self.conn = boto.connect_ec2() | |
else: | |
+ if not self.opts.userkey: | |
+ print "ERROR:No access key ID has been provided" | |
+ sys.exit(1) | |
+ elif not self.opts.privatekey: | |
+ print "ERROR:No secret access key has been provided" | |
+ sys.exit(1) | |
+ | |
self.conn = boto.connect_ec2(self.opts.userkey, | |
self.opts.privatekey) | |
def makeMaps(self): | |
instances = [] | |
- for res in self.conn.get_all_instances(): | |
- for inst in res.instances: | |
- if inst.state == 'terminated': continue | |
- if not inst.monitored: inst.monitor() | |
- ec2inst = self.buildProxyDict(inst) | |
- instances.append(ec2inst) | |
- if self.opts.show: | |
- pprint.pprint(instances) | |
+ try: | |
+ for res in self.conn.get_all_instances(): | |
+ for inst in res.instances: | |
+ if inst.state == 'terminated': continue | |
+ if not inst.monitored: inst.monitor() | |
+ ec2inst = self.buildProxyDict(inst) | |
+ instances.append(ec2inst) | |
+ except boto.exception.EC2ResponseError, ex: | |
+ print "ERROR:%s" % ex.error_message | |
else: | |
- pickle.dump(instances, sys.stdout) | |
+ if self.opts.show: | |
+ pprint.pprint(instances) | |
+ else: | |
+ pickle.dump(instances, sys.stdout) | |
def buildProxyDict(self, inst): | |
diff --git a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/modeler/plugins/zenoss/aws/EC2InstanceMap.py b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/modeler/plugins/zenoss/aws/EC2InstanceMap.py | |
index 9a9afff..48ab75c 100644 | |
--- a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/modeler/plugins/zenoss/aws/EC2InstanceMap.py | |
+++ b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/modeler/plugins/zenoss/aws/EC2InstanceMap.py | |
@@ -45,5 +45,8 @@ class EC2InstanceMap(PythonPlugin): | |
def process(self, device, results, log): | |
om = self.objectMap() | |
- om.setInstances = results | |
+ if results.startswith('ERROR:'): | |
+ log.warn(results.replace('ERROR:', '')) | |
+ else: | |
+ om.setInstances = results | |
return om | |
diff --git a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/objects/objects.xml b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/objects/objects.xml | |
index b3e955d..185a73f 100644 | |
--- a/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/objects/objects.xml | |
+++ b/ZenPacks.zenoss.ZenAWS/ZenPacks/zenoss/ZenAWS/objects/objects.xml | |
@@ -107,7 +107,7 @@ True | |
</object> | |
</tomanycont> | |
<tomanycont id='graphDefs'> | |
-<object id='CPU' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='CPU Utilization' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
<property type="int" id="height" mode="w" > | |
100 | |
</property> | |
@@ -115,7 +115,7 @@ True | |
500 | |
</property> | |
<property type="string" id="units" mode="w" > | |
-Percent | |
+percent | |
</property> | |
<property type="boolean" id="log" mode="w" > | |
False | |
@@ -144,10 +144,10 @@ LINE | |
False | |
</property> | |
<property type="string" id="format" mode="w" > | |
-%5.2lf%s | |
+%6.2lf%% | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Used | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -161,7 +161,7 @@ AVERAGE | |
</object> | |
</tomanycont> | |
</object> | |
-<object id='Disk Bytes' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='Disk Throughput - Volume' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
<property type="int" id="height" mode="w" > | |
100 | |
</property> | |
@@ -169,7 +169,7 @@ AVERAGE | |
500 | |
</property> | |
<property type="string" id="units" mode="w" > | |
-Bytes | |
+bytes/sec | |
</property> | |
<property type="boolean" id="log" mode="w" > | |
False | |
@@ -178,7 +178,7 @@ False | |
False | |
</property> | |
<property type="int" id="miny" mode="w" > | |
--1 | |
+0 | |
</property> | |
<property type="int" id="maxy" mode="w" > | |
-1 | |
@@ -204,7 +204,7 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Read | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -233,7 +233,7 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Write | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -247,7 +247,7 @@ AVERAGE | |
</object> | |
</tomanycont> | |
</object> | |
-<object id='Disk Operations' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='Disk Throughput - Operations' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
<property type="int" id="height" mode="w" > | |
100 | |
</property> | |
@@ -255,7 +255,7 @@ AVERAGE | |
500 | |
</property> | |
<property type="string" id="units" mode="w" > | |
-Operations | |
+ops/sec | |
</property> | |
<property type="boolean" id="log" mode="w" > | |
False | |
@@ -290,7 +290,7 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Read | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -319,7 +319,7 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Write | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -333,7 +333,7 @@ AVERAGE | |
</object> | |
</tomanycont> | |
</object> | |
-<object id='Network' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='Network Throughput' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
<property type="int" id="height" mode="w" > | |
100 | |
</property> | |
@@ -341,7 +341,7 @@ AVERAGE | |
500 | |
</property> | |
<property type="string" id="units" mode="w" > | |
-Bytes | |
+bits/sec | |
</property> | |
<property type="boolean" id="log" mode="w" > | |
False | |
@@ -376,11 +376,14 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Inbound | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
</property> | |
+<property type="string" id="rpn" mode="w" > | |
+8,* | |
+</property> | |
<property type="string" id="dpName" mode="w" > | |
zencw2_NetworkIn | |
</property> | |
@@ -405,11 +408,14 @@ False | |
%5.2lf%s | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Outbound | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
</property> | |
+<property type="string" id="rpn" mode="w" > | |
+8,* | |
+</property> | |
<property type="string" id="dpName" mode="w" > | |
zencw2_NetworkOut | |
</property> | |
@@ -512,7 +518,7 @@ True | |
</object> | |
</tomanycont> | |
<tomanycont id='graphDefs'> | |
-<object id='CPU' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='CPU Utilization' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
<property type="int" id="height" mode="w" > | |
100 | |
</property> | |
@@ -520,7 +526,7 @@ True | |
500 | |
</property> | |
<property type="string" id="units" mode="w" > | |
-Percent | |
+percent | |
</property> | |
<property type="boolean" id="log" mode="w" > | |
False | |
@@ -549,10 +555,10 @@ LINE | |
False | |
</property> | |
<property type="string" id="format" mode="w" > | |
-%5.2lf%s | |
+%6.2lf%% | |
</property> | |
<property type="string" id="legend" mode="w" > | |
-${graphPoint/id} | |
+Used | |
</property> | |
<property type="long" id="limit" mode="w" > | |
-1 | |
@@ -566,7 +572,7 @@ AVERAGE | |
</object> | |
</tomanycont> | |
</object> | |
-<object id='Disk Bytes' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'> | |
+<object id='Disk Throughput - Volume' module='Products.ZenModel.GraphDefinition' class='GraphDefinition'% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment