Configuring the Python data collector for IBM Cloud applications

To collect information about Python applications on IBM® Cloud, you must configure the Python data collector.

Before you begin

  1. 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.
  2. Download the data collector package from IBM Passport Advantage® website. For detailed instructions, see Download instructions.
  3. 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

  1. Extract files from the data collector package. The python_datacollector_8.1.4.0.tgz package is included in the extracted directory.
  2. 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
  3. 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.
  4. From the python_dc directory, push the pythondc application to IBM Cloud by running the following command:
    cf push
  5. 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
  6. 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',
  7. From the directory that contains the manifest.yml file of your Python application, run the following command:
    cf push
    Tip: For a sample manifest.yml file, see Sample manifest.yml file.

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.