Skip to content

Commit

Permalink
Fix process check on older unix kernels
Browse files Browse the repository at this point in the history
Fix #849
  • Loading branch information
remh committed Mar 6, 2014
1 parent 2dc1032 commit d54ef7e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions checks.d/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ def get_process_metrics(self, pids, psutil, cpu_check_interval):
if extended_metrics_0_6_0:
mem = p.get_ext_memory_info()
real += mem.rss - mem.shared
ctx_switches = p.get_num_ctx_switches()
voluntary_ctx_switches += ctx_switches.voluntary
involuntary_ctx_switches += ctx_switches.involuntary
try:
ctx_switches = p.get_num_ctx_switches()
voluntary_ctx_switches += ctx_switches.voluntary
involuntary_ctx_switches += ctx_switches.involuntary
except NotImplementedError:
# Handle old Kernels which don't provide this info.
voluntary_ctx_switches = None
involuntary_ctx_switches = None
else:
mem = p.get_memory_info()

Expand Down Expand Up @@ -189,4 +194,3 @@ def check(self, instance):
for metric, value in metrics.iteritems():
if value is not None:
self.gauge(metric, value, tags=tags)

0 comments on commit d54ef7e

Please sign in to comment.