Linuxfabrik / lib

Python libraries used in various Linuxfabrik projects, including the Monitoring Plugins project.
https://linuxfabrik.ch
The Unlicense
13 stars 7 forks source link

Possibly wrong path of udevadm #83

Open leo-pempera opened 3 months ago

leo-pempera commented 3 months ago

In the disk.py library there is a direct shell call to /sbin/udevadm. I have found on some systems e.g. ubuntu server 20.04 the binary is located at /bin/udevadm, which results in no DEVNAME returned by the udevadm function.

This is the corresponsing snipped from the code: success, result = shell.shell_exec('/sbin/udevadm info --query=property --name={}'.format( device, ))

Would it be possible to first find out the correct path via e.g. which udevadm or call it directly via just udevadm?

In my usecase thr newly released disk-io plugin from the linuxfabrik-monitoring-plugins collection is missing the most important disks due to this bug.

root@XXXXXX:/usr/lib64/nagios/plugins# ./disk-io
No I/O.

Name ! MntPnts ! DvMppr ! RWmax/s ! R1/s ! W1/s ! R5/s ! W5/s ! RW5/s
-----+---------+--------+---------+------+------+------+------+-------
md0  ! /boot   !        ! 10.0MiB ! 0.0B ! 0.0B ! 0.0B ! 0.0B ! 0.0B
root@XXXXXX:/usr/lib64/nagios/plugins# cat /proc/mounts | grep ^/dev
/dev/mapper/ubuntu-root / ext4 rw,relatime,errors=remount-ro 0 0
/dev/mapper/ubuntu-var /var ext4 rw,relatime 0 0
/dev/mapper/ubuntu-home /home ext4 rw,relatime 0 0
/dev/md0 /boot ext4 rw,relatime 0 0