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-20230913.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

oom_messages_exporter-20230913-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for oom_messages_exporter-20230913.tar.gz
Algorithm Hash digest
SHA256 b7c92818c79abdbea02045501799d36607b57f1b7e87774a1238458380a7d957
MD5 a63d4ff5718ef4d6b7b28824fdb5f449
BLAKE2b-256 279f131bf403584db0b9832734884a24490c83a48426beb9c61dc830eed591fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oom_messages_exporter-20230913-py3-none-any.whl
Algorithm Hash digest
SHA256 cf3291f0089c83994495955ce2b54b997f75302a66fc3be143f41e7456986429
MD5 cc6b20cd041336c31588e3296e4ef9b2
BLAKE2b-256 a56f4a7b16a141991abd18597a9af783000d53104fbe0ddd0797e79079f4fec7

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