#Metrics #Logs #support #IoT #Bringing #Secure #Monitoring #Logging #Edge
Simple uptime monitoring for Internet-of-Things (IoT) is well-known and requires knowing if the devices are up and running. Having additional long-term performance data, secure (tamper-proof) logging at your Edge devices is only a tiny step when using Metrics & Logs. With our support for device, infrastructure, and application metrics as well as Syslog data, you can monitor and secure the full stack of your IoT devices.
Think about the following features:
- Integration for Windows, Linux or other distributions
- very small footprint
- collect OS metrics
- collect application metrics (Webservice, MQTT Message Queuing Telemetry Transport and more)
- send log data via Syslog to a tamperproof log service
- flexible data retention
- powerful dashboards to monitor, troubleshoot or do capacity planning and forecasting
The following blog post explains a setup using Raspberry Pi devices and Metrics & Logs in the main or a satellite datacenter
Install telegraf agent
You can download the telegraf agent in the Metrics & Logs Admin Page under Infrastructure -> Linux -> Package

and then install the package using sudo dpkg -i telegraf*.deb when using Raspian.

Integrate the Metrics & Logs configuration
The telegraf.conf that comes with the package is not optimal for IoT devices, therefore also download the configuration file that can be found next to the Package on the Admin Page. The telegraf.conf also includes the target configuration, where to send the data to.
Copy the file to /etc/telegraf/telegraf.conf and add some more entries at the end of the file:
Get temperature data
[[inputs.file]]
files = ["/sys/class/thermal/thermal_zone0/temp"]
name_override = "cpu_temperature"
data_format = "value"
data_type = "integer"
[[inputs.exec]]
commands = ["/opt/vc/bin/vcgencmd measure_temp"]
name_override = "gpu_temperature"
data_format = "grok"
grok_patterns = ["%{NUMBER:value:float}"]
Make sure to either restart the system or the telegraf service after you made changes to the configuration:
sudo service telegraf restart
Monitoring the data
Moments after restarting the telegraf agent with the correct configuration you see data flowing into Metrics & Logs and you can find 3 different dashboards that can be used to monitor the IoT device performance.
Linux General Dashboard – a dashboard not specifically made for IoT devices, but can be used for capturing most Linux system metrics.

IoT device centric dashboard – optimized for Raspberry Pi and others:

Last but not least the overview dashboard where you can easily track many IoT devices in one place:

Capture Log files tamperproof
Metrics & Logs supports many different log forwarders, but the most commonly used one is rsyslog. Therefore this blog post is focused on configuration rsyslog forwarding.
Edit the rsyslog configuration file /etc/rsyslog.conf and add the following line at the top of the config:
# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
*.* @@168.119.133.52:30514
then restart and check the service:
sudo service rsyslog restart
sudo service rsyslog status

In case you want to test if logs are being forwarded, simply use the logger command:
logger -p daemon.emerg "Testing Metrics & Logs rsyslog forwarding!"

Now you should at least see the test message in your Log analytics dashboard:

Summary
That post covered all steps required to start sending performance and log data from your IoT devices to the Metrics & Logs service, which can be deployed in any virtual infrastructure. The configuration and the dashboards can be customized and easily enhanced to display much more data including applications like web services, file services, or database services.
You can get started for free with a 30-day trial: