- https://docs.appdynamics.com/display/PRO43/Agent-to-Controller+Connections
- https://docs.appdynamics.com/21.3/en/application-monitoring/install-app-server-agents/python-agent/python-agent-settings
https://docs.appdynamics.com/21.3/en/application-monitoring/install-app-server-agents/python-agent/python-agent-settings
pyagent run -c appd.cfg -- python3 manage.py runserver 0.0.0.0:80
create application from wizard
models.py
from django.db import models
class Item(models.Model):
name = models.CharField(max_length=200)
desc = models.TextField()
def __str__(self):
return self.name
class Price(models.Model):
name = models.CharField(max_length=200)
price = models.FloatField()
def __str__(self):
return self.name
# Create your models here.
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseNotFound
import requests
import random
from .models import Item
import string
def get_random_string(length):
# With combination of lower and upper case
result_str = ''.join(random.choice(string.ascii_letters) for i in range(length))
# print random string
#print(result_str)
return result_str
# Create your views here.
def monthly_challenge(request, month):
challenge_text = None
if month == "january":
challenge_text = "january text"
elif month == "february":
challenge_text = "feb text"
elif month == "march":
challenge_text = "mar text"
rs = requests.get("http://192.168.100.52")
print(rs.text)
elif month == "populate":
for i in range(1, 100):
name = get_random_string(8)
desc = get_random_string(100)
newitem = Item(name=name, desc=desc)
newitem.save()
challenge_text = "added ok"
elif month == "list":
items = Item.objects.all()
challenge_text = ""
for item in items:
challenge_text += f"<span>{item}</span><br>"
else:
return HttpResponseNotFound("this month is not supported")
return HttpResponse(challenge_text)