system RAM usage sensor added
diff --git a/sensors/main.py b/sensors/main.py
index 6263a9a..8668518 100644
--- a/sensors/main.py
+++ b/sensors/main.py
@@ -9,6 +9,7 @@
import io_sensors
import net_sensors
import syscpu_sensors
+import sysram_sensors
from utils import SensorInfo
from daemonize import Daemonize
diff --git a/sensors/sysram_sensors.py b/sensors/sysram_sensors.py
new file mode 100644
index 0000000..fa0c409
--- /dev/null
+++ b/sensors/sysram_sensors.py
@@ -0,0 +1,34 @@
+from discover import provides
+from utils import SensorInfo, is_dev_accepted
+
+
+# return this values or setted in allowed
+ram_fields = [
+ 'MemTotal',
+ 'MemFree',
+ 'Buffers',
+ 'Cached',
+ 'SwapCached',
+ 'Dirty',
+ 'Writeback',
+ 'SwapTotal',
+ 'SwapFree'
+]
+
+
+@provides("system-ram")
+def sysram_stat(disallowed_prefixes=None, allowed_prefixes=None):
+ if allowed_prefixes is None:
+ allowed_prefixes = ram_fields
+ results = {}
+ for line in open('/proc/meminfo'):
+ vals = line.split()
+ dev_name = vals[0]
+
+ dev_ok = is_dev_accepted(dev_name,
+ disallowed_prefixes,
+ allowed_prefixes)
+
+ if dev_ok:
+ results[dev_name] = SensorInfo(int(vals[1]), False)
+ return results