WiFi monitoring system that uses a dual-band Mikrotik router to scan and collect information from nearby access points. Specifically designed for quick testing of home CPE equipment such as ONTs or Cable modems.
- Simultaneous monitoring on 2.4GHz and 5GHz bands
- Real-time data collection including:
- AP MAC address
- SSID
- Frequency band
- Channel width
- Specific frequency
- Signal strength
- Noise level
- Signal-to-Noise Ratio (SNR)
- REST API for JSON data queries
- Web interface for data visualization
- Automatic cleanup of old data
- Automatic time synchronization
- Linux (Debian/Ubuntu recommended)
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Daemonize (
apt install daemonize)
- Dual-band Mikrotik router
- Specific configuration provided in the Mikrotik-config folder
-
Clone the repository:
git clone [repository_URL] cd WIFI_Lissener -
Install system dependencies:
apt update apt install php mysql-server daemonize composer
-
Configure the database:
mysql -u root -p < Server/wifi_mysql_config.sql -
Copy server files:
mkdir /var/www mkdir /var/www/html cp -r Server/* /var/www/html/ cp Server/root/* /root/ cd /var/www/html/ composer update
-
Configure database credentials:
- Copy
.env.exampleto.env - Edit
.envwith your MySQL credentials
- Copy
-
Configure cron:
crontab -e
Add the following lines (adjust MySQL password):
*/30 * * * * /usr/sbin/ntpdate pool.ntp.org */1 * * * * /usr/bin/bash /root/wifi2.sh */1 * * * * /usr/bin/bash /root/wifi5.sh @reboot sleep 32; /usr/sbin/daemonize /usr/bin/php -S 0.0.0.0:80 -t /var/www/html/ */1 * * * * mysql -u dbuser -ppassword -D teccam -e "DELETE FROM teccam.wifi_2 WHERE w2_fecha < (NOW() - INTERVAL 1 MINUTE)" */1 * * * * mysql -u dbuser -ppassword -D teccam -e "DELETE FROM teccam.wifi_5 WHERE w2_fecha < (NOW() - INTERVAL 1 MINUTE)" 10 12 * * * mysql -u dbuser -ppassword -D teccam -e "TRUNCATE TABLE teccam.wifi_2" 10 12 * * * mysql -u dbuser -ppassword -D teccam -e "TRUNCATE TABLE teccam.wifi_5" * 2 * * * /usr/sbin/reboot
- Apply the configuration provided in the
Mikrotik-configfolder - Verify that the router has connectivity with the server
-
Access the web interface:
http://[server_IP] -
Query data via API:
http://[server_IP]/wifi-mt2.php # 2.4GHz data http://[server_IP]/wifi-mt5.php # 5GHz data
Data is updated every minute and is kept for 1 minute before being automatically deleted.
The system includes the following automatic tasks:
- Cleanup of old records every minute
- Daily table truncation at 12:10
- System reboot at 2:00
- Time synchronization every 30 minutes
The system uses two main tables:
wifi_2: Stores 2.4GHz band datawifi_5: Stores 5GHz band data
Each table includes fields for:
- Unique ID
- MAC Address
- SSID
- Band
- Channel Width
- Frequency
- Signal
- Noise
- SNR
- Timestamp