Hello all,

Is anyone aware of a shell script (e.g. bash or sh) that returns
system information as a JSON structure?

I need to survey a few dozen systems, collecting various bits of info
such as serial number, CPU, RAM, disk size and layout, etc.  On
systems where I can install software, I usually use ohai, which
outputs system information in JSON, which is very easy to parse or
query.  Unfortunately, on these particular systems I can only look.
So, no installing of software.

As a sample of what I am looking for, here's a bash function version
that outputs most of the same JSON as does ohai for the dmi portion:

system.json.dmidecode () {
cat <<eof
{
  version: "$(dmidecode --version)",
  bios: {
    version: "$(dmidecode --string bios-version | xargs)",
    release_date: "$(dmidecode --string bios-release-date)",
    vendor: "$(dmidecode --string bios-vendor)"
  },
  system: {
    manufacturer: "$(dmidecode --string system-manufacturer)",
    serial_number: "$(dmidecode --string system-serial-number)",
  },
}
eof
}

Thanks in advance for any pointers.

Regards,
- Robert

-- 
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug

Reply via email to