Added automatic restart to puppet-check if puppet memory consumption is over 256MB.
This commit is contained in:
parent
2addfac215
commit
3df7bf7cd5
1 changed files with 9 additions and 0 deletions
|
@ -24,6 +24,15 @@ end
|
|||
# check that process is still alive
|
||||
begin
|
||||
Process.kill(0, pid)
|
||||
|
||||
# check memory usage and restart if over 256M
|
||||
rss = `ps -o rss= -p '#{pid}'`.to_i / 1024
|
||||
if rss > 256
|
||||
printf("puppetd memory usage too high (%d MB), on host '%s' sending HUP\n",
|
||||
rss, Socket.gethostname)
|
||||
Process.kill("HUP", pid)
|
||||
end
|
||||
|
||||
exit
|
||||
rescue Errno::ESRCH
|
||||
nil
|
||||
|
|
Loading…
Add table
Reference in a new issue