Commit e30db96d authored by Stratos Psomadakis's avatar Stratos Psomadakis
Browse files

collectd: Read only the first line of the pid file

Since qemu doesn't truncate the pid file when it opens / creates it,
there's a chance that the pid file will contain more than one lines,
with truncated older PIDs. Read only the first line of the pid file, to
avoid an exception in the cpustats collectd plugin.
parent a4651d7c
......@@ -20,7 +20,7 @@ def cpustats(data=None):
for file in glob("/var/run/ganeti/kvm-hypervisor/pid/*"):
instance = os.path.basename(file)
pid = int(open(file, "r").read())
pid = int(open(file, "r").readline())
proc = open("/proc/%d/stat" % pid, "r")
cputime = [int(proc.readline().split()[42])]
except EnvironmentError:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment