Skip to content

Commit

Permalink
Add mem percentage per container
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Praloran authored and lebauce committed Aug 13, 2015
1 parent 42b4de0 commit d383d9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions dockerplugin.db
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ cpu.throttling_data periods:COUNTER:0:U, throttled_periods:COUNTER:0:U, thro
network.usage rx_bytes:COUNTER:0:U, rx_dropped:COUNTER:0:U, rx_errors:COUNTER:0:U, rx_packets:COUNTER:0:U, tx_bytes:COUNTER:0:U, tx_dropped:COUNTER:0:U, tx_errors:COUNTER:0:U, tx_packets:COUNTER:0:U
memory.usage limit:GAUGE:0:U, max:GAUGE:0:U, total:GAUGE:0:U
memory.stats value:GAUGE:0:U
memory.percent value:GAUGE:0:150
cpu.percent value:GAUGE:0:150
3 changes: 3 additions & 0 deletions dockerplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def read(cls, container, stats, t):
cls.emit(container, 'memory.stats', [value],
type_instance=key, t=t)

mem_percent = 100.0 * mem_stats['usage'] / mem_stats['limit']
cls.emit(container, 'memory.percent', ["%.2f" % mem_percent], t=t)


class ContainerStats(threading.Thread):
"""
Expand Down

0 comments on commit d383d9d

Please sign in to comment.