Collect OOM Killer messages from /var/log/messages and represent the data in Prometheus.
Project description
OOM Messages Exporter
An exporter for providing OOM Killer in the Prometheus format. The exporter is compatible with containers runtimes and could be useful to investigate OOM Killer activity inside containers, servers or vms.
Example data
The main metric is 'oom_messages_exporter_kills_total' that provides a counter of OOM kills since the exporter has started.
Providen labels are:
- pid - a pid of a killed process;
- command - a proc title of a killed process;
- namespace (opt, containers runtine only)
- pod (opt, containers runtine only)
- opt (opt, containers runtine only)
OOM in kubernetes contaniers
oom_messages_exporter_kills_total{pid="3967383", command="node /opt/www/p",contanier="nodejs",namespace="lovely-project",pod="awesome-backend"} 1.0
oom_messages_exporter_kills_total{pid="1560850", command="node /opt/www/p",contanier="nodejs",namespace="lovely-project",pod="awesome-backend"} 1.0
OOM in bare metal
For the case labels about contaniers runtine should be as 'None'
oom_messages_exporter_kills_total{command="python3.8",pid="3319125",contanier="None",namespace="None",pod="None"} 1.0
How to run
examples
Collecting OOM Killer messages about processes in an operating system:
# ./examples/exporter-containerd.sh
Collecting OOM Killer messages inside containers:
# ./examples/exporter-systemd.sh
Output:
$ curl -s http://localhost:9001/ | fgrep oom_messages_exporter_kills_total
# HELP oom_messages_exporter_kills_total The count of OOM operations, label "pid" has pid of a killed process, the label "command" is a proctitle of the killed process.
# TYPE oom_messages_exporter_kills_total counter
oom_messages_exporter_kills_total{command="framework",contanier="nodejs",namespace="lovely-project",pid="3967383",pod="awesome-backend"} 1.0
oom_messages_exporter_kills_total{command="framework",contanier="nodejs",namespace="lovely-project",pid="1560850",pod="awesome-backend"} 1.0
oom_messages_exporter_kills_total{command="framework",contanier="nodejs",namespace="lovely-project",pid="3319125",pod="awesome-backend"} 1.0
oom_messages_exporter_kills_total{command="framework",contanier="nodejs",namespace="lovely-project",pid="883095",pod="awesome-backend"} 1.0
oom_messages_exporter_kills_total{command="framework",contanier="nodejs",namespace="lovely-project",pid="3863600",pod="awesome-backend"} 1.0
Production
# pip install oom_messages_exporter
# python3.9 oom_messages_exporter.py
Config
All runtine conguration provides by environment variables:
- oom_messages_exporter_PORT - an exporter port (9001 by default)
- oom_messages_exporter_POLL_INTERVAL - log polling interval (1 (sec) by default)
- oom_messages_exporter_MESSAGES_LOG - a path to log (defult: /var/log/messages)
Dependencies
- python 3.9
- prometheus_client
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file oom_messages_exporter-20230914.tar.gz
.
File metadata
- Download URL: oom_messages_exporter-20230914.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a10545d797c31987abad8382d17c816a6b58984d5526d09cd4c47a7edb8e15 |
|
MD5 | 7c1eff90499bebda006858ba6a02cfcf |
|
BLAKE2b-256 | 4c2ab82fc45c483c8ff5c0b626cc184f620c6c29678d50cf5150268edfbba243 |
File details
Details for the file oom_messages_exporter-20230914-py3-none-any.whl
.
File metadata
- Download URL: oom_messages_exporter-20230914-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb5f5b3c53b44f3fb62d7906937d176568d27bbc06b059445d7f6f1eeb96a9a |
|
MD5 | a90435eea60e02807130e2d4ae3d99c8 |
|
BLAKE2b-256 | 3f8197ff1548659f20bb503dd4a1c9177f6ee7ccb5b24cb5ba0bc4f8e0a8497b |