Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukeshirnia/oom-killer-score
Python and bash scripts to analyze all system process oom_scores and sort by the highest value (most likely to get killed)
https://github.com/lukeshirnia/oom-killer-score
bash linux oom out-of-memory python
Last synced: 2 months ago
JSON representation
Python and bash scripts to analyze all system process oom_scores and sort by the highest value (most likely to get killed)
- Host: GitHub
- URL: https://github.com/lukeshirnia/oom-killer-score
- Owner: LukeShirnia
- Created: 2016-04-26T19:42:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-14T14:38:00.000Z (almost 2 years ago)
- Last Synced: 2024-02-14T21:25:25.134Z (12 months ago)
- Topics: bash, linux, oom, out-of-memory, python
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OOM-Killer
Here are 2 scripts designed to asses the systems processes and their oom_score.
The oom score will dictate which process is most likely to be killed next by the kernel when oom-killer is invoked (due to low memory (ram))
Safest way to run the script:
`git clone https://github.com/LukeShirnia/OOM-Killer-score.git`
`cd OOM-Killer-score`
`python score_check.py`To run script:
Note: the python script runs faster than the bash script.
`curl -s https://raw.githubusercontent.com/LukeShirnia/OOM-Killer-score/master/score_check.sh | bash`
`curl -s https://raw.githubusercontent.com/LukeShirnia/OOM-Killer-score/master/score_check.py | python`Or you can use the following bash one-liner (but again, python is quicker):
`for i in $(find /proc -maxdepth 1 -type d); do if [ -f "$i"/oom_score ]; then printf "$(cat "$i"/oom_score) "; pid=$(echo "$i" | awk -F'/' '{print $3}';); if [ "$(cat "$i"/oom_score)" -ge 1 ];then printf "$(ps -p "$pid" -o comm=) "; fi; printf "$i/oom_score \n"; fi; done | awk '$1 > 1' | sort -nr -k1 `
## Example output:
```
121 mysqld /proc/24828/oom_score
103 rackspace-monit /proc/15168/oom_score
94 varnishd /proc/13528/oom_score
84 varnishd /proc/13527/oom_score
45 php-fpm /proc/25685/oom_score
44 php-fpm /proc/25686/oom_score
42 php-fpm /proc/6820/oom_score
42 php-fpm /proc/25687/oom_score
41 php-fpm /proc/25684/oom_score
40 php-fpm /proc/25683/oom_score
39 php-fpm /proc/26555/oom_score
36 php-fpm /proc/2879/oom_score
36 php-fpm /proc/2868/oom_score
19 php-fpm /proc/25681/oom_score
17 firewalld /proc/529/oom_score
16 driveclient /proc/21200/oom_score
13 python /proc/10338/oom_score
10 tuned /proc/871/oom_score
9 polkitd /proc/4899/oom_score
8 fail2ban-server /proc/13549/oom_score
6 php-fpm /proc/25692/oom_score
6 php-fpm /proc/25691/oom_score
6 php-fpm /proc/25690/oom_score
6 php-fpm /proc/25689/oom_score
6 php-fpm /proc/25688/oom_score
```