Extending onboarding features
parent
0cfe6ea59d
commit
12c44f185c
|
|
@ -0,0 +1,25 @@
|
|||
resource "dynatrace_custom_service" "<APPNAME>" {
|
||||
name = "<APPNAME>"
|
||||
enabled = true
|
||||
# queue_entry_point = false
|
||||
#TO BE FILLED - technology - possible options: java,dotNet
|
||||
technology = "<technology>"
|
||||
rule {
|
||||
enabled = true
|
||||
class {
|
||||
#TO BE FILLED - classname (FQN)
|
||||
name = "<classname>"
|
||||
match = "EQUALS"
|
||||
}
|
||||
method {
|
||||
#TO BE FILLED - methodname (FQN)
|
||||
name = "[methodname]"
|
||||
#TO BE FILLED - argument type list (FQN)
|
||||
arguments = [<argumentlist>]
|
||||
#TO BE FILLED - return type (FQN or void)
|
||||
returns = "<returntype>"
|
||||
#TO BE FILLED - visibility (private,public)
|
||||
visibility = "<visibility>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
resource "dynatrace_processgroup_naming" "<APPNAME>" {
|
||||
name = "<APPNAME>"
|
||||
enabled = true
|
||||
format = "{ProcessGroup:DetectedName} - {HostGroup:Name/[^\\_]*$}"
|
||||
conditions {
|
||||
condition {
|
||||
key {
|
||||
type = "STATIC"
|
||||
attribute = "PROCESS_GROUP_TAGS"
|
||||
}
|
||||
tag {
|
||||
# negate = false
|
||||
operator = "EQUALS"
|
||||
value {
|
||||
context = "CONTEXTLESS"
|
||||
key = "Component"
|
||||
#TO BE FILLED - Component tag value
|
||||
value = "<componentValue>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
resource "dynatrace_service_naming" "<APPNAME>" {
|
||||
name = "<APPNAME>"
|
||||
enabled = true
|
||||
format = "{Service:DetectedName} - {HostGroup:Name/[^\\_]*$}"
|
||||
conditions {
|
||||
condition {
|
||||
key {
|
||||
type = "STATIC"
|
||||
attribute = "SERVICE_TAGS"
|
||||
}
|
||||
tag {
|
||||
# negate = false
|
||||
operator = "EQUALS"
|
||||
value {
|
||||
context = "CONTEXTLESS"
|
||||
key = "Component"
|
||||
#TO BE FILLED - Component tag value
|
||||
value = "<componentValue>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,16 +2,20 @@ import yaml
|
|||
from decouple import config
|
||||
import argparse
|
||||
import os
|
||||
parser = argparse.ArgumentParser(description="Generate predefined Dynatrace configuration via Terraform",
|
||||
parser = argparse.ArgumentParser(description="Generate predefined Dynatrace configuration via Terraform. Default features are Management zone, Alerting profile and predefined dashboard. For more see options below",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
|
||||
parser.add_argument("-A", "--appname", type=str,required=True, help="Your app_name")
|
||||
parser.add_argument('-C', "--compassid", type=str,required=True, help="Your compass_id")
|
||||
parser.add_argument('-F', "--features", type=str,required=True, help="Comma separated additional features. Possible options are: custom_service, processgroup_naming, service_naming")
|
||||
args = parser.parse_args()
|
||||
|
||||
#Config options for onboarding. Will be extended with other configuration options in future
|
||||
configoptions = ["management_zone"]
|
||||
envconfigoptions = ["alerting","dashboard"]
|
||||
if(args.features):
|
||||
features = args.features.split(",")
|
||||
configoptions = configoptions + features
|
||||
def main(slo_path):
|
||||
print("Generating tf files...")
|
||||
if args.appname and args.compassid:
|
||||
|
|
|
|||
29
readme.md
29
readme.md
|
|
@ -16,9 +16,14 @@ Before executing scripts, python requirements have to be satisfied. To do so, ex
|
|||
3.Install python dependencies:
|
||||
pip install -r requirements.txt
|
||||
4.Run onboarding script:
|
||||
python ./onboarding.py -A CD_<app_name> -C <compass_id>
|
||||
4.1 Default implementation (Management zone, Alerting profile and predefined dashboard)
|
||||
python ./onboarding.py -A CD_<app_name> -C <compass_id>
|
||||
4.2 Additional features (see Usage section):
|
||||
python ./onboarding.py -A CD_<app_name> -C <compass_id> -F <features>
|
||||
5. Review created files:
|
||||
git status
|
||||
|
||||
5.1 Adjust additional feature files (if generated with "-F" option). See "Adjusting tf files" section
|
||||
6. Commit your changes:
|
||||
git add <changes>
|
||||
|
||||
|
|
@ -33,18 +38,26 @@ For more information about adjusting tf files to your need please follow:
|
|||
1. Management zones: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/management_zone
|
||||
2. Alerting profiles: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/alerting
|
||||
3. Dashboards: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/dashboard
|
||||
4. Custom service: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/custom_service
|
||||
5. Notification: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/notification
|
||||
6. Process group naming: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/processgroup_naming
|
||||
7. Service naming: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/service_naming
|
||||
|
||||
# Usage
|
||||
usage: onboarding.py [-h] -A APPNAME -C COMPASSID
|
||||
usage: onboarding.py [-h] -A APPNAME -C COMPASSID -F FEATURES
|
||||
|
||||
Generate predefined Dynatrace configuration via Terraform
|
||||
Generate predefined Dynatrace configuration via Terraform. Default features are Management zone, Alerting profile and predefined dashboard. For more see
|
||||
options below
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-A APPNAME, --appname APPNAME
|
||||
Your app_name (default: None)
|
||||
-C COMPASSID, --compassid COMPASSID
|
||||
Your compass_id (default: None)
|
||||
-h, --help show this help message and exit
|
||||
-A APPNAME, --appname APPNAME
|
||||
Your app_name (default: None)
|
||||
-C COMPASSID, --compassid COMPASSID
|
||||
Your compass_id (default: None)
|
||||
-F FEATURES, --features FEATURES
|
||||
Comma separated additional features. Possible options are: custom_service, notification, processgroup_naming, service_naming (default:
|
||||
None)
|
||||
|
||||
# Files
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue