Skip to content

Commit

Permalink
Merge pull request #208 from navidys/enhance_metrics
Browse files Browse the repository at this point in the history
new cli option to optionally enhance all metrics with the same fields as for podman_<...>_info metric
  • Loading branch information
navidys authored Mar 16, 2024
2 parents 2d9094b + a8c9a0e commit 02d9b61
Show file tree
Hide file tree
Showing 14 changed files with 606 additions and 149 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# prometheus-podman-exporter

[![PkgGoDev](https://pkg.go.dev/badge/github.com/containers/prometheus-podman-exporter)](https://pkg.go.dev/github.com/containers/prometheus-podman-exporter)
![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/containers/prometheus-podman-exporter)
[![Go Report](https://img.shields.io/badge/go%20report-A%2B-brightgreen.svg)](https://goreportcard.com/report/github.com/containers/prometheus-podman-exporter)
![Go](https://github.com/containers/prometheus-podman-exporter/workflows/Go/badge.svg)

Expand All @@ -24,8 +25,9 @@ Usage:
prometheus-podman-exporter [flags]

Flags:
-t, --collector.cache_duration int Duration (seconds) to retrieve container, size and refresh the cache (default 3600)
-t, --collector.cache_duration int Duration (seconds) to retrieve container, size and refresh the cache. (default 3600)
-a, --collector.enable-all Enable all collectors by default.
--collector.enhance-metrics enhance all metrics with the same field as for their podman_<...>_info metrics.
-i, --collector.image Enable image collector.
-n, --collector.network Enable network collector.
-o, --collector.pod Enable pod collector.
Expand Down
20 changes: 19 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,54 @@ func Execute() {
func init() {
rootCmd.Flags().BoolP("debug", "d", false,
"Set log level to debug.")

rootCmd.Flags().BoolP("version", "", false,
"Print version and exit.")

rootCmd.Flags().StringP("web.config.file", "", "",
"[EXPERIMENTAL] Path to configuration file that can enable TLS or authentication.")

rootCmd.Flags().StringP("web.listen-address", "l", ":9882",
"Address on which to expose metrics and web interface.")

rootCmd.Flags().StringP("web.telemetry-path", "p", "/metrics",
"Path under which to expose metrics.")

rootCmd.Flags().BoolP("web.disable-exporter-metrics", "e", false,
"Exclude metrics about the exporter itself (promhttp_*, process_*, go_*).")

rootCmd.Flags().IntP("web.max-requests", "m", maxRequest,
"Maximum number of parallel scrape requests. Use 0 to disable")

rootCmd.Flags().BoolP("collector.enable-all", "a", false,
"Enable all collectors by default.")

rootCmd.Flags().BoolP("collector.image", "i", false,
"Enable image collector.")

rootCmd.Flags().BoolP("collector.pod", "o", false,
"Enable pod collector.")

rootCmd.Flags().BoolP("collector.volume", "v", false,
"Enable volume collector.")

rootCmd.Flags().BoolP("collector.network", "n", false,
"Enable network collector.")

rootCmd.Flags().BoolP("collector.system", "s", false,
"Enable system collector.")

rootCmd.Flags().BoolP("collector.store_labels", "b", false,
"Convert pod/container/image labels on prometheus metrics for each pod/container/image.")

rootCmd.Flags().StringP("collector.whitelisted_labels", "w", "",
"Comma separated list of pod/container/image labels to be converted\n"+
"to labels on prometheus metrics for each pod/container/image.\n"+
"collector.store_labels must be set to false for this to take effect.")

rootCmd.Flags().Int64P("collector.cache_duration", "t", cacheDuration,
"Duration (seconds) to retrieve container, size and refresh the cache")
"Duration (seconds) to retrieve container, size and refresh the cache.")

rootCmd.Flags().BoolP("collector.enhance-metrics", "", false,
"enhance all metrics with the same field as for their podman_<...>_info metrics.")
}
Loading

0 comments on commit 02d9b61

Please sign in to comment.