Difference between revisions of "How to install Edge Connector"
Line 1: | Line 1: | ||
− | = Introduction = | + | = <span class="mw-headline" id="Introduction">Introduction</span> = |
This document will teach users how to complete prerequisites as well as installation of '''Edge Device''' in the next operating systems: Ubuntu 20.04 and Centos 8.5+ (and later versions). | This document will teach users how to complete prerequisites as well as installation of '''Edge Device''' in the next operating systems: Ubuntu 20.04 and Centos 8.5+ (and later versions). | ||
Line 6: | Line 6: | ||
| | ||
− | = Prerequisites = | + | = <span class="mw-headline" id="Prerequisites">Prerequisites</span> = |
− | == Log in As a Root User == | + | == <span class="mw-headline" id="Log_in_As_a_Root_User">Log in As a Root User</span> == |
To be able to execute installation commands into the computer’s Terminal, the user must log in as a root user to obtain permission to enter commands that will install new software. To do so, follow the steps below: | To be able to execute installation commands into the computer’s Terminal, the user must log in as a root user to obtain permission to enter commands that will install new software. To do so, follow the steps below: | ||
Line 24: | Line 24: | ||
<br/> '''Figure 1: User Logged In as a Root User''' | <br/> '''Figure 1: User Logged In as a Root User''' | ||
− | + | [[File:User Logged In as a Root User.png]] | |
| | ||
− | == Enable the ‘cgroups’ in the operating system == | + | == <span class="mw-headline" id="Enable_the_.E2.80.98cgroups.E2.80.99_in_the_operating_system">Enable the ‘cgroups’ in the operating system</span> == |
To be able to install the Edge Connector, the user must enable the ‘cgroups’ in the operating system. To do so, follow the steps below: | To be able to install the Edge Connector, the user must enable the ‘cgroups’ in the operating system. To do so, follow the steps below: | ||
Line 41: | Line 41: | ||
| | ||
− | == <br/> How to install Python == | + | == <br/> <span class="mw-headline" id="How_to_install_Python">How to install Python</span> == |
To be able to install the Edge Connector, the user’s computer must install the Python 3.8 version.<br/> To verify the current computer’s Python version follow the steps below: | To be able to install the Edge Connector, the user’s computer must install the Python 3.8 version.<br/> To verify the current computer’s Python version follow the steps below: | ||
Line 58: | Line 58: | ||
| | ||
− | == <br/> How to install the package management system Pip (Python Package Index) == | + | == <br/> <span class="mw-headline" id="How_to_install_the_package_management_system_Pip_.28Python_Package_Index.29">How to install the package management system Pip (Python Package Index)</span> == |
To be able to install the Edge Connector, the user must install the package management system Pip. To do so, click on the next link and follow the instructions: [https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/ https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/]. | To be able to install the Edge Connector, the user must install the package management system Pip. To do so, click on the next link and follow the instructions: [https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/ https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/]. | ||
Line 64: | Line 64: | ||
| | ||
− | == How to install the Python SDK (System Development Kit) == | + | == <span class="mw-headline" id="How_to_install_the_Python_SDK_.28System_Development_Kit.29">How to install the Python SDK (System Development Kit)</span> == |
To be able to install the Edge Connector, the user must install. To do so, follow the steps below: | To be able to install the Edge Connector, the user must install. To do so, follow the steps below: | ||
Line 79: | Line 79: | ||
| | ||
− | == <br/> How to install Java == | + | == <br/> <span class="mw-headline" id="How_to_install_Java">How to install Java</span> == |
To be able to install the Edge Connector, the user’s computer must have installed Java.<br/> To verify the current computer’s Java version follow the steps below: | To be able to install the Edge Connector, the user’s computer must have installed Java.<br/> To verify the current computer’s Java version follow the steps below: | ||
Line 97: | Line 97: | ||
| | ||
− | = How to install Edge Connector = | + | = <span class="mw-headline" id="How_to_install_Edge_Connector">How to install Edge Connector</span> = |
First of all, the user must create a new Edge Device to be able to download the Edge Connector installation package. | First of all, the user must create a new Edge Device to be able to download the Edge Connector installation package. | ||
Line 103: | Line 103: | ||
| | ||
− | == Create a new Edge Device == | + | == <span class="mw-headline" id="Create_a_new_Edge_Device">Create a new Edge Device</span> == |
To create a new Edge Device, follow the steps below: | To create a new Edge Device, follow the steps below: | ||
Line 116: | Line 116: | ||
<br/> '''Figure 2: Edge Devices Portlet''' | <br/> '''Figure 2: Edge Devices Portlet''' | ||
− | + | [[File:Edge Devices Portlet.png|700px]] | |
| | ||
Line 138: | Line 138: | ||
'''Figure 3: Create Edge Device Pop-up Window''' | '''Figure 3: Create Edge Device Pop-up Window''' | ||
− | + | [[File:Create Edge Device Pop-up Window.png|700x700px]] | |
| | ||
− | == Download and Install The Edge Device Installation Package == | + | == <span class="mw-headline" id="Download_and_Install_The_Edge_Device_Installation_Package">Download and Install The Edge Device Installation Package</span> == |
#'''Navigate''' to: '''Shop Floor Control > Configuration > IIoT Configuration > Edge Devices'''. | #'''Navigate''' to: '''Shop Floor Control > Configuration > IIoT Configuration > Edge Devices'''. | ||
Line 152: | Line 152: | ||
'''Figure 4: Edge Devices Portlet''' | '''Figure 4: Edge Devices Portlet''' | ||
− | + | [[File:Edge Devices Portlet.png|700px]] | |
| | ||
Line 168: | Line 168: | ||
'''Figure 5: Downloaded Folder Content''' | '''Figure 5: Downloaded Folder Content''' | ||
− | + | [[File:Downloaded Folder Content.png]] | |
| | ||
Line 186: | Line 186: | ||
| | ||
− | = <br/> How to manage the Edge Connector service from Terminal = | + | = <br/> <span class="mw-headline" id="How_to_manage_the_Edge_Connector_service_from_Terminal">How to manage the Edge Connector service from Terminal</span> = |
To be able to execute any of the commands used to manage the Edge Connector service, the user must open the terminal and login as a root user. | To be able to execute any of the commands used to manage the Edge Connector service, the user must open the terminal and login as a root user. | ||
Line 192: | Line 192: | ||
| | ||
− | == <br/> Stop The Service == | + | == <br/> <span class="mw-headline" id="Stop_The_Service">Stop The Service</span> == |
#'''Open''' the '''Terminal'''. | #'''Open''' the '''Terminal'''. | ||
Line 202: | Line 202: | ||
| | ||
− | == Disable The Service == | + | == <span class="mw-headline" id="Disable_The_Service">Disable The Service</span> == |
#'''Open''' the '''Terminal'''. | #'''Open''' the '''Terminal'''. | ||
Line 212: | Line 212: | ||
| | ||
− | == Remove The Service == | + | == <span class="mw-headline" id="Remove_The_Service">Remove The Service</span> == |
#'''Open''' the '''Terminal'''. | #'''Open''' the '''Terminal'''. | ||
Line 222: | Line 222: | ||
| | ||
− | == Verify That The Service Is Deleted == | + | == <span class="mw-headline" id="Verify_That_The_Service_Is_Deleted">Verify That The Service Is Deleted</span> == |
#'''Open''' the '''Terminal'''. | #'''Open''' the '''Terminal'''. | ||
Line 232: | Line 232: | ||
| | ||
− | == Delete Greengrass == | + | == <span class="mw-headline" id="Delete_Greengrass">Delete Greengrass</span> == |
#'''Open''' the '''Terminal'''. | #'''Open''' the '''Terminal'''. | ||
Line 240: | Line 240: | ||
| | ||
− | = <br/> How to Reinstall an Edge Device = | + | = <br/> <span class="mw-headline" id="How_to_Reinstall_an_Edge_Device">How to Reinstall an Edge Device</span> = |
It is possible for the user to reinstall an Edge Device, although the deployment job is already executed, it will not download the lambdas when executing the script, nevertheless, the user can trigger it on the portlet by removing it from the group, then adding it to the group that will deploy again. | It is possible for the user to reinstall an Edge Device, although the deployment job is already executed, it will not download the lambdas when executing the script, nevertheless, the user can trigger it on the portlet by removing it from the group, then adding it to the group that will deploy again. | ||
Line 248: | Line 248: | ||
| | ||
− | = Testing Cases = | + | = <span class="mw-headline" id="Testing_Cases">Testing Cases</span> = |
Server: [https://portal-uat.42-q.com/ https://portal-uat.42-q.com/]<br/> Site: gbs_test | Server: [https://portal-uat.42-q.com/ https://portal-uat.42-q.com/]<br/> Site: gbs_test | ||
Line 254: | Line 254: | ||
| | ||
+ | | ||
− | == <br/> <span class="mw-headline" id="Data_Ingestion">Data Ingestion</span> == | + | == <br/> <span class="mw-headline" id="Data_Ingestion"><span class="mw-headline" id="Data_Ingestion">Data Ingestion</span></span> == |
#'''Create''' a '''new Edge Device''' whose Group Name belongs to '''DataIngestionGroup'''. | #'''Create''' a '''new Edge Device''' whose Group Name belongs to '''DataIngestionGroup'''. | ||
Line 265: | Line 266: | ||
'''Figure 6: Edit Icon (Edge Devices)''' | '''Figure 6: Edit Icon (Edge Devices)''' | ||
− | + | [[File:Edit Icon (Edge Devices).png|700px]] | |
| | ||
Line 277: | Line 278: | ||
'''Figure 7: Edge Device Info Pop-up Window''' | '''Figure 7: Edge Device Info Pop-up Window''' | ||
− | + | [[File:Edge Device Info Pop-up Window.png|700px]] | |
| | ||
Line 289: | Line 290: | ||
'''Figure 8: Associate Client Device Pop-up Window''' | '''Figure 8: Associate Client Device Pop-up Window''' | ||
− | + | [[File:Associate Client Device Pop-up Window.png]] | |
| | ||
Line 302: | Line 303: | ||
'''Figure 9: Download Client Device Icon''' | '''Figure 9: Download Client Device Icon''' | ||
− | + | [[File:Download Client Device Icon.png|700px]] | |
| | ||
Line 327: | Line 328: | ||
| | ||
− | == Machine Interface == | + | == <span class="mw-headline" id="Machine_Interface">Machine Interface</span> == |
#'''Create''' a '''new Edge Device''' whose Group Name belongs to '''MachineInterfaceGroup'''. | #'''Create''' a '''new Edge Device''' whose Group Name belongs to '''MachineInterfaceGroup'''. | ||
Line 358: | Line 359: | ||
'''Figure 10: Open Source API Client Insomnia''' | '''Figure 10: Open Source API Client Insomnia''' | ||
− | + | [[File:Open Source API Client Insomnia.png|700x700px]] | |
| | ||
Line 374: | Line 375: | ||
'''Figure 11: TCP Server Message (Machine Interface)''' | '''Figure 11: TCP Server Message (Machine Interface)''' | ||
− | + | [[File:TCP Server Message (Machine Interface).png|700px]] | |
− | == <br/> Cloud Printing == | + | == <br/> <span class="mw-headline" id="Cloud_Printing">Cloud Printing</span> == |
#'''Create''' a '''new Edge Device''' whose Group Name belongs to '''CloudPrintingGroup'''. | #'''Create''' a '''new Edge Device''' whose Group Name belongs to '''CloudPrintingGroup'''. | ||
Line 397: | Line 398: | ||
| | ||
− | === By LE Print === | + | === <span class="mw-headline" id="By_LE_Print">By LE Print</span> === |
#'''Add''' a '''printer''' by navigating to: '''Administration > Label Engine Admin > Printer'''. | #'''Add''' a '''printer''' by navigating to: '''Administration > Label Engine Admin > Printer'''. | ||
Line 406: | Line 407: | ||
'''Figure 12: Adding a Printer''' | '''Figure 12: Adding a Printer''' | ||
− | + | [[File:Adding a Printer.png|700x700px]] | |
| | ||
Line 428: | Line 429: | ||
'''Figure 13: Creating a Print Job''' | '''Figure 13: Creating a Print Job''' | ||
− | + | [[File:Creating a Print Job.png|700x700px]] | |
| | ||
Line 445: | Line 446: | ||
'''Figure 14: TCP Server Message (Cloud Printing Command)''' | '''Figure 14: TCP Server Message (Cloud Printing Command)''' | ||
− | + | [[File:TCP Server Message (Cloud Printing Command).png|700px]] | |
| | ||
− | = <br/> Troubleshooting = | + | = <br/> <span class="mw-headline" id="Troubleshooting">Troubleshooting</span> = |
− | == Unable To Execute HTTP Request == | + | == <span class="mw-headline" id="Unable_To_Execute_HTTP_Request">Unable To Execute HTTP Request</span> == |
If while installing the Edge Connector the user gets the following error:<br/> '''Unable to execute HTTP request: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.''' | If while installing the Edge Connector the user gets the following error:<br/> '''Unable to execute HTTP request: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.''' | ||
Line 470: | Line 471: | ||
| | ||
+ | | ||
− | == <span class="mw-headline" id="Fail_to_start_cloud_printing_or_receive_messages">Fail to start cloud printing or receive messages</span> == | + | == <span class="mw-headline" id="Fail_to_start_cloud_printing_or_receive_messages"><span class="mw-headline" id="Fail_to_start_cloud_printing_or_receive_messages">Fail to start cloud printing or receive messages</span></span> == |
If the user gets the following error:<br/> '''Fail to start cloud printing or receive messages.<br/> 2022-07-28T12:50:30.771Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: eventstreamrpc.py:308,<Connection at 0x7f3c6da7ea30 /socket/greengrassv2_ipc.sock:0> connected. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:50:38.068Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:146,Failed to import handler function "ggPrint.function_handler" due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:50:38.069Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:426,Failed to initialize Lambda runtime due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:51:28.784Z [INFO] (pool-2-thread-27) sndnv_CloudPrinting: shell-runner-start. {scriptName=services.sndnv_CloudPrinting.lifecycle.shutdown.script, serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.10/lambda-..."]}<br/> 2022-07-28T12:51:28.834Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: Tearing down overlay tmpfs mounts. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING}''' | If the user gets the following error:<br/> '''Fail to start cloud printing or receive messages.<br/> 2022-07-28T12:50:30.771Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: eventstreamrpc.py:308,<Connection at 0x7f3c6da7ea30 /socket/greengrassv2_ipc.sock:0> connected. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:50:38.068Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:146,Failed to import handler function "ggPrint.function_handler" due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:50:38.069Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:426,Failed to initialize Lambda runtime due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}<br/> 2022-07-28T12:51:28.784Z [INFO] (pool-2-thread-27) sndnv_CloudPrinting: shell-runner-start. {scriptName=services.sndnv_CloudPrinting.lifecycle.shutdown.script, serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.10/lambda-..."]}<br/> 2022-07-28T12:51:28.834Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: Tearing down overlay tmpfs mounts. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING}''' |
Revision as of 16:33, 17 October 2022
Contents
Introduction
This document will teach users how to complete prerequisites as well as installation of Edge Device in the next operating systems: Ubuntu 20.04 and Centos 8.5+ (and later versions).
Prerequisites
Log in As a Root User
To be able to execute installation commands into the computer’s Terminal, the user must log in as a root user to obtain permission to enter commands that will install new software. To do so, follow the steps below:
- Open the Terminal.
- Enter the command: su, and then press Enter.
- Enter the root user’s password, and then press Enter.
Note: If the word: root@ appears before the computer’s username as in the image below, it means that you are logged in as a root user.
Figure 1: User Logged In as a Root User
Enable the ‘cgroups’ in the operating system
To be able to install the Edge Connector, the user must enable the ‘cgroups’ in the operating system. To do so, follow the steps below:
- Open the Terminal.
- Login as a root user.
- Enter the command: cat /etc/default/grub, and then press Enter.
- Enter the command: reboot, and then press Enter. This command will reboot the operating system in order to apply the changes.
How to install Python
To be able to install the Edge Connector, the user’s computer must install the Python 3.8 version.
To verify the current computer’s Python version follow the steps below:
- Open the Terminal.
- Login as a root user.
- Enter the command: python3 -V, and then press Enter.
Note: If Python 3.8 is not installed, please refer to the following links to install Python 3.8:
- For users using the CentOS operating system: https://computingforgeeks.com/how-to-install-python-3-on-centos/
- For users using the Ubuntu operating system: https://linuxize.com/post/how-to-install-python-3-8-on-ubuntu-18-04/
How to install the package management system Pip (Python Package Index)
To be able to install the Edge Connector, the user must install the package management system Pip. To do so, click on the next link and follow the instructions: https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/.
How to install the Python SDK (System Development Kit)
To be able to install the Edge Connector, the user must install. To do so, follow the steps below:
- To install the Python SDK, enter the command: pip3 install awsiotsdk, and then press Enter.
- Next step is to install the necessary libraries.
- Enter the command: pip3 install awscrt, and then press Enter.
- Enter the command: pip3 install awsiot, and then press Enter.
- Enter the command: pip3 install tzlocal, and then press Enter.
- Enter the command: pip3 install pytz, and then press Enter.
How to install Java
To be able to install the Edge Connector, the user’s computer must have installed Java.
To verify the current computer’s Java version follow the steps below:
- Open the Terminal.
- Login as a root user.
- Enter the command: java -version, and then press Enter.
Note: If Java is not installed, please refer to the following link to install Java:
- For users using the CentOS operating system: https://linuxize.com/post/install-java-on-centos-8/
How to install Edge Connector
First of all, the user must create a new Edge Device to be able to download the Edge Connector installation package.
Create a new Edge Device
To create a new Edge Device, follow the steps below:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
- Select CREATE EDGE DEVICE. A pop-up window will appear.
Figure 2: Edge Devices Portlet
- Enter the Edge Device Name.
- Select the Group Name:
- DataIngestionGroup
- CloudPrintingGroup
- MachineInterfaceGroup
- Select the Group Version.
- Select SAVE to save changes or CANCEL to abort.
Figure 3: Create Edge Device Pop-up Window
Download and Install The Edge Device Installation Package
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
- Hover the cursor over the Edge Device previously created.
- Select Download to download the zip file.
Figure 4: Edge Devices Portlet
- Right-click on the zip file.
- Select Extract Here.
- Open the downloaded folder.
- Make sure the file ggcV2.sh exists.
Figure 5: Downloaded Folder Content
- Open the Terminal.
- Login as a root user.
Note: For the next two steps it is recommended to turn off the ZScaler Client Connector, otherwise.
- Enter the command: cd GreengrassV2, and then press Enter.
- Enter the command: sudo ./ggcV2.sh, and then press Enter to execute the shell script.
How to manage the Edge Connector service from Terminal
To be able to execute any of the commands used to manage the Edge Connector service, the user must open the terminal and login as a root user.
Stop The Service
- Open the Terminal.
- Login as a root user.
- Enter the next command: sudo systemctl stop greengrass.service, and then press Enter.
Disable The Service
- Open the Terminal.
- Login as a root user.
- Enter the next command: sudo systemctl disable greengrass.service, and then press Enter.
Remove The Service
- Open the Terminal.
- Login as a root user.
- Enter the next command: sudo rm /etc/systemd/system/greengrass.service, and then press Enter.
Verify That The Service Is Deleted
- Open the Terminal.
- Login as a root user.
- Enter the next command: sudo systemctl daemon-reload && sudo systemctl reset-failed, and then press Enter.
Delete Greengrass
- Open the Terminal.
- Login as a root user.
- Enter the next command: sudo rm -rf /greengrass/v2, and then press Enter.
How to Reinstall an Edge Device
It is possible for the user to reinstall an Edge Device, although the deployment job is already executed, it will not download the lambdas when executing the script, nevertheless, the user can trigger it on the portlet by removing it from the group, then adding it to the group that will deploy again.
Testing Cases
Server: https://portal-uat.42-q.com/
Site: gbs_test
Data Ingestion
- Create a new Edge Device whose Group Name belongs to DataIngestionGroup.
- Select an Edge Device.
- Select the Edit icon.
Figure 6: Edit Icon (Edge Devices)
- Select the CLIENT DEVICES tab.
- Select CREATE CLIENT DEVICES.
Figure 7: Edge Device Info Pop-up Window
- Select the Client Device from the drop-down list.
- Select ASSOCIATE.
Figure 8: Associate Client Device Pop-up Window
- Select the Download icon to download the script.
Figure 9: Download Client Device Icon
- Right-click on the zip file.
- Select Extract Here.
- Open the extracted folder.
- Open the file MqttTest.py.
- Find the line that contains: ‘# Change This’.
- Modify the data information to be sent; users may see an example below:
message = {
"measurements": [ {
"timestamp": str(loc_dt),
"quality": "true",
"id": "GGC.V2.device.test001",
"value": random.randint(0,40)}],
"agent_id": "P88",
"client_id": "P88",
"data_acquisition_ts": str(loc_dt)
}
- Open the Terminal.
- Login as a root user.
- Enter the command: python3 MqttTest.py, and then press Enter.
Machine Interface
- Create a new Edge Device whose Group Name belongs to MachineInterfaceGroup.
- Hover the cursor over the Edge Device previously created.
- Select Download to download the zip file.
- Right-click on the zip file.
- Select Extract Here.
- Open the downloaded folder.
- Make sure the file ggcV2.sh exists.
- Open the Terminal.
- Login as a root user.
- Enter the command: sudo sh ggcV2.sh, and then press Enter.
- Download the next file: tcpServer.py.
- Go to the Terminal.
- Enter the command: sudo python tcpServer.py.
- Use an API Client to simulate sending the below data by Postman or RESTful client, then it will return the result 200 and the message: “publish message to topic successfully.”
Note: The red font part can be modified according to the actual situation.
URL: https://portal-uat.42-q.com/mes-api/gbs_test/greengrass/v2/publish
Method: Post
Data:
{
"topic": "snunv/machine-interface/snunv_E30_UAT_Demo_02",
"payload":{
"host": "127.0.0.1",
"port": "9090",
"content": {
"event_id": 3,
"event_name": "Part Re-Validation Pending",
"data": [
{
"workstation": "WS1",
"station": "1-1",
"material": "",
"board": "",
"msg": ""
},
{
"workstation": "WS1",
"station": "1-2",
"material": "",
"board": "",
"msg": ""
}
]
}
}
}
Figure 10: Open Source API Client Insomnia
- Navigate to the computer’s folder: /greengrass/v2/logs.
- Go to the Terminal.
- To view the log of the machine interface, enter the command: tail -f snsnv_MachineInterface.log
- View the message received in tcpServer.
Figure 11: TCP Server Message (Machine Interface)
Cloud Printing
- Create a new Edge Device whose Group Name belongs to CloudPrintingGroup.
- Hover the cursor over the Edge Device previously created.
- Select Download to download the zip file.
- Right-click on the zip file.
- Select Extract Here.
- Open the downloaded folder.
- Make sure the file ggcV2.sh exists.
- Open the Terminal.
- Login as a root user.
- Enter the command: sudo sh ggcV2.sh, and then press Enter.
- Download the next file: tcpServer.py.
- Go to the Terminal.
- Enter the command: sudo python tcpServer.py.
- Request print either by LE Print or Postman:
By LE Print
- Add a printer by navigating to: Administration > Label Engine Admin > Printer.
- Select Add.
Figure 12: Adding a Printer
Note: The TCPIP Address should be the address of the printer. Or in case users want to start a TCP Server, users should download the tcpServer.py file, and then execute the command: ‘sudo python3 tcpServer.py’ as a simulator.
- Create a print job by navigating to: Production > Label Engine Labels > LE Labels.
- Select a label.
- Select the Print button. A pop-up window will appear.
- Select the Printer Name created previously.
- Enter the Entry value.
- Select the Test Print button.
Figure 13: Creating a Print Job
- Navigate to the computer’s folder: /greengrass/v2/logs.
- Open the Terminal.
- Login as a root user.
- Enter the command: tail -f snsnv_CloudPrinting.log.
- View the message received in tcpServer.
Figure 14: TCP Server Message (Cloud Printing Command)
Troubleshooting
Unable To Execute HTTP Request
If while installing the Edge Connector the user gets the following error:
Unable to execute HTTP request: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.
The user can solve this issue following the steps below:
- Open the Terminal.
- Login as a root user.
- Enter the command: cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.amzn2.0.2.x86_64/jre/lib/security/java.security
- Use the keyboard arrows to find the next line: jdk.security.caDistrustPolicies=SYMANTEC_TLS
- Comment out the previous line by adding a hash symbol at the beginning of the line. It must look like this: #jdk.security.caDistrustPolicies=SYMANTEC_TLS
- Comment out the next line: /etc/pki/ca-trust/extracted/java keytool -trustcacerts -keystore "/etc/pki/ca-trust/extracted/java/cacerts" -storepass changeit -importcert -alias aws-trust -file "/etc/pki/ca-trust/source/amazontrust.crt"
Fail to start cloud printing or receive messages
If the user gets the following error:
Fail to start cloud printing or receive messages.
2022-07-28T12:50:30.771Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: eventstreamrpc.py:308,<Connection at 0x7f3c6da7ea30 /socket/greengrassv2_ipc.sock:0> connected. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}
2022-07-28T12:50:38.068Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:146,Failed to import handler function "ggPrint.function_handler" due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}
2022-07-28T12:50:38.069Z [ERROR] (pool-2-thread-19) sndnv_CloudPrinting: FATAL: lambda_runtime.py:426,Failed to initialize Lambda runtime due to exception: Error when retrieving credentials from container-role: Error retrieving metadata: Received non 200 response (500) from ECS metadata: Failed to get connection. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=RUNNING}
2022-07-28T12:51:28.784Z [INFO] (pool-2-thread-27) sndnv_CloudPrinting: shell-runner-start. {scriptName=services.sndnv_CloudPrinting.lifecycle.shutdown.script, serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.10/lambda-..."]}
2022-07-28T12:51:28.834Z [INFO] (pool-2-thread-18) sndnv_CloudPrinting: Tearing down overlay tmpfs mounts. {serviceInstance=0, serviceName=sndnv_CloudPrinting, currentState=STOPPING}
The user can solve this issue following the steps below:
- Open the Terminal.
- Login as a root user.
- Enter the command: pip3 config set global.cert /usr/lib/ZscalerRootCertificate-2048-SHA256.crt
If it still do not work, do the following:
- Close Zscaler, then restart Greengrass by running the next command: sudo systemctl restart greengrass.service
- After restarting, open Zscaler again.