RPi-SysInfo
view release on metacpan or search on metacpan
lib/RPi/SysInfo.pm view on Meta::CPAN
$fs_info .= _slurp('/proc/swaps') // '';
return $fs_info;
}
sub mem_percent {
return _format(memPercent());
}
sub network_info {
# ifconfig (net-tools) is the legacy default, but modern Raspberry Pi OS
# Lite ships without it, so fall back to `ip addr`, which is always present.
# Both forms carry inet/inet6 lines.
my $tool = _net_tool();
return '' if ! defined $tool;
my $netinfo = _run($tool);
chomp $netinfo;
return $netinfo;
}
t/data/pi3/ifconfig view on Meta::CPAN
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.5 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::1 prefixlen 64 scopeid 0x20<link>
ether aa:bb:cc:dd:ee:ff txqueuelen 1000 (Ethernet)
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
t/data/pi4/ip-addr view on Meta::CPAN
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
inet 10.0.0.7/24 brd 10.0.0.255 scope global dynamic eth0
valid_lft 86000sec preferred_lft 86000sec
inet6 fe80::1/64 scope link
t/data/pi5/ifconfig view on Meta::CPAN
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether aa:bb:cc:dd:ee:ff txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 106
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 10.0.0.5 netmask 255.0.0.0
inet6 fe80::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 350 bytes 36839 (35.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 350 bytes 36839 (35.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.5 netmask 255.255.255.0 broadcast 192.168.249.255
inet6 fe80::1 prefixlen 64 scopeid 0x20<link>
inet6 fe80::1 prefixlen 64 scopeid 0x0<global>
ether aa:bb:cc:dd:ee:ff txqueuelen 1000 (Ethernet)
RX packets 5139205 bytes 3226344007 (3.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3780587 bytes 2878123146 (2.6 GiB)
TX errors 0 dropped 6 overruns 0 carrier 0 collisions 0
( run in 0.485 second using v1.01-cache-2.11-cpan-9581c071862 )