> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamnative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Private Cloud telemetry

StreamNative Private Cloud telemetry supports Pulsar cluster usage data collection and stores the data using an Avro schema. The telemetry has modes: local and remote:

* Local mode will store the Private Cloud cluster usage data in the local Pulsar’s topic and supports exporting usage data into CSV format.
* Remote mode is a more automated solution since the Private Cloud cluster will send the telemetry data into StreamNative Cloud without user engagement.

## Telemetry data

The usage data for the Pulsar cluster includes the CPU and memory usage for the `PulsarBroker`, `BookkeeperCluster`, `PulsarProxy`, `ZookeeperCluster`, `Sink`, `Source`, and `Function` components.

```
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
|        TIME         | CLUSTER NAME  | NAMESPACE |          BROKER           |          PROXY           |          BOOKIE           |         ZOOKEEPER         |         SINK         |        SOURCE        |       FUNCTION       |
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
| 2024-06_16 00:11:07 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
| 2024-06_16 01:11:07 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
| 2024-06_16 02:11:07 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
| 2024-06_16 03:11:07 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
```

## Telemetry local mode

Private Cloud users can access to the Pulsar cluster usage data through the cli tool `snctl` which support to display the cluster usage data in terminal or export the usage data in CSV format.

### Prerequisites

* Install the latest `snctl` v0.19.1 or above. [Install snctl](https://docs.streamnative.io/docs/snctl-overview#install-snctl)
* Upgrade to the `sn-operator` helm chart v0.1.6 or above.
* Enable the `PulsarCoordinator` object for your Pulsar cluster.

### View the usage data

* Get the Private Cloud Proxy external service endpoint:

```
kubectl get services -o jsonpath='{.items[?(@.spec.type=="LoadBalancer")].status.loadBalancer.ingress[0].ip}' -n pulsar

4.153.37.80
```

* View the usage data through the `usage-data get local` commands, probably you will need authentication data with permission to access `sn/system/__usage`.

```
snctl usage-data get local -u pulsar://4.153.37.80:6650 --auth-params ey....TOKEN --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationToken
INFO[0000] Connecting to broker                          remote_addr="pulsar://4.153.37.80:6650"
INFO[0000] TCP connection established                    local_addr="10.6.100.20:51750" remote_addr="pulsar://4.153.37.80:6650"
INFO[0000] Connection is ready                           local_addr="10.6.100.20:51750" remote_addr="pulsar://4.153.37.80:6650"
INFO[0001] Connecting to broker                          remote_addr="pulsar://4.153.37.80:6650"
INFO[0001] TCP connection established                    local_addr="10.6.100.20:51751" remote_addr="pulsar://4.153.37.80:6650"
INFO[0001] Connection is ready                           local_addr="10.6.100.20:51751" remote_addr="pulsar://4.153.37.80:6650"
INFO[0002] Connected consumer                            consumerID=1 name= subscription=reader-hutim topic="persistent://sn/system/__usage"
INFO[0002] Created consumer                              consumerID=1 name= subscription=reader-hutim topic="persistent://sn/system/__usage"
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
|        TIME         | CLUSTER NAME  | NAMESPACE |          BROKER           |          PROXY           |          BOOKIE           |         ZOOKEEPER         |         SINK         |        SOURCE        |       FUNCTION       |
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
| 2024-08_29 12:49:29 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
| 2024-08_29 13:49:29 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
| 2024-08_29 14:49:29 | private-cloud | pulsar    | cpu: 600m, memory: 1536Mi | cpu: 200m, memory: 512Mi | cpu: 600m, memory: 1536Mi | cpu: 600m, memory: 1536Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi | cpu: 0m, memory: 0Mi |
+---------------------+---------------+-----------+---------------------------+--------------------------+---------------------------+---------------------------+----------------------+----------------------+----------------------+
INFO[0002] Closing consumer=1                            consumerID=1 name= subscription=reader-hutim topic="persistent://sn/system/__usage"
INFO[0003] Closed consumer                               consumerID=1 name= subscription=reader-hutim topic="persistent://sn/system/__usage"
```

### Export the usage data

* Export the usage data through the extra `-o, --csv-file-path` flag with CSV format:

```
snctl usage-data get local -u pulsar://4.153.37.80:6650 -o usage-data.csv
```

## Telemetry remote mode

StreamNative Operator has an inside agent `sn-agent` which works for usage data collection and telemetry sending. Under the remote mode, `sn-agent` will collect the usage data for Private Cloud clusters and send these usage data to the StreamNative Cloud, StreamNative will process these received usage data.

<img src="https://mintcdn.com/streamnative/X4XXALd_B9JHLYn5/media/private-cloud/remote-telemetry.png?fit=max&auto=format&n=X4XXALd_B9JHLYn5&q=85&s=9db186eee8621c3499cbdb73ea8f56a2" alt="Remote telemetry" width="1308" height="664" data-path="media/private-cloud/remote-telemetry.png" />

### Prerequisites

Remote mode has two prerequisites to enable:

* Open the outbound network access: `sn-agent` will require the Internet connection to access to the SN Cloud public endpoint access:
  | Address                                                            | Descriptions        |
  | ------------------------------------------------------------------ | ------------------- |
  | [https://apps.sncloud.snio.cloud](https://apps.sncloud.snio.cloud) | Broker data for TLS |
  | pulsar+ssl://apps.sncloud.snio.cloud:6651                          | HTTPS request       |
* License token with telemetry: remote mode needs specific license to enable, StreamNative will provide a new license to users and users can follow the [Update license](/private-cloud/v2/configure-private-cloud/license/configure-licenses#update-a-license) how to update the license.
