bb-Ricardo / check_redfish

A monitoring/inventory plugin to check components and health status of systems which support Redfish. It will also create a inventory of all components of a system.
MIT License
110 stars 30 forks source link

Get hostname in a cross-platform way #117

Closed pv2b closed 12 months ago

pv2b commented 12 months ago

os.uname()[1] only works on Unix-like operating systems (and also truncates the hostname to 8 characters on some systems), socket.gethostname() gets the same data in a better cross-platform way.

In my case this was the only thing I needed to change to get this running on Windows (to collect inventory data)

Reference: https://docs.python.org/3/library/os.html#os.uname

bb-Ricardo commented 12 months ago

Hi,

Very good point. I haven't tested it on windows but if it works for you and it's the recommended way to query the hostname anyway, then I see no harm.

Will merge as soon.