#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
// WiFi credentials
const char* ssid = "SSID";
const char* password = "PASS";
// Prometheus Pushgateway
const char* pushgatewayHost = "https://pushgateway.example.com/metrics/job/voltage_monitor/instance/node-8266/sensor/voltage";
// Voltage divider resistors
const float R1 = 29000.0;
const float R2 = 7500.0;
// ADC config
const float ADC_RESOLUTION = 1023.0;
const float REF_VOLTAGE = 3.3; // Adjust depending on your board
float previousVoltage = -1.0;
void setup() {
Serial.begin(115200);
delay(1000);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nConnected!");
}
void loop() {
float voltage = readVoltage();
if (abs(voltage - previousVoltage) > 0.01) { // send only if change > 10 mV
sendToPrometheus(voltage);
previousVoltage = voltage;
} else {
Serial.println("⚠️ Voltage unchanged. Skipping Pushgateway update.");
}
delay(20000); // Send every 20 seconds
}
float readVoltage() {
int adcValue = analogRead(A0);
float vOut = (adcValue / ADC_RESOLUTION) * REF_VOLTAGE;
float vIn = vOut * ((R1 + R2) / R2);
Serial.print("Measured Voltage: ");
Serial.println(vIn, 3);
return vIn;
}
void sendToPrometheus(float voltage) {
if (WiFi.status() != WL_CONNECTED) {
Serial.println("WiFi not connected!");
return;
}
//WiFiClient client; // for http
//HTTPClient http;
WiFiClientSecure client;
client.setInsecure();
HTTPClient http;
String metrics = "voltage_sensor " + String(voltage, 3) + "\n";
String url = String(pushgatewayHost) ;
// Encode Basic Auth manually
String base64Credentials = "Base64encoded Creds";
String authHeader = "Basic " + base64Credentials;
http.begin(client, url);
http.addHeader("Content-Type", "text/plain");
http.addHeader("Authorization", authHeader);
int httpCode = http.POST(metrics);
if (httpCode > 0) {
Serial.printf("Pushgateway Response: %d\n", httpCode);
} else {
Serial.printf("Failed to send data: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
}
Category: linux
check LAN max speed- iperf3
apt install iperf3
#on server 192.168.0.10
iperf -s
#on client
iperf -c 192.168.0.10
root@lp-arm-3:~# iperf3 -c 192.168.0.10
Connecting to host 192.168.0.10, port 5201
[ 5] local 192.168.0. port 50976 connected to 192.168.0.10
port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 11.4 MBytes 95.6 Mbits/sec 248 48.1 KBytes
[ 5] 1.00-2.00 sec 10.9 MBytes 91.2 Mbits/sec 260 38.2 KBytes
[ 5] 2.00-3.00 sec 10.9 MBytes 91.7 Mbits/sec 251 38.2 KBytes
[ 5] 3.00-4.00 sec 11.2 MBytes 93.8 Mbits/sec 245 48.1 KBytes
[ 5] 4.00-5.00 sec 10.8 MBytes 90.7 Mbits/sec 277 36.8 KBytes
[ 5] 5.00-6.00 sec 11.3 MBytes 94.9 Mbits/sec 247 38.2 KBytes
[ 5] 6.00-7.00 sec 11.1 MBytes 92.8 Mbits/sec 231 52.3 KBytes
[ 5] 7.00-8.00 sec 10.9 MBytes 91.7 Mbits/sec 260 46.7 KBytes
[ 5] 8.00-9.00 sec 10.8 MBytes 90.7 Mbits/sec 241 50.9 KBytes
[ 5] 9.00-10.00 sec 10.9 MBytes 91.7 Mbits/sec 245 46.7 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 110 MBytes 92.5 Mbits/sec 2505 sender
[ 5] 0.00-10.05 sec 110 MBytes 91.9 Mbits/sec receiver
iperf Done.
Ref- https://www.jeffgeerling.com/blog/2025/exploring-wifi-7-2-gbps-on-raspberry-pi-5
Ubuntu – Linux thermal / temperature sensor
#!/bin/bash
cpu=$(</sys/class/thermal/thermal_zone6/temp)
cpu_temp=$(echo "$cpu/1000" | /usr/bin/bc -l)
echo "CPU_temp $cpu_temp"
root@lp-knode-2:~# cat /sys/class/thermal/thermal_zone*/type
INT3400 Thermal
SEN1
SEN2
SEN3
SEN4
SEN5
pch_cannonlake
B0D4
iwlwifi_1
x86_pkg_temp
root@lp-knode-2:~# cat /sys/class/thermal/thermal_zone*/temp
20000
41050
47050
41050
45050
50
54000
46050
48000
46000
https://askubuntu.com/questions/1110943/what-do-the-different-thermal-zones-actually-correspond-to
Ubuntu desktop sharing
grdctl status
grdctl rdp enable
grdctl rdp set-credentials username pass
grdctl --system status --show-credentials
#connect
rdesktop -u USERNAME -p PASS 192.168.0.210
wake on lan – wol – ubutnu
https://help.ubuntu.com/community/WakeOnLan
apt install ethtool
ethtool eth
root@home:/home# ethtool enp3s0
Settings for enp3s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Link detected: no
wol p|u|m|b|a|g|s|d...
Sets Wake-on-LAN options. Not all devices support this.
The argument to this option is a string of characters speci‐
fying which options to enable.
p Wake on PHY activity
u Wake on unicast messages
m Wake on multicast messages
b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket™
s Enable SecureOn™ password for MagicPacket™
d Disable (wake on nothing). This option
clears all previous options.
wake command
apt install etherwake
etherwake MAC-ADDRESS
Disable USB power in ubuntu
- find list of usb
lsusb
ls /sys/bus/usb/devices
- disable USB on startup
echo disabled | sudo tee /sys/bus/usb/devices/usb2/power/wakeup
- Remove power from port
echo suspend | sudo tee /sys/bus/usb/devices/usb2/power/level
- add power to port again
echo auto | sudo tee /sys/bus/usb/devices/usb2/power/level
Let me recap for Linux >= 2.6.38: The file power/level
is deprecated now; use power/control
instead. (power/wakeup
is ok.)
https://stackoverflow.com/questions/4702216/controlling-a-usb-power-supply-on-off-with-linux
apt install powertop
powertop
OpenMediaVault rsync – ubuntu
- Edit the file /etc/default/rsync
RSYNC_ENABLE=inetd
#install
apt-get -y install xinetd
- create /etc/xinetd.d/rsync
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
flags = IPv4
}
- Create /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300
[share]
comment = Public Share
path = /home/share
read only = no
list = yes
uid = 0
gid = 0
auth users = user
secrets file = /etc/rsyncd.secrets
cat /etc/rsyncd.secrets
user1:user1
chmod 600 /etc/rsyncd.secrets
- Restart
/etc/init.d/xinetd restart
- Verify
home@home:~$ rsync user1@192.168.29.142::share
Password:
drwxr-xr-x 4,096 2025/03/21 11:21:47 .
-rw-r--r-- 0 2025/03/21 11:21:47 1.txt


bluetooth – bluetoothctl service on ubuntu
- Check service status
systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
Active: active (running) since Fri 2025-03-21 07:57:38 IST; 1min 18s ago
Docs: man:bluetoothd(8)
Main PID: 21633 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 76673)
Memory: 1.1M (peak: 1.6M)
CPU: 55ms
CGroup: /system.slice/bluetooth.service
└─21633 /usr/libexec/bluetooth/bluetoothd
- For monitoring events on Bluetooth
root@home:~# bluetoothctl
bluetooth]# [NEW] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# [DEL] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# [NEW] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# [CHG] Device D0:49:7C:8F:xx:xx RSSI: 0xffffffab (-85)
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller
devices [Paired/Bonded/Trusted/Connected] List available devices, with an optional property as the filter
system-alias <name> Set controller alias
reset-alias Reset controller alias
power <on/off> Set controller power
pairable <on/off> Set controller pairable mode
discoverable <on/off> Set controller discoverable mode
discoverable-timeout [value] Set discoverable timeout
agent <on/off/auto/capability> Enable/disable agent with given capability
default-agent Set agent as the default one
advertise <on/off/type> Enable/disable advertising with given type
set-alias <alias> Set device alias
scan <on/off/bredr/le> Scan for devices
info [dev/set] Device/Set information
pair [dev] Pair with device
cancel-pairing [dev] Cancel pairing with device
trust [dev] Trust device
untrust [dev] Untrust device
block [dev] Block device
unblock [dev] Unblock device
remove <dev> Remove device
connect <dev> Connect device
disconnect [dev] Disconnect device
menu <name> Select submenu
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print environment variables
Raspberry pi disk read/write speed test result – dd
sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash
root@lp-arm-1:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'Unlisted' 'SC'
product: 'EC1S5' 3.0
root@lp-arm-1:~#
Category Test Result
HDParm Disk Read 41.53 MB/sec
HDParm Cached Disk Read 41.88 MB/sec
DD Disk Write 11.3 MB/s
FIO 4k random read 3646 IOPS (14586 KB/s)
FIO 4k random write 620 IOPS (2481 KB/s)
IOZone 4k read 8160 KB/s
IOZone 4k write 1897 KB/s
IOZone 4k random read 6715 KB/s
IOZone 4k random write 2006 KB/s
Score: 893
==========================================================
root@lp-arm-2:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SD32G' 8.5
root@lp-arm-2:~#
Category Test Result
HDParm Disk Read 38.89 MB/sec
HDParm Cached Disk Read 37.33 MB/sec
DD Disk Write 18.3 MB/s
FIO 4k random read 2692 IOPS (10771 KB/s)
FIO 4k random write 926 IOPS (3706 KB/s)
IOZone 4k read 7577 KB/s
IOZone 4k write 1803 KB/s
IOZone 4k random read 6164 KB/s
IOZone 4k random write 3204 KB/s
Score: 1048
==========================================================
root@lp-arm-3:~# lshw -class disk
*-disk
description: SCSI Disk
product: Storage Device
vendor: Mass
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
size: 447GiB (480GB)
root@lp-arm-3:~#
Category Test Result
HDParm Disk Read 31.01 MB/sec
HDParm Cached Disk Read 29.69 MB/sec
DD Disk Write 27.4 MB/s
FIO 4k random read 512 IOPS (2048 KB/s)
FIO 4k random write 2871 IOPS (11484 KB/s)
IOZone 4k read 12668 KB/s
IOZone 4k write 10282 KB/s
IOZone 4k random read 10202 KB/s
IOZone 4k random write 11744 KB/s
Score: 2400
=================================================
root@lp-arm-4:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SD32G' 8.5
root@lp-arm-4:~#
Category Test Result
HDParm Disk Read 39.28 MB/sec
HDParm Cached Disk Read 35.07 MB/sec
DD Disk Write 17.4 MB/s
FIO 4k random read 2967 IOPS (11869 KB/s)
FIO 4k random write 876 IOPS (3506 KB/s)
IOZone 4k read 7180 KB/s
IOZone 4k write 1844 KB/s
IOZone 4k random read 5824 KB/s
IOZone 4k random write 2350 KB/s
Score: 942
==================================================
root@pi5:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'Transcend/Samsung' 'SM'
product: 'ED2S5' 3.0
root@pi5:~#
Category Test Result
HDParm Disk Read 42.00 MB/sec
HDParm Cached Disk Read 80.31 MB/sec
DD Disk Write 54.6 MB/s
FIO 4k random read 4227 IOPS (16911 KB/s)
FIO 4k random write 833 IOPS (3333 KB/s)
IOZone 4k read 21831 KB/s
IOZone 4k write 3226 KB/s
IOZone 4k random read 16273 KB/s
IOZone 4k random write 3229 KB/s
Score: 2035
- DD command with 1GB
root@pi5:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 20.0689 s, 53.5 MB/s
root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 117.843 s, 9.1 MB/s
root@lp-arm-2:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 72.3963 s, 14.8 MB/s
###########pi4 with old USB-to-SATA cable###########
root@lp-arm-3:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 39.0338 s, 27.5 MB/s
###########pi4 with new USB-to-SATA cable###########
pi@lp-arm-3:~ $ dd if=/dev/zero of=/tmp/test2.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.6486 s, 190 MB/s
#######################################################
root@lp-arm-4:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 183.551 s, 5.8 MB/s
[root@lp-k8control-1 ~]# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.1345 s, 96.4 MB/s
[root@lp-knode-1 ~]# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 9.51946 s, 113 MB/s
root@lp-proxmox-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 8.93593 s, 120 MB/s
home@home:~$ dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.69814 s, 632 MB/s
========Crucial 1000GB SSD with SATA USB 3.0 with laptop=====
home@home:~$ dd if=/dev/zero of=/media/home/backup-ssd1/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 3.08829 s, 348 MB/s
========Crucial 1000GB SSD with SATA USB 3.0 with pi5 ntfs=====
root@pi5:~# dd if=/dev/zero of=/media/home/backup-ssd1/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.16956 s, 258 MB/s
===========pi5===Sandisk-extreme=======================
root@pi5-sandisk:/home/pi# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 15.1769 s, 70.7 MB/s
===========pi5===Samsung evo plus=======================
root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 20.0689 s, 53.5 MB/s
===========pi4===Sandisk-extreme=======================
root@lp-arm-4:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 28.8803 s, 37.2 MB/s
===========pi4===Samsung evo plus=======================
root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 30.305 s, 35.4 MB/s
============on pi4 NFS server 188============================
root@lp-knode-2:~# dd if=/dev/zero of=/mnt/nfs188/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.2499 s, 95.4 MB/s
More test ref:

Install virt-manager and libvirt for VM
kvm-ok
apt install qemu-kvm libvirt-daemon-system
apt install virt-manager
virt-manager
https://documentation.ubuntu.com/server/how-to/virtualisation/libvirt/