longview
longview copied to clipboard
data getter for processes shouldn't assume that every uid has pwd entry
Processes can run (e.g. inside docker containers) with user ids that don't have valid pwd entries on the host system. The code at https://github.com/linode/longview/blob/240db8f231081270d6a478809dc73574b59a2918/Linode/Longview/DataGetter/Processes.pm#L68 seems to assume otherwise:
$proc{user} = ( getpwuid( $proc{uid} ) )[0];
$proc{user}
is later used in https://github.com/linode/longview/blob/240db8f231081270d6a478809dc73574b59a2918/Linode/Longview/DataGetter/Processes.pm#L101-L108 and results in hundreds of warning in the log file, repeated every 5 minutes:
04/21 09:51:35 WARN Longview[6907] - Use of uninitialized value $info{"user"} in concatenation (.) or string at /opt/linode/longview/Linode/Longview/DataGetter/Processes.pm line 101.
I'm seeing this as well. Debating what to replace it with.
Oh my! 10 minutes with longview running:
$ cat /var/log/linode/longview.log | grep "Use of uninitialized value" | wc -l
10502
This is crazy!
And yes I have many containers running.
Same problem here.
Same here. Tons of warnings with docker containers.
As it turns out, the fix is actually really simple.
I've spent the last 3 months raising ticket after ticket with linode support about this, and they keep suggesting random things like "try uninstalling and then reinstalling the agent" and seem completely unaware of this issue that has been open for years.
@jamezpolley I've actually contacted them directly suggesting they pay attention to this repo as there are several outstanding pull requests. They didn't seem too interested at all. Kind of sad really.
If you clone my fork, and use it instead you won't have to deal with this issue anymore.
Thanks @willvincent
Since applying this change, data in the longview console is updating pretty much live for the first time ever.
Investigating high disk usage on a box that's been running for a few years. 17GB of this error message. Ugh.
******@******:~$ ls -la /var/log/linode/
total 16521152
drwxr-xr-x 2 root root 4096 Oct 26 2016 .
drwxrwxr-x 13 root syslog 4096 Apr 5 06:25 ..
-rw-r--r-- 1 root root 16917621837 Apr 5 21:20 longview.log