Skip to main content

A library/program that gives information about oom scores.

Project description

oom-notifier

Maintenance made-with-python GitHub license GitHub forks GitHub stars GitHub watchers GitHub followers GitHub contributors GitHub issues GitHub issues-closed GitHub pull-requests GitHub pull-requests closed PRs Welcome HitCount

product-library product-notfication product-wall

oom-notifier is a program and a library used to track oom scores for Linux.

Description

oom-notifier gets the oom score of each process by getting the /proc/<PID>/oom_score value. As a program, it tracks the oom scores of each process (by default) every 5 seconds and the threshold is set to 1000. If you want to change these values, refer to the configuration header below.

Getting Started

Dependencies

  • Any Linux-based distribution
  • Python>=3.6
  • pip

Installing

  1. Install oom-notifier using pip.
$ pip install oom-notifier

Usage

As a library:

import oom_notifier

oom = oom_notifier.OOM()

# to get all pids and oom scores of each process, use this:
all_oom_scores = oom.info  # this is a dictionary

# to get the maximum oom score of all processes, use this:
max_oom_score = oom.max  # this is also a dictionary

As a program:

$ oom-notifier  # launches oom-notifier in the background

Configuration

In ~/.config/oom-notifier/config.ini:

[Main]
; this sets the threshold to where oom-notifier will trigger a notification if it passes this value
threshold = <NUMBER_HERE>
; this sets the time where oom-notifier will wait to refresh the oom-scores
wait_time = <NUMBER_HERE>

Help

oom-notifier only displays in the command line

This usually means that the dbus can't contact the notification service (as, internally, dbus-python raises an exception incase of failure). AFAIK, most of the time the reason this happens is because the notification service isn't installed.

In XFCE:

Check if xfce4-notifyd is running in the background.

$ ps cax | grep xfce4-notifyd

if there's no output, it means xfce4-notifyd isn't running and means it isn't started or isn't installed. If it isn't installed, you can install using your distribution's package manager.

License

This project is licensed under the GNU GPLv3 License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oom-notifier-1.0.0.tar.gz (7.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page