Skip to main content

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


Download files

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

Source Distribution

oom_messages_exporter-20230914.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

oom_messages_exporter-20230914-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file oom_messages_exporter-20230914.tar.gz.

File metadata

File hashes

Hashes for oom_messages_exporter-20230914.tar.gz
Algorithm Hash digest
SHA256 92a10545d797c31987abad8382d17c816a6b58984d5526d09cd4c47a7edb8e15
MD5 7c1eff90499bebda006858ba6a02cfcf
BLAKE2b-256 4c2ab82fc45c483c8ff5c0b626cc184f620c6c29678d50cf5150268edfbba243

See more details on using hashes here.

File details

Details for the file oom_messages_exporter-20230914-py3-none-any.whl.

File metadata

File hashes

Hashes for oom_messages_exporter-20230914-py3-none-any.whl
Algorithm Hash digest
SHA256 acb5f5b3c53b44f3fb62d7906937d176568d27bbc06b059445d7f6f1eeb96a9a
MD5 a90435eea60e02807130e2d4ae3d99c8
BLAKE2b-256 3f8197ff1548659f20bb503dd4a1c9177f6ee7ccb5b24cb5ba0bc4f8e0a8497b

See more details on using hashes here.

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