Browse code

Add "OOM killed" event based on OOM state information

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)

Phil Estes authored on 2014/11/20 04:50:16
Showing 3 changed files
... ...
@@ -154,6 +154,9 @@ func (m *containerMonitor) Start() error {
154 154
 
155 155
 		if m.shouldRestart(exitStatus.ExitCode) {
156 156
 			m.container.SetRestarting(&exitStatus)
157
+			if exitStatus.OOMKilled {
158
+				m.container.LogEvent("oom")
159
+			}
157 160
 			m.container.LogEvent("die")
158 161
 			m.resetContainer(true)
159 162
 
... ...
@@ -170,6 +173,9 @@ func (m *containerMonitor) Start() error {
170 170
 			continue
171 171
 		}
172 172
 		m.container.ExitCode = exitStatus.ExitCode
173
+		if exitStatus.OOMKilled {
174
+			m.container.LogEvent("oom")
175
+		}
173 176
 		m.container.LogEvent("die")
174 177
 		m.resetContainer(true)
175 178
 		return err
... ...
@@ -1375,7 +1375,7 @@ polling (using since).
1375 1375
 
1376 1376
 Docker containers will report the following events:
1377 1377
 
1378
-    create, destroy, die, export, kill, pause, restart, start, stop, unpause
1378
+    create, destroy, die, export, kill, oom, pause, restart, start, stop, unpause
1379 1379
 
1380 1380
 and Docker images will report:
1381 1381
 
... ...
@@ -761,7 +761,7 @@ For example:
761 761
 
762 762
 Docker containers will report the following events:
763 763
 
764
-    create, destroy, die, export, kill, pause, restart, start, stop, unpause
764
+    create, destroy, die, export, kill, oom, pause, restart, start, stop, unpause
765 765
 
766 766
 and Docker images will report:
767 767