Data Collection — Implementing System & Sensor Monitoring
Data Collection — Implementing System & Sensor Monitoring
🎯 Overview
In this post, we implement the data collection layer, which is the foundation of the entire monitoring system.
We collect two types of data:
- System metrics (CPU, Memory, Disk)
- Hardware sensor data (Temperature, Fan Speed, Power)
Due to platform limitations, we adopt a hybrid collection strategy.
🏗️ Data Collection Architecture
1
2
3
4
5
6
7
8
9
[System Metrics]
Telegraf (60s interval)
↓
InfluxDB
[Sensor Data]
HWiNFO → Python (3s interval)
↓
InfluxDB
📡 1. System Metrics Collection (Telegraf)
Why Telegraf?
- Lightweight agent
- Native InfluxDB integration
- Supports Windows
⚙️ Telegraf Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[agent]
interval = "60s"
[[inputs.cpu]]
percpu = true
totalcpu = true
[[inputs.mem]]
[[inputs.disk]]
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "YOUR_TOKEN"
organization = "YOUR_ORG"
bucket = "iot"
🌡️ 2. Sensor Data Collection (HWiNFO + Python)
Why Not Telegraf?
Telegraf cannot collect:
- Temperature
- Fan Speed
- Power
Solution
Use:
- HWiNFO (Sensor Provider)
- Python (Collector)
⚙️ HWiNFO Setup
Steps:
- Run HWiNFO in Sensors-only mode
- Enable:
- Shared Memory Support
🧠 3. Hybrid Strategy Explained
| Data Type | Solution | Interval |
|---|---|---|
| CPU / Memory | Telegraf | 60s |
| Temperature | Python | 3s |
| Fan Speed | Python | 3s |
⚠️ Challenges
- Windows Limitation
- No native API for sensors
- Requires external tool
- Data Synchronization
- Different intervals
- Requires aggregation later
- Performance
- High-frequency writes → InfluxDB tuning needed
🎯 Key Takeaways
- Use Telegraf for standard metrics
- Use Python for custom sensor ingestion
- Separate pipelines for flexibility
🚀 Next Step
In the next post, we will design the data storage schema, including:
InfluxDB measurement design MySQL aggregation tables
This post is licensed under CC BY 4.0 by the author.