Skip to content

Commit e162f6b

Browse files
Merge pull request #292692 from dominicbetts/aio-media-connector-updates-2
AIO: Media connector updates
2 parents 3b91c0e + c375adb commit e162f6b

File tree

2 files changed

+33
-49
lines changed

2 files changed

+33
-49
lines changed

articles/iot-operations/discover-manage-assets/howto-use-media-connector.md

Lines changed: 33 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -84,45 +84,9 @@ Make a note of this value, you use it later to access the media server.
8484

8585
## Configure the media connector (preview)
8686

87-
Before you begin, configure an endpoint that doesn't use TLS that you can use to connect to the MQTT broker. Create a YAML file with the following content:
87+
To configure the media connector, you need to create an asset endpoint that defines the connection to the media source. The asset endpoint includes the URL of the media source, the type of media source, and any credentials needed to access the media source.
8888

89-
```yaml
90-
apiVersion: mqttbroker.iotoperations.azure.com/v1
91-
kind: BrokerListener
92-
metadata:
93-
name: aio-broker-notls
94-
namespace: azure-iot-operations
95-
spec:
96-
brokerRef: default
97-
serviceType: LoadBalancer
98-
ports:
99-
- port: 1883
100-
protocol: Mqtt
101-
102-
---
103-
104-
apiVersion: v1
105-
kind: Service
106-
metadata:
107-
name: aio-broker-notls
108-
namespace: azure-iot-operations
109-
spec:
110-
type: LoadBalancer
111-
ports:
112-
- port: 1883
113-
targetPort: 1883
114-
```
115-
116-
To apply the settings, run the following command. Typically, you apply the settings to the `azure-iot-operations` namespace:
117-
118-
```console
119-
kubectl apply -f <filename>.yaml -n <AIO NAMESPACE>
120-
```
121-
122-
> [!CAUTION]
123-
> These settings are not secure and should only be used for testing purposes.
124-
125-
To configure the asset endpoint, create a YAML file with the following content. Replace the placeholders with your camera's username, password, and RTSP address. An RTSP address looks like `rtsp://<CAMERA IP ADDRESS>:555/onvif-media/media.amp?streamprofile=Profile1&audio=1`
89+
To create the asset endpoint, create a YAML file with the following content. Replace the placeholders with your camera's username, password, and RTSP address. An RTSP address looks like `rtsp://<CAMERA IP ADDRESS>:555/onvif-media/media.amp?streamprofile=Profile1&audio=1`
12690

12791
```yaml
12892
apiVersion: v1
@@ -216,13 +180,35 @@ To add the asset, run the following command. Typically, you apply the settings t
216180
kubectl apply -f <filename>.yaml -n <AIO NAMESPACE>
217181
```
218182

219-
> [!TIP]
220-
> Use your favorite MQTT client to subscribe to the topic `aio/asset/contoso-rtsp-snapshot-to-mqtt-autostart/snapshot` to view the snapshots.
183+
To verify that snapshots are publishing to the MQTT broker, use the **mosquitto_sub** tool. In this example, you run the **mosquitto_sub** tool inside a pod in your Kubernetes cluster:
184+
185+
1. Run the following command to deploy a pod that includes the **mosquitto_pub** and **mosquitto_sub** tools that are useful for interacting with the MQTT broker in the cluster:
186+
187+
```console
188+
kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/explore-iot-operations/main/samples/quickstarts/mqtt-client.yaml
189+
```
190+
191+
> [!CAUTION]
192+
> This configuration isn't secure. Don't use this configuration in a production environment.
193+
194+
1. When the **mqtt-client** pod is running, run the following command to create a shell environment in the pod you created:
195+
196+
```console
197+
kubectl exec --stdin --tty mqtt-client -n azure-iot-operations -- sh
198+
```
199+
200+
1. At the Bash shell in the **mqtt-client** pod, run the following command to connect to the MQTT broker using the **mosquitto_sub** tool subscribed to the `azure-iot-operations/data` topic:
201+
202+
```bash
203+
mosquitto_sub --host aio-broker --port 18883 --topic "azure-iot-operations/data/#" -V 5 -F '%t %l' --cafile /var/run/certs/ca.crt -D CONNECT authentication-method 'K8S-SAT' -D CONNECT authentication-data $(cat /var/run/secrets/tokens/broker-sat)
204+
```
205+
206+
This command continues to run and displays messages as they arrive on the `azure-iot-operations/data` topic until you press **Ctrl+C** to stop it. The output shows the topic the message was published to and its size. To exit the shell environment, type `exit`.
221207

222208
When you finish testing the asset, you can delete it by running the following command:
223209

224210
```console
225-
kubectl delete -f <filename>.yaml
211+
kubectl delete -f <filename>.yaml -n <AIO NAMESPACE>
226212
```
227213

228214
## Snapshot to file system
@@ -265,12 +251,12 @@ To view the files, create a shell in the pod. Use the full name of the pod in th
265251
kubectl exec --stdin --tty aio-opc-media-1-* -n <AIO NAMESPACE> -- sh
266252
```
267253

268-
Then navigate to the following folder to view the files: `\tmp\azure-iot-operations\data\contoso-rtsp-snapshot-to-fs-autostart\snapshot`. The folder name includes the name of your asset.
254+
Then navigate to the following folder to view the files: `/tmp/azure-iot-operations/data/contoso-rtsp-snapshot-to-fs-autostart/snapshot`. The folder name includes the name of your asset.
269255

270256
When you finish testing the asset, you can delete it by running the following command:
271257

272258
```console
273-
kubectl delete -f <filename>.yaml
259+
kubectl delete -f <filename>.yaml -n <AIO NAMESPACE>
274260
```
275261

276262
## Clip to file system
@@ -313,12 +299,12 @@ To view the files, create a shell in the pod. Use the full name of the pod in th
313299
kubectl exec --stdin --tty aio-opc-media-1-* -n <AIO NAMESPACE> -- sh
314300
```
315301

316-
Then navigate to the following folder to view the files: `\tmp\azure-iot-operations\data\contoso-rtsp-clip-to-fs-autostart\clip`. The folder name includes the name of your asset.
302+
Then navigate to the following folder to view the files: `/tmp/azure-iot-operations/data/contoso-rtsp-clip-to-fs-autostart/clip`. The folder name includes the name of your asset.
317303

318304
When you finish testing the asset, you can delete it by running the following command:
319305

320306
```console
321-
kubectl delete -f <filename>.yaml
307+
kubectl delete -f <filename>.yaml -n <AIO NAMESPACE>
322308
```
323309

324310
## Stream to RTSP
@@ -348,15 +334,15 @@ spec:
348334
}
349335
```
350336

351-
To view the media stream, use a URL that looks like: `https://<YOUR MEDIA SERVER IP ADDRESS>:8888/azure-iot-operations/data/contoso-rtsp-stream-to-rtsp-autostart/`.
337+
To view the media stream, use a URL that looks like: `https://<YOUR KUBERNETES CLUSTER IP ADDRESS>:8888/azure-iot-operations/data/contoso-rtsp-stream-to-rtsp-autostart/`.
352338

353339
> [!TIP]
354340
> If you're running Azure IoT Operations in Codespaces, run the following command to port forward the media server to your local machine: `kubectl port-forward service/media-server-public 8888:8888 -n media-server`.
355341

356342
When you finish testing the asset, you can delete it by running the following command:
357343

358344
```console
359-
kubectl delete -f <filename>.yaml
345+
kubectl delete -f <filename>.yaml -n <AIO NAMESPACE>
360346
```
361347

362348
## Samples

articles/iot-operations/discover-manage-assets/overview-onvif-connector.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ The connector for ONVIF is part of Azure IoT Operations. The connector deploys t
4343

4444
- _Assets_, in Azure IoT Operations are logical entities that you create to represent real assets such as cameras. An Azure IoT Operations ONVIF camera asset identifies the ONVIF network service the camera exposes, such as PTZ.
4545

46-
- The Azure IoT Operations experience web UI provides a unified experience for you to manage assets such as cameras. You can use the operations experience to configure the assets and asset endpoints that the media connector uses to access media sources.
47-
4846
- The MQTT broker that you can use to publish messages from the connectors to other local or cloud-based components in your solution.
4947

5048
- The Azure Device Registry that stores information about local assets in the cloud.

0 commit comments

Comments
 (0)