frdbonif / sys2mqtt

Publish system statistics to an MQTT broker.
GNU General Public License v3.0
0 stars 0 forks source link

Complete - requires testing - Enable distro and version check #14

Closed frdbonif closed 4 years ago

frdbonif commented 4 years ago

Using distro module.

frdbonif commented 4 years ago

psuedo import distro

linux_distribution()

('Ubuntu', '18.04', 'bionic')

frdbonif commented 4 years ago

Only for Linux, explore alternative options for Windows - I believe that this option supports FreeBSD but will need testing. If so, a simple os module check to identify posix or nt will work to decide whether to run distro or some other windows specific version.

frdbonif commented 4 years ago

distro.linux_distribution() output =

FreeBSD 12.1 = ('FreeBSD', '12.1', '') Ubuntu 18.04 = ('Ubuntu', '18.04', 'bionic') Debian 10 = ('Debian GNU/Linux', '10', 'buster') -- distro.linux_distribution(full_distribution_name=False) = ('debian', '10', 'buster') CentOS 8 = ('CentOS Linux', '8', 'Core') -- distro.linux_distribution(full_distribution_name=False) = ('centos, '8', 'Core') Sangoma Linux 7.6 = ('Sangoma Linux', '7', 'Core')

Windows 10 = ('', '', '')

frdbonif commented 4 years ago

os.name

Windows = 'nt' Linux/BSD = 'posix' JVM = 'java'

frdbonif commented 4 years ago

platform.uname()

Windows 10 = (system='Windows', node='HOSTNAME', release='10', version='10.0.19041', machine='AMD64', processor='proc details')

Less useful for windows so consider: PSUEDO

if os.name = posix then do distro check elif do platform.uname check else set var to unknown.

frdbonif commented 4 years ago

Done, needs testing on all platforms before closing.

frdbonif commented 4 years ago

Tested on Ubuntu 20.04, suffucient to close issue and test together with other features.