Set up the Log Parser Connector for easy Integration of your Log Based Sensors/Metrics

Set up the Log Parser Connector for easy Integration of your Log Based Sensors/Metrics

October 9, 2020
TeamViewer IoT Documentation

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:

  1. Download and install the Log Parser Connector
  2. 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 2 is not supported.

Download and install the Log Parser Connector

  1. Access the edge device remotely (Access the Edge Device via Remote Terminal).
  2. Download the Log Parser Connector. In the terminal type in the following command and press return.
wget  https://download.teamviewer-iot.com/connectors/teamviewer-iot-log-parser/1.0.0/teamviewer_iot_log_parser-1.0.0.tar.gz
  1. 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/
  1. 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
  1. 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 logFilePath & justTextorRegex with 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.

Before editing files mentioned in this task create a backup. Use the backups in case of a corrupted system or data.

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.

  1. To modify the configuration file open the file with nano:
nano /var/lib/teamviewer-iot-agent/system_monitors.conf
  1. Modify the configuration file as needed.
  2. Save the file and exit nano.
  3. Restart the IoT Agent to reload the configuration file. In the terminal type in the following command and press return.
teamviewer-iot-agent restart
  1. To log in to the IoT Management Console, open https://teamviewer-iot.com and use your TeamViewer account credentials.
  2. From the left menu select Dashboard.
  3. Verify that the Sensors/Metrics added to the configuration file now appear on your Metrics tab.
  4. 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.

Related posts

Want more? Exclusive deals, the latest news: Our Newsletter!