Skip to content

Commit

Permalink
Merge pull request Dynatrace#7 from jetzlstorfer/master
Browse files Browse the repository at this point in the history
updated readme, fixed playbook to work with updated lambda
  • Loading branch information
grabnerandi authored May 18, 2018
2 parents 90c7961 + e50f650 commit bed2dea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 21 deletions.
19 changes: 0 additions & 19 deletions AWSDevOpsTutorialCloudFormationStack.json
Original file line number Diff line number Diff line change
Expand Up @@ -1655,25 +1655,6 @@
},
"Description": "The Public DNS of your Ansible Tower"
},
"AnsibleTowerAPIUrl": {
"Condition": "CreateAnsibleInstance",
"Value": {
"Fn::Join":[
"",
[
"https://",
{
"Fn::GetAtt": [
"AnsibleTowerInstance",
"PublicDnsName"
]
},
"/api/v2/job_templates/7/launch/"
]
]
},
"Description": "Endpoint for calling predefined playbook in Ansible Tower"
},
"AnsibleTowerJobTemplateUrl": {
"Condition": "CreateAnsibleInstance",
"Value": {
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ As we are going to use AWS CodeDeploy, AWS CodePipeline, AWS Lambda, DynamoDB, A
1.1. To learn more about Key Pairs and how to connect to EC2 Instances for troubleshooting read [Connect to your Linux Instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html)
2. Create a S3 Bucket with the naming scheme: <yourname>-dynatracedevops and enable versioning. See following screenshots for reference
![](./images/preparation_creates3bucket.png)
3. Copy the content from the folder "copytos3" to your newly created S3 bucket. This includes the application package, tests, monspec, Ansible Tower license, Ansible playbook as well as all Lambda functions
3. Copy the content from the folder "copytos3" to your newly created S3 bucket. This includes the application package, tests, monspec as well as all Lambda functions.
If you want to use Ansible for Auto-Remediation, make sure to also copy the Ansible Tower license and Ansible playbook. The Ansible License file you have to be provide has to be named ``ansible-license.txt``.
![](./images/preparation_copytos3.png)
4. for ANSIBLE TOWER auto-remediation only: make both the ``ansible-license.txt`` as well as the ``playbook.yaml`` public in order for the script to download it to the corresponding EC2 instances during installation. Therefore, select both files and click on "More -> Make public" and submit the dialog.

**Dynatrace**

Expand Down
Binary file modified copytos3/lambdas.zip
Binary file not shown.
1 change: 1 addition & 0 deletions copytos3/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
payload:
PID: "{{pid}}"
ImpactedEntities: "{{impactedEntities}}"
State: "{{state}}"

tasks:
- name: push comment to dynatrace
Expand Down
5 changes: 4 additions & 1 deletion lambdas/handleDynatraceProblemNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ exports.handler = (event, context, callback) => {
dtApiUtils.dtApiInit(function(err,data) {

var impactedEntities = [];
console.log("notificationObject.ImpactedEntities: " + notificationObject.ImpactedEntities);
for(var entityIx=0;entityIx<notificationObject.ImpactedEntities.length;entityIx++) {
impactedEntities.push(notificationObject.ImpactedEntities[entityIx].entity);
var myEntity = JSON.parse(notificationObject.ImpactedEntities[entityIx]);
console.log("notificationObject.ImpactedEntities[entityIx]: "+ myEntity.entity);
impactedEntities.push(myEntity.entity);
}

console.log("Impacted Entities: " + impactedEntities);
Expand Down

0 comments on commit bed2dea

Please sign in to comment.