psi-notify - Alert when your machine is becoming oversaturated

栏目: IT技术 · 发布时间: 3年前

内容简介:tl;dr: psi-notify can alert you when resources on your machine are becoming oversaturated, and allow you to take actionpsi-notify is a minimal unprivileged notifier for system-wide resource pressure usingThis can help you to identify misbehaving applicatio

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 or other metrics cannot.

Demo

psi-notify - Alert when your machine is becoming oversaturated

Features

  • Runs unprivileged
  • Low resource usage:
    • Anonymous memory usage typically less than 40kB
    • Almost zero CPU usage
  • Works with any notifier using Desktop Notifications
  • Active notification management: when thresholds clear, the notification automatically closes
  • (Optional) sd_notify support for Type=notify . Compile with WANT_SD_NOTIFY=0 if you'd prefer not to have it.
  • Reload configs without restarting using SIGHUP

Requirements

CONFIG_PSI

Installation

Manual installation is as simple as running make and putting the resulting psi-notify binary in your PATH. Make sure you have libnotify installed.

If you don't want sd_notify support even though you have libsystemd available, compile with make WANT_SD_NOTIFY=0 .

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

After that, you just start psi-notify. A systemd user service is packaged -- if you want to use that, you can run the following:

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

threshold cpu some avg10 50.00
threshold memory some avg10 10.00
threshold io some avg10 10.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.

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

Config format

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

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.

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.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

新媒体文案创作与传播

新媒体文案创作与传播

秋叶、叶小鱼、勾俊伟 / 人民邮电出版社 / 2017-4 / 39.80元

《新媒体文案创作与传播》共分三篇。第1篇是新媒体文案基础篇,主要讲述了新媒体文案的基本概念、新媒体文案的岗位要求和职业能力素养;第二篇是新媒体文案创意实务篇,主要讲述了新媒体文案的创作思路、新媒体文案的写作技巧、爆款新媒体文案的打造、新媒体销售文案的写作、新媒体对文案传播的新要求、新媒体品-牌文案的写作,以及不同媒介的特征及发布形式;第三篇为新媒体文案相关技能补充,主要讲述的是策划能力。 《新媒体......一起来看看 《新媒体文案创作与传播》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器