Monitoring URLs are an important part of your FullStackMonitoring.
Splunk AppDynamics lets you monitor URLs with different authentication. In this article, we will create a simple URL with a username and password. Afterwards, we will monitor it using AppDynamics Machine Agent.
pip install flaskbasic_auth_api.py:from flask import Flask, request, jsonify
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__)
auth = HTTPBasicAuth()
# Dummy users for authentication
users = {
"user1": "password123",
"user2": "securepassword",
}
@auth.get_password
def get_pw(username):
return users.get(username)
@app.route('/api/data', methods=['GET'])
@auth.login_required
def get_data():
return jsonify({"message": f"Hello, {auth.username()}! Here is your data."})
if __name__ == '__main__':
app.run(debug=True, port=5000)python basic_auth_api.pycurl to access the API:curl -u user1:password123 http://127.0.0.1:5000/api/data{
"message": "Hello, user1! Here is your data."
}You can install the Machine agent as recommended here
git clone https://github.com/Appdynamics/url-monitoring-extension.git
cd url-monitoring-extensionJava 8 to build the extension artifact from the source. mvn -v or mvn --version. mvn clean installcd target/
mv UrlMonitor-2.2.1.zip /opt/appdynamics/machine-agent/monitors
unzip UrlMonitor-2.2.1.zipsites:
- name: AppDynamics
url: http://127.0.0.1:5000/api/data
username: user1
password: password123
authType: BASICmetricPrefix: "Custom Metrics|URL Monitor|"