clj.orcery

Language, Expression and Design

Wednesday

17

February 2016

oren - os and hardware information

by Chris Zheng,

Having been a big fan of system monitoring, I started looking into alternatives to sigar and found oshi - a JNA-based (native) operating system information library for Java. While it's functionality is much less than sigar, I spent some time experimenting with wrapping the functionity with hara.object. The result is oren:

(require '[oren.core :as oren])
(oren/all)
=>  {:operating-system {:family "Mac OS X",
                        :manufacturer "Apple",
                        :version {:build-number "15D21",
                        :code-name "El Capitan",
                        :version "10.11.3"}}

     :hardware   {:file-stores [{:description "Local Disk",
                                 :name "Macintosh HD (/)",
                                 :total-space 249821663232,
                                 :usable-space 6691004416}],
                  :memory {:available 5489655808,
                           :total 17179869184},
                  :power-sources [{:name "InternalBattery-0",
                                   :remaining-capacity 1.0,
                                   :time-remaining -2.0}],
                  :displays [{:edid [... ]}],
                  :processor {:vendor "GenuineIntel",
                              ...
                              ...
                              :model "70"}}}

Sweet =)

comments powered by Disqus