• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    C
  • License
    MIT License
  • Created over 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Alert when your machine is becoming oversaturated, *before* it slows to a crawl

psi-notify | Tests CodeQL

tl;dr: psi-notify can alert you when resources on your machine are becoming oversaturated, and allow you to take action before your system slows to a crawl.

psi-notify is a minimal unprivileged notifier for system-wide resource pressure using PSI. This can help you to identify misbehaving applications on your machine before they start to severely impact system responsiveness, in a way which MemAvailable, CPU graphs, I/O utilisation graphs and other metrics cannot.

Features

Requirements

  • Linux 4.20+ with CONFIG_PSI (enabled by default in most distributions)
  • libnotify

Installation

On Arch, the psi-notify AUR package is available.

On Debian (bookworm and sid), the psi-notify package is available.

On Fedora and RHEL/CentOS 8, the psi-notify package is available in Fedora/EPEL.

On Ubuntu, the psi-notify package is in kinetic. For older releases, please use the psi-notify PPA .

You can also find packages in Repology .

Otherwise, manual installation is as simple as running make and putting the resulting psi-notify binary in your PATH. You will need libnotify installed.

After that, you just start psi-notify. A systemd user service is packaged and can be used like so:

systemctl --user start psi-notify

Config

Put your configuration in ~/.config/psi-notify. Here's an example that will check roughly every 5 seconds⁺, and pop up a notification when the values are exceeded:

update 5
log_pressures false

threshold cpu some avg10 50.00
threshold memory some avg10 10.00
threshold io full avg10 15.00

The above is the default configuration if no config file exists. You may have to tweak these depending on your hardware, machine behaviour, and normal workloads.

You can reload the config without restarting by sending SIGHUP to psi-notify.

Look at the "config format" section below to find out more about what a valid config looks like.

⁺ PSI has poll() support, but it's not currently available to unprivileged users. See this discussion.

Comparison with oomd

oomd and psi-notify are two compatible and complementary projects -- they're not in opposition to each other. oomd also uses PSI metrics, but it requires a policy about "what to kill" in high-pressure scenarios. For example, on a web server we obviously don't want to kill the web server if we can avoid that, so we should prioritise other applications. On the desktop though, it's hard to say: should we kill Chrome, or some IDE, or maybe something playing a movie? It's extremely difficult (although perhaps possible) to produce a single configuration that will do the right thing in even the majority of cases, so we opt to alert early instead and have the user make the decision about what's high priority in their user session. When integrating oomd for the desktop, most distributions will likely end up having to make it less aggressive than would be ideal, so they can still interoperate.

It's hard to produce a good policy for, say, one's working day, where at one time my terminal is the most critical thing, at another my browser is, and at another it's my mail client. At other times maybe I'm ok with the slowdown and am willing to ride it out without killing anything. psi-notify sidesteps this problem by simply notifying, rather than taking action.

Config format

update

The update interval in seconds is specified with update [int]. The default is update 5 if unspecified.

log_pressures

If you'd like messages like this at every update interval, you can set log_pressures true (the default is false):

INFO: Current CPU pressures: some avg10=0.00 avg60=0.02 avg300=0.01
INFO: Current memory pressures: some avg10=0.00 avg60=0.00 avg300=0.00
INFO: Current memory pressures: full avg10=0.00 avg60=0.00 avg300=0.00
INFO: Current I/O pressures: some avg10=0.00 avg60=0.00 avg300=0.00
INFO: Current I/O pressures: full avg10=0.00 avg60=0.00 avg300=0.00

threshold

Thresholds are specified with fields in the following format:

  1. The word threshold.
  2. The resource name, as shown in cgroup.controllers. cpu, memory, and io are currently supported.
  3. Whether to use the some or full metric. See the definition here.
  4. The PSI time period. avg10, avg60, and avg300 are currently supported.
  5. The threshold, as a real number between 0 and 100. Decimals are ok.

Contributing

Issues and pull requests are welcome! Please feel free to file them on GitHub.

More Repositories

1

clipmenu

Clipboard management using dmenu
C
1,060
star
2

srt

A simple library and set of tools for parsing, modifying, and composing SRT files.
Python
430
star
3

yturl

YouTube videos on the command line
Python
223
star
4

clipnotify

Notify on new X clipboard events
C
216
star
5

sshrc

Bring your .bashrc, .vimrc, etc. with you when you ssh
Shell
198
star
6

tzupdate

Set the system timezone based on IP geolocation.
Rust
183
star
7

zcfan

A zero-configuration fan daemon for ThinkPads.
C
74
star
8

ansible-desktop

Ansible playbook for my personal machines.
Shell
70
star
9

dwm

Dynamic window manager for X (with extensive customisation)
C
53
star
10

passmenu

dmenu interface to the pass password manager
43
star
11

mack

An opinionated, fast music organiser.
Rust
36
star
12

dotfiles

My configuration files
Shell
28
star
13

gh-mirror

Mirror all GitHub repositories for a user, maintaining metadata.
Python
26
star
14

mpdmenu

dmenu frontend to MPD.
Shell
25
star
15

openvz-to-lxc

Script to migrate OpenVZ containers to LXC.
Shell
23
star
16

ansible-aur

An Ansible module for the pacaur and yaourt package managers.
Python
22
star
17

nota

Simple note taking using your $EDITOR and git
Shell
22
star
18

aur

Arch User Repository API interface.
Python
21
star
19

mac-cel

Remove mouse acceleration on Mac OSX
C
21
star
20

btmenu

Control bluetooth devices with dmenu
Shell
18
star
21

cellout

Battery status in the console (Linux only).
Awk
16
star
22

xinput-toggle

A simple xinput toggler for X11 systems
Shell
15
star
23

travis-automerge

A script to automerge successful builds to a branch
Shell
15
star
24

rebuild-debian-iso

Rebuild a Debian ISO with preseed/custom files.
Shell
10
star
25

osmo

Digital signage for minimalists.
JavaScript
8
star
26

geoip-http

GeoIP lookup server over HTTP.
Rust
7
star
27

exifrename

Rename image files based on EXIF data.
Rust
7
star
28

chrisdown.name

The files behind chrisdown.name.
CSS
6
star
29

mkdirmutex

A deadlock-resistant mkdir based mutex
Shell
6
star
30

pinyin

A small library to manipulate Hanyu Pinyin.
Python
5
star
31

gmute

Gmail mute support for mutt and other email clients
Python
5
star
32

battery-notify

A simple battery notifier for Linux.
Rust
4
star
33

stopthread

A small program to stop individual threads from executing, instead of the whole thread group.
C
4
star
34

icopng

Directly embed PNGs into ICO files without reencoding.
Rust
3
star
35

rtorrent-cookbook

Chef cookbook to set up an rtorrent service inside tmux.
Ruby
3
star
36

habitual

Send notifications for things on a fixed, repeated schedule
Python
3
star
37

pkgbuilds

AUR packages
Shell
3
star
38

kernel-misc

Tools and other things from kernel development
Shell
3
star
39

komootgpx

Extract a GPX from any Komoot route
Rust
3
star
40

bats

Simple battery status tool
Shell
2
star
41

arch-install

A base install script for Arch Linux (base only, the rest is done by Ansible).
Shell
2
star
42

rym-export

Python
2
star
43

multidate

Print multiple timezones' dates/times with offsets from the local time.
Rust
2
star
44

filestruct

Derive macro to read from a directory into a Rust struct.
Rust
2
star
45

cargo-which-nightly

Find the latest Rust nightly with combinations of features present.
Rust
2
star
46

linux

upstream, with my dev branches
C
1
star
47

torrentdiff

Compare files encapsulated by torrents in a directory to the actual files on disk
Python
1
star
48

ahk_scripts

AutoHotkey scripts to make Windows life more tolerable
AutoHotkey
1
star
49

whensthebus

Get live UK bus times on stdout
Python
1
star
50

todobg

Todo list on X root window
Shell
1
star
51

seedbox-cookbook

Chef cookbook to create a minimal seedbox
Ruby
1
star
52

funcfmt

A simple templating crate that allows passing in custom data to functions through function traits.
Rust
1
star
53

checkupdates-cron

A tiny wrapper around the Arch checkupdates script for use in a cronjob.
Shell
1
star
54

jingui

A simple password manager designed to adhere to the Unix philosophy.
Python
1
star
55

prompter

Simple and/or dumb work prompter
Shell
1
star
56

imurl

Downloads the images from imgur albums.
Python
1
star
57

toggledesktop

Isolate windowed games without showing the desktop
AutoHotkey
1
star
58

rawtojpg

Fast JPEG extractor from RAW files
Rust
1
star