> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/pcd-ts/self-hosted/pcddebugger-utility.md).

# PCDdebugger Utility for PCD Troubleshooting

Simplify PCD environment troubleshooting with PCDdebugger, a Python script that automates data collection from VMs, networks, and services. Enjoy organized output, Kubernetes integration, and an optio

## **PCDdebugger**

PCDdebugger is a command-line Python script designed to simplify and accelerate the troubleshooting process for **PCD Virtualization** environments. It automates the collection of diagnostic information for various services and resources, consolidating the output into a structured directory for easy analysis and sharing.

## **Features**

* **Comprehensive Data Collection:** Gathers detailed information for key PCD resources including VMs (Nova), images (Glance), networks (Neutron), ports, volumes (Cinder), stacks (Heat), and users (Keystone).
* **Kubernetes Integration:** Performs a complete MySQL dump from a specified Kubernetes namespace, essential for debugging control plane issues.
* **Dependency Traversal:** Automatically discovers and collects data for resources related to a specified VM, such as its ports, volumes, network, subnets, image, and flavor.
* **Organized Output:** Saves all collected data into a timestamped directory, with subfolders for each service, making the information easy to navigate.
* **Archive Option:** Includes a --zip flag to automatically create a compressed archive of the collected data, ready for sharing.

## **Prerequisites**

Before running the script, ensure the following are installed and configured on your machine:

* **pcd client:** Authenticated and configured to connect to your PCD cloud. (**Ensure your rc file is sourced**).
* **kubectl:** Authenticated and configured to connect to your Kubernetes cluster.( This is required only in case of mysql dump)

## **Installation**

1. **For Mac-OS:**

* Download the binary using below command:

{% tabs %}
{% tab title="Command" %}

```bash
$ curl -LO https://github.com/platform9/PCDDebugger/releases/download/v2.0.1/PCDdebugger-v2.0.1-macos
```

{% endtab %}
{% endtabs %}

* Rename the binary file (Optional):

{% tabs %}
{% tab title="Command" %}

```bash
$ mv PCDdebugger-v2.0.1-macos PCDdebugger
```

{% endtab %}
{% endtabs %}

* Make the script executable:

{% tabs %}
{% tab title="Command" %}

```bash
$ chmod +x ./PCDdebugger
```

{% endtab %}
{% endtabs %}

* To run PCDdebugger from any directory, move it to a location in your system's PATH (Optional)

{% tabs %}
{% tab title="Command" %}

```bash
$ sudo mv PCDdebugger /usr/local/bin/
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Info**

Mac-OS will ask to allow the permission to run the PCDDebugger binary. Allow it from the **System Settings** <i class="fa-angle-double-right">:angle-double-right:</i> **Privacy and Security.**
{% endhint %}

#### 2\*\*. For Linux\*\*:

* Download the binary using below command:

{% tabs %}
{% tab title="Command" %}

```bash
$ curl -LO https://github.com/platform9/PCDDebugger/releases/download/v2.0.1/PCDdebugger-v2.0.1-linux
```

{% endtab %}
{% endtabs %}

* Rename the binary file (Optional):

{% tabs %}
{% tab title="Command" %}

```bash
$ mv PCDdebugger-v2.0.1-linux PCDdebugger
```

{% endtab %}
{% endtabs %}

* Make the binary executable:

{% tabs %}
{% tab title="Command" %}

```bash
$ chmod +x PCDdebugger
```

{% endtab %}
{% endtabs %}

* To run PCDdebugger from any directory, move it to a location in your system's PATH (Optional):

{% tabs %}
{% tab title="Command" %}

```bash
$ sudo mv PCDdebugger /usr/local/bin/
```

{% endtab %}
{% endtabs %}

3. **For Windows:**

* Download the binary using below command:

{% tabs %}
{% tab title="Powershell" %}

```powershell
curl -L https://github.com/platform9/PCDDebugger/releases/download/v2.0.1/PCDdebugger-v2.0.1-windows.exe -o PCDdebugger.exe
```

{% endtab %}
{% endtabs %}

* Place it in a Folder: Move the downloaded `PCDdebugger.exe` file to a memorable location, for example, C:\Tools.
* Add to PATH (Optional): To run the tool from any command prompt, add the folder to system's PATH environment variable.
  1. Search for "Edit the system environment variables" in the Start Menu.
  2. Click the "Environment Variables..." button.
  3. Under "System variables", find and select the Path variable, then click "Edit...".
  4. Click "New" and add the path to folder (e.g., C:\Tools).
  5. Click OK on all windows to save.
* Run `PCDdebugger.exe` from PowerShell or Command Prompt.

## **Usage**

The basic command structure is:

{% tabs %}
{% tab title="command" %}

```bash
./PCDdebugger [RESOURCE_FLAG] [OPTIONS] [--insecure]
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Info**

The "--insecure" parameter is mandatory if the SSL not configured, otherwise it will throw the "SSL Certificate" error
{% endhint %}

### **Examples**

* Collect all information for a specific VM: This will **gather details of the VM, its ports, volumes, network, subnets, image, and flavor.**

```bash
./PCDdebugger  --vm <VM_UUID>
```

* Collect details for a specific Glance image:

```bash
./PCDdebugger  --image <IMAGE_UUID>
```

* Collect details for a Neutron network and its subnets: .

{% tabs %}
{% tab title="Command" %}

```bash
./PCDdebugger  --network <NETWORK_UUID>
```

{% endtab %}
{% endtabs %}

* Perform a MySQL dump from a Kubernetes cluster: The --namespace flag is required for this operation.

{% tabs %}
{% tab title="Command" %}

```bash
./PCDdebugger  --mysql-dump --namespace <WORKLOAD_REGION>
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Info**

The "--mysql-dump" parameter can only be run on the Self Hosted PCD Virtualization.
{% endhint %}

* Combine multiple flags and create a zip archive:

```bash
./PCDdebugger  --vm <VM_UUID> --mysql-dump --namespace <K8S_NAMESPACE> --zip
```

* Specify a custom output directory and create a zip archive:

```bash
./PCDdebugger  --vm <VM_UUID> --output <PATH_TO_DIRECTORY> --zip
```

{% tabs %}
{% tab title="Example" %}

```bash
./PCDdebugger --vm aa1bb1cc3-dd4ee5ff6-gg7hh8-ii9jj10kk --output /tmp --zip
```

{% endtab %}
{% endtabs %}

**Command-Line Flags:**

* `--vm <ID_OR_NAME>`: Collect details for a specific Nova VM and its related resources.
* `--image <ID_OR_NAME>`: Collect details for a specific Glance image.
* `--network <ID_OR_NAME>`: Collect details for a specific Neutron network and its subnets.
* `--port <ID_OR_NAME>`: Collect details for a specific Neutron port.
* `--volume <ID_OR_NAME>`: Collect details for a specific Cinder volume.
* `--stack <ID_OR_NAME>`: Collect details for a specific Heat stack.
* `--user <ID_OR_NAME>`: Collect details for a specific Keystone user.
* `--mysql-dump`: Perform a MySQL dump of all databases. **Requires** `--namespace`.
* `--namespace <NAMESPACE>`: The Kubernetes namespace to use for the MySQL dump.
* `--output <DIRECTORY>`: Specify a custom directory for the output files.
* `--zip`: Compress the final output directory into a `.zip` file.
* `--help`: Show the help message and exit.

{% hint style="info" %}
**Info**

All output is saved to a directory named PCDdebugger- by default.
{% endhint %}

## **Additional Information:**

For more details, kindly visit the GitHub page: [https://github.com/platform9/PCDDebugger](https://github.com/platform9/PCDDebugger?utm_source=chatgpt.com)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/pcd-ts/self-hosted/pcddebugger-utility.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
