desbma/sysstat_mail_report

OSError: [Errno 22] Invalid argument in Ubuntu 16.04.1

thedavidr opened this issue · 10 comments

When I run it like in the example below, I get the error.

/usr/local/bin/sysstat_report.py daily 'sender@myserver.com' 'myemail@gmail.com' -v warning
Traceback (most recent call last):
File "/usr/local/bin/sysstat_report.py", line 547, in
"yrange": (0, "%u<*" % (get_max_network_speed()))},
File "/usr/local/bin/sysstat_report.py", line 55, in get_max_network_speed
new_speed = int(f.read())
OSError: [Errno 22] Invalid argument

Thanks for the report.

Can you please post here the output of ls -l /sys/class/net.

Output for ls -l /sys/class/net

lrwxrwxrwx 1 root root 0 Dec 8 15:07 dummy0 -> ../../devices/virtual/net/dummy0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 eth0 -> ../../devices/pci0000:00/0000:00:04.0/virtio1/net/eth0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 gre0 -> ../../devices/virtual/net/gre0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 gretap0 -> ../../devices/virtual/net/gretap0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 ip6_vti0 -> ../../devices/virtual/net/ip6_vti0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 ip6gre0 -> ../../devices/virtual/net/ip6gre0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 ip6tnl0 -> ../../devices/virtual/net/ip6tnl0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 ip_vti0 -> ../../devices/virtual/net/ip_vti0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Dec 8 15:07 sit0 -> ../../devices/virtual/net/sit0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 teql0 -> ../../devices/virtual/net/teql0
lrwxrwxrwx 1 root root 0 Dec 8 15:07 tunl0 -> ../../devices/virtual/net/tunl0

You have a lot of interfaces, and the dummy kernel module loaded, which adds a fake network interface that does not allow reading its speed.
I did reproduce the problem, and made the code more robust, please try latest version from master branch to confirm it is fixed.

Thank you for the help.
After getting the latest version from master branch, I get the following...

2016-12-09 12:07:54,865 WARNING Unable to get speed of interface tunl0
2016-12-09 12:07:54,866 WARNING Unable to get speed of interface dummy0
2016-12-09 12:07:54,866 WARNING Unable to get speed of interface ip6tnl0
2016-12-09 12:07:54,866 WARNING Unable to get speed of interface ip_vti0
2016-12-09 12:07:54,866 WARNING Unable to get speed of interface ip6_vti0
2016-12-09 12:07:54,867 WARNING Unable to get speed of interface gre0
2016-12-09 12:07:54,867 WARNING Unable to get speed of interface ip6gre0
2016-12-09 12:07:54,867 WARNING Unable to get speed of interface teql0
2016-12-09 12:07:54,867 WARNING Unable to get speed of interface gretap0
2016-12-09 12:07:54,867 WARNING Unable to get speed of interface sit0
Traceback (most recent call last):
File "/usr/local/bin/sysstat_report.py", line 561, in
reboot_times = get_reboot_times()
File "/usr/local/bin/sysstat_report.py", line 77, in get_reboot_times
date_str = date_regex.match(l).group(1).strip()
AttributeError: 'NoneType' object has no attribute 'group'

I did reproduce too on Arch Linux, should be fixed now.

Hi,

Same problem here: "Unable to get speed of interface wlan0" (Ubuntu 18.04, if that matters)

I get this:

$ cat /sys/class/net/wlo1/speed
cat: /sys/class/net/wlo1/speed: Invalid argument

and I don't really know what that means. Any idea?

$ ls -l /sys/class/net
total 0
lrwxrwxrwx 1 root root 0 mar 15 21:43 eno2 -> ../../devices/pci0000:00/0000:00:1f.6/net/eno2
lrwxrwxrwx 1 root root 0 mar 15 21:43 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 mar 15 21:43 wlo1 -> ../../devices/pci0000:00/0000:00:14.3/net/wlo1

Same problem here: "Unable to get speed of interface wlan0" (Ubuntu 18.04, if that matters)

That error alone should not prevent the script from running, does it?

For whatever reason, Linux does not expose the speed of the interface wlo1, if you only have that message, it should work for eno2.

It doesn't prevent the script from running, but it doesn't give the expected output. neither on my laptop nor my Raspberry Pi, as you can see here:

image

What could be the reason of this error reading from /sys/class/net/wlo1/speed?

it doesn't give the expected output.

What is the output you expect? The graph seems fine to me, but as you have extremely low bandwidth usage, the plotted data is barely visible. I can see small bursts of traffic for example at 13:20 for eth0.

As for why wlo1 does not expose its speed, I don't know because I don't know your system. I guess eth0 is a wired interface and wlan0 your wifi, so is wlo1 a secondary wifi interface? Is is blocked (soft/hard) by rfkill, is is connected to an endpoint?

Oh, I didn't see such small bursts! Thank you.
I'll investigate the wifi interfaces issue.
Thanks!