The TeamViewer IoT Log Parser Connector easily extracts & integrates sensor data from your log files.
The Log Parser Connector is generic, in that, it can be used to parse any log. For the context of this article, it is assumed your IoT sensor values are written to a log file which you would like to connect to the TeamViewer IoT Agent.
The setup contains two basic steps. Follow the sections in this article:
- Download and install the Log Parser Connector
- Integrate the Log Parser Connector with the TeamViewer IoT Agent
For more information about configuration and syntax see Configuration and Syntax of the TeamViewer Log Parser Connector.
What you will need
Make sure that you have prepared the following points:
- Python 3 is installed on the Edge Device (see https://www.python.org/downloads/).
- Access the Edge Device via Remote Terminal.
- The edge device is set up with a TeamViewer IoT Agent and TeamViewer Edge Management is enabled.
- The edge device is connected to the internet.
- Basic knowledge of the editor nano.
Download and install the Log Parser Connector
- Access the edge device remotely (Access the Edge Device via Remote Terminal).
- Download the Log Parser Connector. In the terminal type in the following command and press return.
- Upon completion of the download, extract the contents of the connector. In the terminal type in the following commands and press return:
sudo mkdir -p /usr/local/teamviewer-iot-agent/monitoring/
tar -xzvf teamviewer_iot_log_parser-1.0.0.tar.gz -C /usr/local/teamviewer-iot-agent/monitoring/
- Install the Log Parser Connector. In the terminal type in the following command and press return.
cd teamviewer_iot_log_parser-1.0.0 python3 setup.py install
- Verify the installation was successful by identifying a log file to parse and using the following command to parse a string. In the terminal type in the following command and press return. Replace
justTextorRegexwith the path of your log file and a string to search for, respectively.
teamviewer_iot_log_parser -f logFilePath --regex justTextOrRegex
Integrate the Log Parser Connector with the TeamViewer IoT Agent
The TeamViewer IoT Agent includes its own system monitoring configuration file. This configuration file will be extended to include the Log Parser configuration.
For each sensor you want to integrate, append its registration information to the configuration file. Reference the Log Parser Connector Template or the Examples and replace the placeholders with your sensor details.
- To modify the configuration file open the file with nano:
- Modify the configuration file as needed.
- Save the file and exit nano.
- Restart the IoT Agent to reload the configuration file. In the terminal type in the following command and press return.
- To log in to the IoT Management Console, open https://teamviewer-iot.com and use your TeamViewer account credentials.
- From the left menu select Dashboard.
- Verify that the Sensors/Metrics added to the configuration file now appear on your Metrics tab.
- Use a Widget to pin the metrics to your dashboard and ensure the data is being updated per the frequency specified in the config file.