Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: EC2 scheduler tags #36

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fa85299
AwsClient: Add fallback in case tag `aws:cloudformation:stack-name` i…
Mar 20, 2019
30732a5
AwsClient: Allow to connect with Cloudformation and DynamoDB
Mar 20, 2019
c794510
Introduce class PropertyModifier to transform scheduler tags to ranges
Mar 20, 2019
fdd4766
PropertyModifier: Add support for AWS Instance Scheduler tags [WIP]
Mar 26, 2019
1ee6449
PropertyModifier: Properly resolve range definitions
Mar 26, 2019
f02d6cd
PropertyModifier: Assume the DynamoDb table name is the default
Mar 26, 2019
85392e7
PropertyModifier: Proplery initialize the AWS client connector
Mar 26, 2019
9875791
PropertyModifier: Cache DynamoDb results, again
Mar 26, 2019
170c741
PropertyModifier: Properly transmit key conditions to DynamoDb::getItem
Mar 26, 2019
845821f
PropertyModifier: Properly access DynamoDb values
Mar 26, 2019
47b9322
PropertyModifer: Don't call diff as function
Mar 26, 2019
0316b8d
PropertyModifier: Don't call renderRange() as function
Mar 26, 2019
9a4cad9
PropertyModifier: Don't call renderRange() as function
Mar 26, 2019
4a4feea
Update to SDK v3
N-o-X Aug 14, 2019
d1a52af
PropertyModifier: Fix range format
N-o-X Aug 14, 2019
2331bb7
PropertyModifier: Fix EC2-Scheduler Table Name
N-o-X Aug 15, 2019
46b4a7e
Remove unused stack name extraction
N-o-X Aug 15, 2019
8032c2f
PropertyModifier: Fix downtime range format
N-o-X Aug 15, 2019
5540f34
Add documentation for the EC2 Scheduling time period object import
Aug 15, 2019
2d9258b
Add sync rule section in documentation for TimePeriod import
Aug 15, 2019
acfd3b7
Change order of elements in documentation
Aug 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion doc/03-Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ in a granular way:
![AWS sync properties](img/06_aws_sync_properties.png)

Now you are ready to trigger your first Sync Run. Activity Log and Sync History
will show you what related actions took place
will show you what related actions took place.

### Have a look at your new hosts

Expand All @@ -86,4 +86,34 @@ to Icinga:

![AWS host preview](img/09_aws_host_preview.png)


Import TimePeriods from EC2 Scheduler
-------------------------------------

You can import and create
[TimePeriod objects](https://icinga.com/docs/icinga2/latest/doc/09-object-types/#timeperiod)
via the [EC2 Scheduler](https://github.com/amazon-archives/ec2-scheduler).
Under your import source, add a property modifier:

![AWS timeperiod import](img/12_aws_timeperiod_modifier.png)

With the property `tags` you can use the modifier option `EC2 Scheduler tags to ranges`.
With this, you can define a sync rule using a Time Period object type:

![AWS timeperiod syncrule](img/14_aws_timeperiod_syncrule.png)

This sync rule will need its own sync properties, which can be configured as follows:

![AWS timeperiod_sync_properties](img/15_aws_timeperiod_syncproperties.png)

Now just check for changes and trigger the sync rule and a TimePeriod object will be
automagically created.

![AWS timeperiod object](img/13_aws_timeperiod_object.png)

Using this object, you can schedule your checks and notifications.
For further information concerning the usage, take a look at the
[Time Periods section](https://icinga.com/docs/icinga2/latest/doc/08-advanced-topics/#timeperiods)
in the Icinga 2 documentation.

That's all for now, have fun!
Binary file added doc/img/12_aws_timeperiod_modifier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/13_aws_timeperiod_object.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/14_aws_timeperiod_syncrule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/15_aws_timeperiod_syncproperties.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions library/Aws/AwsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ public function getRoute53Records()
return $this->sortByName($objects);
}

public function getStacks()
{
$client = $this->sdk()->createCloudFormation();
$res = $client->describeStacks();
return $res['Stacks'];
}

public function getDynamoDb()
{
return $this->sdk()->createDynamoDb();
}

public static function enumRegions()
{
return array(
Expand Down
Loading