Skip to content

Repository files navigation

LiteMon

A very minimal and lightweight metric collector for Linux systems.

Build Statusdependency statusGitHub License

LiteMon allows lightweight monitoring of Linux nodes (VM, bare-metal, etc.). LiteMon is carefully crafted to use as little resources as possible.

LiteMon is using less than 5 MiB of RAM (99th percentile), the binary size is less than 10 MB, and uses very little I/O and CPU. Binaries are built with the musl libc and have no external dependencies.

LiteMon is written in Rust, and uses the Smol async runtime.

Installation

Latest version:

0.2.4

Ubuntu/Debian

# Install litemon
sudo dpkg -i $(curl -w "%{filename_effective}" -SsLO "https://github.com/RagnarLab/litemon/releases/download/v0.2.4/litemon-0.2.4-1.$(uname -m).deb")# Configure litemon
sudo mv /etc/litemon/config.kdl.example /etc/litemon/config.kdl
sudo $EDITOR /etc/litemon/config.kdl
# Restart litemon
sudo systemctl restart litemon

RHEL/Fedora/CentOS Stream

# Install litemon
sudo rpm -iv "https://github.com/RagnarLab/litemon/releases/download/v0.2.4/litemon-0.2.4-1.$(uname -m).rpm"# Configure litemon
sudo mv /etc/litemon/config.kdl.example /etc/litemon/config.kdl
sudo $EDITOR /etc/litemon/config.kdl
# Restart litemon
sudo systemctl restart litemon

Configuration

By default, litemon reads the configuration from /etc/litemon/config.kdl. The configuration is written in KDL.

metrics {
 cpu_secondsenabled=#trueperiod_ms=200 loadavgenabled=#true memory_usedenabled=#true systemd_unit_stateenabled=#true {
// List all the units to monitor. units"docker.service"
}
 network_throughputenabled=#true {
// List all interfaces to monitor interfaces \
"eth0" \
"lo"
}
 disk_usageenabled=#true {
 mountpoints"/"
}
}

CLI

Usage: litemon [OPTIONS] [PATH-TO-CONFIG]
Options:
-n, --listen IP address to listen. Default: 127.0.0.1
-P, --port Port to listen. Default: 9774
-V, --version Print version info and exit
-h, --help Print help and exit

Using with alloy

You can easily use litemon with Grafana Alloy.

// config.alloy
// https://grafana.com/docs/alloy/latest/reference/components/discovery/discovery.relabel/
discovery.relabel "integrations_litemon_exporter" {
targets = [
// Optionally, update to your listen address and port.
{"__address__" = "localhost:9774"},
]
rule {
target_label = "instance"
replacement = constants.hostname
}
rule {
target_label = "job"
replacement = "integrations/litemon"
}
}
// https://grafana.com/docs/alloy/latest/reference/components/prometheus/prometheus.scrape/
prometheus.scrape "litemon_exporter" {
job_name = "integrations/litemon"
targets = discovery.relabel.integrations_litemon_exporter.output
scheme = "http"
scrape_interval = "60s"
metrics_path = "/metrics"
// Update endpoint to your prometheus ingest.
forward_to = [prometheus.remote_write.EXAMPLE.receiver]
}

Metrics

Metric NameMetric TypeDescriptionCardinality
litemon_node_infoGaugeSystem information1 per host
litemon_node_uptimeGaugeUptime in seconds1 per host
litemon_load_avg_1mGaugeLoad average over 1 minute.1 per host
litemon_load_avg_5mGaugeLoad average over 5 minutes.1 per host
litemon_load_avg_15mGaugeLoad average over 15 minutes.1 per host
litemon_cpu_usage_overallGaugeOverall CPU usage percentage (0.0-1.0).1 per host
litemon_cpu_usage_per_coreGaugePer-core CPU usage percentage (0.0-1.0).1 per cpu core
litemon_mem_used_percentageGaugeMemory used (0.0-1.0) in percent.1 per host
litemon_systemd_unit_stateGaugeSystemd unit state (1 for current state, 0 otherwise).1 per service, 1 per state, 8 states
litemon_net_bytes_receivedCounterNetwork bytes received.1 per host, 1 per network interface
litemon_net_errors_receivedCounterNetwork errors received (packets)1 per host, 1 per network interface
litemon_net_bytes_sentCounterNetwork bytes sent.1 per host, 1 per network interface
litemon_net_errors_sentCounterNetwork errors sent (packets)1 per host, 1 per network interface
litemon_fs_usage_ratioGaugeFilesystem usage ratio (0.0-1.0).1 per mount point
litemon_memory_pressure_totalGaugeMemory pressure stall information (PSI) in microseconds.1 per host
litemon_cpu_pressure_totalGaugeCPU pressure stall information (PSI) in microseconds.1 per host
litemon_io_pressure_totalGaugeI/O pressure stall information (PSI) in microseconds.1 per host
litemon_disk_bytes_read_totalGaugeNumber of bytes read from disk since boot.1 per mount point
litemon_disk_bytes_written_totalGaugeNumber of bytes written to disk since boot.1 per mount point

Support

Development of LiteMon is sponsored by RagnarLab. RagnarLab is a Rust consultancy based in Stuttgart, Germany. We provide Rust development from prototype to product, helping you write safer software. Interested in Rust? Get in touch with us.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

About

A very minimal and lightweight metric collector for Linux systems

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages