Python utilities to prevent over usage of resources by cluster users
You need to create a cgroup that sets the CPU time limit for user processes. You can use the cpuacct controller to monitor and the cpu controller to limit the CPU usage.
sudo cgcreate -g cpu,cpuacct:/limited
sudo cgset -r cpu.cfs_period_us=100000 limited # 100ms
sudo cgset -r cpu.cfs_quota_us=50000 limited # 50ms of CPU time on all cores per 100ms
- Install auditd if it is not yet installed
sudo apt-get update sudo apt-get install auditd
- Configure auditd to monitor the
execve
system call, which is used whenever a new process is started:sudo auditctl -a always,exit -F arch=b64 -S execve -k process-monitor
The -k option adds a key to the rule that you can use to search the audit logs for relevant entries.
Step 3: Install and Configure cluster-police
- Copy the cluster-police.service file to /etc/systemd/system/
- Run the following commands:
systemctl daemon-reload
systemctl enable cluster-police.service
systemctl start cluster-police.service
- To check the status of the service, run:
systemctl status cluster-police.service