what is the best way to determine system OS?

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Tue Apr 26 04:35:01 EDT 2005


googleboy wrote:

> What this script does is use take the output of vmstat to report idle
> cpu cycles (or memory stuff, etc.) over a period specified by a
> parameter,  all the better to be a plugin for a monitoring service.
> 
> Basically it parses the output of the command,  runs through a whole
> bunch of regex to discard everything not required and then reports the
> info.  Everything I had checked out that responded "Linux" to a uname
> command had identical output for vmstat until FC3.   FC3 seems to use
> similar output to BSD.   I wrote a simple if-then loop to try to
> determine which regex function to use, but it obivously isn't working
> under fc3.

In that case, it seems to be a better idea to check the version of 
vmstat that's on the system. At least, I presume that such differences 
in behaviour can be deduced from the vmstat version string.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven



More information about the Python-list mailing list