[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a

Garrett Holmstrom gholms at fedoraproject.org
Sun Jun 16 02:30:47 UTC 2013


The following commit has been merged in the master branch:
commit c50d00be36d6a91e1199a067488359525792ce9b
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Fri Mar 22 17:42:24 2013 -0700

    Implement PutMetricAlarm
    
    Fixes TOOLS-266

diff --git a/bin/euwatch-put-metric-alarm b/bin/euwatch-put-metric-alarm
new file mode 100755
index 0000000..21a3823
--- /dev/null
+++ b/bin/euwatch-put-metric-alarm
@@ -0,0 +1,6 @@
+#!/usr/bin/python -tt
+
+import euca2ools.commands.monitoring.putmetricalarm
+
+if __name__ == '__main__':
+    euca2ools.commands.monitoring.putmetricalarm.PutMetricAlarm.run()
diff --git a/euca2ools/commands/monitoring/putmetricalarm.py b/euca2ools/commands/monitoring/putmetricalarm.py
new file mode 100644
index 0000000..17156f6
--- /dev/null
+++ b/euca2ools/commands/monitoring/putmetricalarm.py
@@ -0,0 +1,88 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2013, Eucalyptus Systems, Inc.
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms, with or
+# without modification, are permitted provided that the following conditions
+# are met:
+#
+#   Redistributions of source code must retain the above
+#   copyright notice, this list of conditions and the
+#   following disclaimer.
+#
+#   Redistributions in binary form must reproduce the above
+#   copyright notice, this list of conditions and the
+#   following disclaimer in the documentation and/or other
+#   materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from euca2ools.commands.argtypes import delimited_list
+from euca2ools.commands.monitoring import CloudWatchRequest
+from euca2ools.commands.monitoring.argtypes import cloudwatch_dimension
+from requestbuilder import Arg, MutuallyExclusiveArgList
+
+
+class PutMetricAlarm(CloudWatchRequest):
+    DESCRIPTION = 'Create or update an alarm'
+    ARGS = [Arg('AlarmName', metavar='ALARM',
+                help='name of the alarm (required)'),
+            Arg('--comparison-operator', dest='ComparisonOperator',
+                choices=('GreaterThanOrEqualToThreshold',
+                         'GreaterThanThreshold', 'LessThanThreshold',
+                         'LessThanOrEqualToThreshold'), required=True,
+                help='''arithmetic operator with which the comparison with the
+                threshold will be made (required)'''),
+            Arg('--evaluation-periods', dest='EvaluationPeriods', type=int,
+                metavar='COUNT', required=True, help='''number of consecutive
+                periods for which the value of the metric needs to be compared
+                to the threshold (required)'''),
+            Arg('--metric-name', dest='MetricName', metavar='METRIC',
+                required=True,
+                help="name for the alarm's associated metric (required)"),
+            Arg('--namespace', dest='Namespace', metavar='NAMESPACE',
+                required=True,
+                help="namespace for the alarm's associated metric (required)"),
+            Arg('--period', dest='Period', metavar='SECONDS', type=int,
+                required=True, help='''period over which the specified
+                statistic is applied (required)'''),
+            Arg('--statistic', dest='Statistic', choices=('Average', 'Maximum',
+                'Minimum', 'SampleCount', 'Sum'), required=True,
+                help='statistic on which to alarm (required)'),
+            Arg('--threshold', dest='Threshold', metavar='FLOAT', type=float,
+                required=True,
+                help='value to compare the statistic against (required)'),
+            Arg('--actions-enabled', dest='ActionsEnabled',
+                choices=('true', 'false'), help='''whether this alarm's actions
+                should be executed when it changes state'''),
+            Arg('--alarm-actions', dest='AlarmActions.member',
+                metavar='ARN1,ARN2,...', type=delimited_list(','),
+                help='''ARNs of SNS topics to publish to when the alarm changes
+                to the ALARM state'''),
+            Arg('--alarm-description', dest='AlarmDescription',
+                metavar='DESCRIPTION', help='description of the alarm'),
+            Arg('-d', '--dimensions', dest='Dimensions.member',
+                metavar='KEY1=VALUE1,KEY2=VALUE2,...',
+                type=delimited_list(',', item_type=cloudwatch_dimension),
+                help="dimensions for the alarm's associated metric"),
+            Arg('--insufficient-data-actions', metavar='ARN1,ARN2,...',
+                dest='InsufficientDataActions.member',
+                type=delimited_list(','), help='''ARNs of SNS topics to publish
+                to when the alarm changes to the INSUFFICIENT_DATA state'''),
+            Arg('--ok-actions', dest='OKActions.member',
+                metavar='ARN1,ARN2,...', type=delimited_list(','),
+                help='''ARNs of SNS topics to publish to when the alarm changes
+                to the OK state'''),
+            Arg('--unit', dest='Unit',
+                help="unit for the alarm's associated metric")]

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list