To collect information about Python applications on IBM® Cloud, 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
Passport Advantage® website. For detailed instructions, see Download instructions.
- Configure the data collector package with the
make_configuration_packages.sh and
configure_agent_images.sh scripts on the system where the Cloud
APM server is installed. For detailed instructions, see
Configuring the downloaded images.
About this task
To configure the data collector, you first deploy a pypi package server, and then install the
data collector to a Python Django application.
Procedure
-
Extract files from the data collector package. The python_datacollector_8.1.4.0.tgz package is included in the extracted
directory.
-
Extract the python_datacollector_8.1.4.0.tgz package, for example,
by running the following command:
tar -zxf python_datacollector_8.1.4.0.tgz
-
Find the manifest.yml file of the package server in the extracted
directory and define the domain, host, and name in this file as is shown in the following
example:
domain: mybluemix.net
name: pythondc
host: pythondc
Remember: The host and name values must be the
same and unique.
-
From the python_dc directory, push the
pythondc
application to IBM Cloud by running the following
command:
-
In the requirements.txt file of your Python application, add the following
lines:
cryptography==1.9.0
--extra-index-url https://<your_host_name_and_domain>/python-dc-repos/simple/
ibm_python_dc
-
In the settings.py file of your Python application, add
ibm_python_dc.kpg_plugin.ResourceMiddleware
to the beginning of the
MIDDLEWARE_CLASSES
section, for example:
MIDDLEWARE_CLASSES = (
"ibm_python_dc.kpg_plugin.ResourceMiddleware",
"mezzanine.core.middleware.UpdateCacheMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
-
From the directory that contains the manifest.yml file of your Python
application, run the following command:
Results
The data collector is configured and is connected to the Cloud
APM server.
What to do next
You can verify the monitoring data for your IBM Cloud application is displayed in the Cloud APM console. For instructions on how to start the Cloud APM console, see Starting the Cloud APM console. For information about using the
Applications editor, see Managing applications.