├── Speedtest-MQTT-results.png ├── Speedtest-Quickstart-results.png ├── pattern.json ├── service.json ├── Dockerfile ├── speedtest2wiotpq.sh ├── speedtest2wiotp.sh ├── README.md ├── Makefile ├── messaging.pem └── LICENSE /Speedtest-MQTT-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/ieam-speedtest-mqtt/main/Speedtest-MQTT-results.png -------------------------------------------------------------------------------- /Speedtest-Quickstart-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnwalicki/ieam-speedtest-mqtt/main/Speedtest-Quickstart-results.png -------------------------------------------------------------------------------- /pattern.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "$PATTERN_NAME", 3 | "services": [ 4 | { 5 | "serviceUrl": "$SERVICE_NAME", 6 | "serviceOrgid": "$HZN_ORG_ID", 7 | "serviceArch": "$ARCH", 8 | "serviceVersions": [ { "version": "$SERVICE_VERSION" } ] 9 | } 10 | ] 11 | } 12 | 13 | -------------------------------------------------------------------------------- /service.json: -------------------------------------------------------------------------------- 1 | { 2 | "org": "$HZN_ORG_ID", 3 | "label": "$SERVICE_NAME for $ARCH", 4 | "url": "$SERVICE_NAME", 5 | "version": "$SERVICE_VERSION", 6 | "arch": "$ARCH", 7 | "public": true, 8 | "sharable": "singleton", 9 | "requiredServices": [], 10 | "userInput": [], 11 | "deployment": { 12 | "services": { 13 | "$SERVICE_NAME": { 14 | "image": "$SERVICE_CONTAINER" 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.13 as build 2 | LABEL stage=builder 3 | RUN apk --no-cache add curl 4 | RUN curl -L https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-x86_64-linux.tgz >speedtest.tgz 5 | RUN tar -xzvf speedtest.tgz 6 | COPY speedtest2wiotp.sh / 7 | COPY messaging.pem / 8 | 9 | FROM alpine:3.13 10 | RUN apk --no-cache add jq mosquitto-clients 11 | 12 | LABEL vendor="IBM" 13 | LABEL summary="Send Speedtest Download speed to Watson IoT Platform via MQTT" 14 | LABEL description="A container which runs the Speedtest service and sends the output to Watson IoT Platform via MQTT" 15 | 16 | WORKDIR / 17 | COPY --from=build . / 18 | 19 | ENTRYPOINT ["sh", "speedtest2wiotp.sh"] 20 | -------------------------------------------------------------------------------- /speedtest2wiotpq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export SPEEDTEST_PAUSE_SEC=10 4 | export WIOTP_ORG=quickstart 5 | export WIOTP_DEVICE_TYPE=anystring 6 | export WIOTP_DEVICE_TOKEN=anystring 7 | 8 | if [[ -z "${HZN_DEVICE_ID}" ]]; then 9 | export WIOTP_DEVICE_ID=speedtest 10 | else 11 | # use HZN_DEVICE_ID instead of WIOTP_DEVICE_ID in the Horizon Service container 12 | export WIOTP_DEVICE_ID=${HZN_DEVICE_ID} 13 | fi 14 | echo ${WIOTP_DEVICE_ID} 15 | 16 | while true; do 17 | result=`speedtest --accept-license -f json | jq -r '{downloadspeed: ( .download.bandwidth * 8 / 1000000)}'` 18 | echo "${result}" 19 | 20 | mosquitto_pub -h "${WIOTP_ORG}.messaging.internetofthings.ibmcloud.com" -p 1883 -i "d:${WIOTP_ORG}:${WIOTP_DEVICE_TYPE}:${WIOTP_DEVICE_ID}" -u "use-token-auth" -P "${WIOTP_DEVICE_TOKEN}" -t iot-2/evt/status/fmt/json -m "${result}" -d 21 | 22 | sleep ${SPEEDTEST_PAUSE_SEC} 23 | done 24 | -------------------------------------------------------------------------------- /speedtest2wiotp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export SPEEDTEST_PAUSE_SEC=10 4 | export WIOTP_ORG=spzdfr 5 | export WIOTP_DEVICE_TYPE=SpeedTest 6 | export WIOTP_DEVICE_TOKEN=`echo ${HZN_EXCHANGE_USER_AUTH} | cut -d- -f2` 7 | export WIOTP_DEVICE_TOKEN=jGGPhkT_gFm1uXElDDQ 8 | 9 | if [[ -z "${HZN_DEVICE_ID}" ]]; then 10 | export WIOTP_DEVICE_ID=SpeedTest002 11 | else 12 | # use HZN_DEVICE_ID instead of WIOTP_DEVICE_ID in the Horizon Service container 13 | export WIOTP_DEVICE_ID=${HZN_DEVICE_ID} 14 | fi 15 | export WIOTP_DEVICE_ID=SpeedTest002 16 | echo ${WIOTP_DEVICE_ID} 17 | 18 | while true; do 19 | result=`./speedtest --accept-license -f json | jq -r '{downloadspeed: ( .download.bandwidth * 8 / 1000000)}'` 20 | echo "${result}" 21 | 22 | echo mosquitto_pub -h "${WIOTP_ORG}.messaging.internetofthings.ibmcloud.com" -p 8883 --cafile ./messaging.pem -i "d:${WIOTP_ORG}:${WIOTP_DEVICE_TYPE}:${WIOTP_DEVICE_ID}" -u "use-token-auth" -P "${WIOTP_DEVICE_TOKEN}" -t iot-2/evt/status/fmt/json -m "${result}" -d 23 | 24 | mosquitto_pub -h "${WIOTP_ORG}.messaging.internetofthings.ibmcloud.com" -p 8883 --cafile ./messaging.pem -i "d:${WIOTP_ORG}:${WIOTP_DEVICE_TYPE}:${WIOTP_DEVICE_ID}" -u "use-token-auth" -P "${WIOTP_DEVICE_TOKEN}" -t iot-2/evt/status/fmt/json -m "${result}" -d 25 | 26 | sleep ${SPEEDTEST_PAUSE_SEC} 27 | done 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IBM Edge Application Manager Speedtest to Watson IoT Platform 2 | 3 | This repository builds a Docker containerized workload that can be deployed to 4 | an edge node running the Open Horizon agent. The workload can be configured as 5 | a managed service and pattern in IBM Edge Application Manager. It runs 6 | Speedtest periodically and sends the download bandwidth results over MQTT to 7 | Watson IoT Platform and plots the results in a chart. 8 | 9 | ![MQTT Chart](Speedtest-MQTT-results.png) 10 | 11 | ### Prerequistes 12 | 13 | - Docker installed 14 | - IEAM Horizon agent installed 15 | - [Speedtest CLI](https://www.speedtest.net/apps/cli) 16 | 17 | ### 18 | 19 | Begin by editing the variables at the top of the Makefile as desired. If you plan to push it to a Docker registry, make sure you give your docker ID. You may also want to create unique names for your **service** and **pattern** (necessary if you are running a multi-tentant IEAM instance with other users and you are all publishing this service). 20 | 21 | To play with this outside of Open Horizon: 22 | 23 | ``` 24 | make build 25 | make run 26 | ... 27 | make stop 28 | ``` 29 | 30 | When you are ready to try it inside Open Horizon: 31 | 32 | ``` 33 | docker login 34 | make build 35 | make push 36 | make publish-service 37 | make publish-pattern 38 | ``` 39 | 40 | Once it is published, you can use: 41 | 42 | ``` 43 | make register-pattern 44 | watch hzn agreement list 45 | ... 46 | ``` 47 | 48 | ### Other resources 49 | 50 | There are original implementations of this Speedtest idea in the Open Horizon 51 | examples repository. This variant is somewhat simpler. 52 | 53 | - [Horizon Speedtest REST Service](https://github.com/open-horizon/examples/tree/master/edge/services/speedtest) 54 | - [Horizon Watson IoT MQTT Speedtest Service](https://github.com/open-horizon/examples/tree/master/edge/wiotp/speedtest2wiotp) 55 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Speedtest service that sends the output to Watson IoT Platform via MQTT 2 | 3 | DOCKERHUB_ID:=walicki 4 | SERVICE_NAME:="speedtest-mqtt-example-instructor" 5 | SERVICE_VERSION:="2.0.0" 6 | PATTERN_NAME:="pattern-speedtest-mqtt-example-instructor" 7 | ARCH:="amd64" 8 | 9 | # Leave blank for open DockerHub containers 10 | # CONTAINER_CREDS:=-r "registry.wherever.com:myid:mypw" 11 | CONTAINER_CREDS:= 12 | 13 | default: build run 14 | 15 | build: 16 | docker build -t $(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION) . 17 | docker image prune --filter label=stage=builder --force 18 | 19 | dev: stop build 20 | docker run -it --name ${SERVICE_NAME} \ 21 | $(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION) /bin/bash 22 | 23 | run: stop 24 | docker run -d \ 25 | --name ${SERVICE_NAME} \ 26 | --restart unless-stopped \ 27 | $(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION) 28 | 29 | push: 30 | docker push $(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION) 31 | 32 | publish-service: 33 | @ARCH=$(ARCH) \ 34 | SERVICE_NAME="$(SERVICE_NAME)" \ 35 | SERVICE_VERSION="$(SERVICE_VERSION)"\ 36 | SERVICE_CONTAINER="$(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION)" \ 37 | hzn exchange service publish -O $(CONTAINER_CREDS) -f service.json --pull-image 38 | 39 | publish-pattern: 40 | @ARCH=$(ARCH) \ 41 | SERVICE_NAME="$(SERVICE_NAME)" \ 42 | SERVICE_VERSION="$(SERVICE_VERSION)"\ 43 | PATTERN_NAME="$(PATTERN_NAME)" \ 44 | hzn exchange pattern publish -f pattern.json 45 | 46 | register-pattern: 47 | hzn register --pattern "${HZN_ORG_ID}/$(PATTERN_NAME)" 48 | 49 | stop: 50 | @docker rm -f ${SERVICE_NAME} >/dev/null 2>&1 || : 51 | 52 | clean: 53 | @docker rmi -f $(DOCKERHUB_ID)/$(SERVICE_NAME):$(SERVICE_VERSION) >/dev/null 2>&1 || : 54 | 55 | .PHONY: build dev run push publish-service publish-pattern stop clean 56 | -------------------------------------------------------------------------------- /messaging.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh 3 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 4 | d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD 5 | QTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaME0xCzAJBgNVBAYTAlVT 6 | MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJzAlBgNVBAMTHkRpZ2lDZXJ0IFNIQTIg 7 | U2VjdXJlIFNlcn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tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO 41 | BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR 42 | TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw 43 | DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr 44 | hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg 45 | 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF 46 | PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls 47 | YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk 48 | CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= 49 | -----END CERTIFICATE----- 50 | 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------