Module: check_mk
Branch: master
Commit: e11cde0bf0c6f088d5e9e9aae0d942a8bff0cc5a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e11cde0bf0c6f0…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Dec 13 11:22:02 2018 +0100
Minor cleanups
- Renamed AWS/S3 buckets summary section for uniformity
- Added a few headers
- Reformatted AWSSections' init method
Change-Id: I1269678c79e407fcf9306f914b91bc08bb8e541f
---
agents/special/agent_aws | 100 +++++++++++++++++++++++++++++++++++------------
1 file changed, 76 insertions(+), 24 deletions(-)
diff --git a/agents/special/agent_aws b/agents/special/agent_aws
index d29ac4e..89b7590 100755
--- a/agents/special/agent_aws
+++ b/agents/special/agent_aws
@@ -58,12 +58,12 @@ def _datetime_converter(o):
#.
-# .--sections------------------------------------------------------------.
-# | _ _ |
-# | ___ ___ ___| |_(_) ___ _ __ ___ |
-# | / __|/ _ \/ __| __| |/ _ \| '_ \/ __| |
-# | \__ \ __/ (__| |_| | (_) | | | \__ \ |
-# | |___/\___|\___|\__|_|\___/|_| |_|___/ |
+# .--section API---------------------------------------------------------.
+# | _ _ _ ____ ___ |
+# | ___ ___ ___| |_(_) ___ _ __ / \ | _ \_ _| |
+# | / __|/ _ \/ __| __| |/ _ \| '_ \ / _ \ | |_) | | |
+# | \__ \ __/ (__| |_| | (_) | | | | / ___ \| __/| | |
+# | |___/\___|\___|\__|_|\___/|_| |_| /_/ \_\_| |___| |
# | |
# '----------------------------------------------------------------------'
@@ -184,6 +184,17 @@ class AWSSection(object):
self._received_results.setdefault(sender.name, content)
+#.
+# .--EC2-----------------------------------------------------------------.
+# | _____ ____ ____ |
+# | | ____/ ___|___ \ |
+# | | _|| | __) | |
+# | | |__| |___ / __/ |
+# | |_____\____|_____| |
+# | |
+# '----------------------------------------------------------------------'
+
+
class EC2Summary(AWSSection):
@property
def name(self):
@@ -286,10 +297,21 @@ class EC2(AWSSection):
]
-class S3Buckets(AWSSection):
+#.
+# .--S3------------------------------------------------------------------.
+# | ____ _____ |
+# | / ___|___ / |
+# | \___ \ |_ \ |
+# | ___) |__) | |
+# | |____/____/ |
+# | |
+# '----------------------------------------------------------------------'
+
+
+class S3Summary(AWSSection):
@property
def name(self):
- return "s3_buckets"
+ return "s3_summary"
@property
def interval(self):
@@ -337,7 +359,7 @@ class S3(AWSSection):
def _get_metrics(self):
bucket_ids = []
- for entry in self._received_results.get('s3_buckets', []):
+ for entry in self._received_results.get('s3_summary', []):
bucket_ids.append(entry['Name'])
metrics = []
idx = 0
@@ -405,7 +427,7 @@ class S3Objects(AWSSection):
def _get_bucket_ids(self):
bucket_ids = []
- for entry in self._received_results.get('s3_buckets', []):
+ for entry in self._received_results.get('s3_summary', []):
bucket_ids.append(entry['Name'])
return bucket_ids
@@ -426,6 +448,17 @@ class S3Objects(AWSSection):
]
+#.
+# .--ELB-----------------------------------------------------------------.
+# | _____ _ ____ |
+# | | ____| | | __ ) |
+# | | _| | | | _ \ |
+# | | |___| |___| |_) | |
+# | |_____|_____|____/ |
+# | |
+# '----------------------------------------------------------------------'
+
+
class ELBSummary(AWSSection):
@property
def name(self):
@@ -564,6 +597,17 @@ class ELB(AWSSection):
]
+#.
+# .--EBS-----------------------------------------------------------------.
+# | _____ ____ ____ |
+# | | ____| __ ) ___| |
+# | | _| | _ \___ \ |
+# | | |___| |_) |__) | |
+# | |_____|____/____/ |
+# | |
+# '----------------------------------------------------------------------'
+
+
class EBSSummary(AWSSection):
@property
def name(self):
@@ -705,7 +749,15 @@ class EBS(AWSSection):
]
-# ---sections handler-----------------------------------------------------
+#.
+# .--sections------------------------------------------------------------.
+# | _ _ |
+# | ___ ___ ___| |_(_) ___ _ __ ___ |
+# | / __|/ _ \/ __| __| |/ _ \| '_ \/ __| |
+# | \__ \ __/ (__| |_| | (_) | | | \__ \ |
+# | |___/\___|\___|\__|_|\___/|_| |_|___/ |
+# | |
+# '----------------------------------------------------------------------'
class AWSSections(object):
@@ -724,41 +776,41 @@ class AWSSections(object):
#---distributors----------------------------------------------------
ec2_summary_distributor = ResultDistributor()
- s3_buckets_distributor = ResultDistributor()
+ s3_summary_distributor = ResultDistributor()
elb_summary_distributor = ResultDistributor()
ebs_summary_distributor = ResultDistributor()
- #---sections--------------------------------------------------------
+ #---sections with distributors--------------------------------------
ec2_summary = EC2Summary(ec2_client, ec2_summary_distributor)
- ec2 = EC2(cloudwatch_client)
+ s3_summary = S3Summary(s3_client, s3_summary_distributor)
+ elb_summary = ELBSummary(elb_client, elb_summary_distributor)
+ ebs_summary = EBSSummary(ec2_client, ebs_summary_distributor)
- s3_buckets = S3Buckets(s3_client, s3_buckets_distributor)
+ #---sections--------------------------------------------------------
+ ec2 = EC2(cloudwatch_client)
s3_objects = S3Objects(s3_client)
s3 = S3(cloudwatch_client)
-
- elb_summary = ELBSummary(elb_client, elb_summary_distributor)
elb_health = ELBHealth(elb_client)
elb = ELB(cloudwatch_client)
-
- ebs_summary = EBSSummary(ec2_client, ebs_summary_distributor)
ebs_health = EBSHealth(ec2_client)
ebs = EBS(cloudwatch_client)
- #---distributors registry-------------------------------------------
+ #---register sections to distributors-------------------------------
ec2_summary_distributor.add(ec2)
- s3_buckets_distributor.add(s3)
- s3_buckets_distributor.add(s3_objects)
+ s3_summary_distributor.add(s3_objects)
+ s3_summary_distributor.add(s3)
elb_summary_distributor.add(elb_health)
elb_summary_distributor.add(elb)
ebs_summary_distributor.add(ebs_health)
ebs_summary_distributor.add(ebs)
- #---section registry------------------------------------------------
+ #---register sections with distributors for execution---------------
self._sections.append(ec2_summary)
- self._sections.append(s3_buckets)
+ self._sections.append(s3_summary)
self._sections.append(elb_summary)
self._sections.append(ebs_summary)
+ #---register sections for execution---------------------------------
self._sections.append(ec2)
self._sections.append(s3_objects)
self._sections.append(s3)