To collect information about Python applications that run in your local environment, you
must configure the Python data collector.
Before you begin
- Make sure the Python applications that you want to monitor have unique names. The Python data collector handles two different applications with
the same name as one application, which might cause data display issues in the Cloud APM console.
- Download the data collector package from
IBM®
Marketplace. For detailed
instructions, see Downloading your agents and data collectors.
About this task
The data collector package is a preconfigured one with a preconfigured
global.environment file and a keyfile.p12 that is copied
to the etc folder. As a result, the data collector automatically connects to
the Cloud
APM server.
The following procedure configures the data collector within your Python application with default
settings. To customize data collector configuration, use the environment variables in the data
collector configuration files. For more information, see Customizing the Python data collector for on-premises applications.
Procedure
-
Extract files from the data collector package. The python_datacollector_8.1.4.0.tgz package is included in the extracted
directory.
-
Extract files from the data collector package, for example, by running the following
command:
tar -zxf python_datacollector_8.1.4.0.tgz
-
From the python_dc directory, run the following command:
-
Run the following command:
pip install ibm_python_dc --extra-index-url http://host name or ip:8000/
python-dc-repos/simple/ --trusted-host host name or ip
where
host name or ip is the name or IP address of the host to run your Python data
collector repository.
Important: Use either the name or the IP address to specify the
host for both the URL and the trusted host in this command. For example, if you specify the host by
using the IP address and the IP address is
9.42.36.180, the command is as
follows:
pip install ibm_python_dc --extra-index-url http://9.42.36.180:8000/
python-dc-repos/simple/ --trusted-host 9.42.36.180
-
In the settings.py file of your Python application, add
ibm_python_dc.kpg_plugin.ResourceMiddleware to the
MIDDLEWARE_CLASSES section to the format of the following example:
MIDDLEWARE_CLASSES = (
"ibm_python_dc.kpg_plugin.ResourceMiddleware",
"mezzanine.core.middleware.UpdateCacheMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Results
The data collector is configured with default settings and connected to the Cloud
APM server.
What to do next
You can now log in to the Cloud
APM server to
view the monitoring data. Remember: After you add your Python application to the
Cloud APM console, you can view its monitoring data in
the component named Python Runtime application.
For instructions on how to start the
Cloud
APM server, see Starting the Cloud APM console.
For information about using the Applications editor, see Managing
applications.