cAdvisor w/ Prometheus API
Connector dependenciesβ
The following monitoring connectors will be installed when you install the cAdvisor w/ Prometheus API connector through the Configuration > Connectors > Monitoring Connectors menu:
Pack assetsβ
Templatesβ
The Monitoring Connector cAdvisor w/ Prometheus API brings 4 host templates:
- Cloud-Prometheus-cAdvisor-Api-custom: monitors, from a single host, all containers that match each service's filters.
- Cloud-Prometheus-cAdvisor-Api-Container-custom: monitors one container running outside Kubernetes (Docker, Podman).
- Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom: monitors one container of a Kubernetes pod.
- Cloud-Prometheus-cAdvisor-Api-Pod-custom: monitors one Kubernetes pod as a whole.
The last three host templates check that their pod or container is present in the cAdvisor metrics, and are designed to be applied by host discovery.
The connector brings the following service templates (sorted by the host template they are attached to):
- Cloud-Prometheus-cAdvisor-Api-custom
- Cloud-Prometheus-cAdvisor-Api-Container-custom
- Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom
- Cloud-Prometheus-cAdvisor-Api-Pod-custom
- Not attached to a host template
| Service Alias | Service Template | Service Description |
|---|---|---|
| Container-Cpu | Cloud-Prometheus-cAdvisor-Cpu-Api-custom | Check container CPU usage |
| Container-Load | Cloud-Prometheus-cAdvisor-Load-Api-custom | Check container load |
| Container-Memory | Cloud-Prometheus-cAdvisor-Memory-Api-custom | Check container memory usage |
| Container-Storage | Cloud-Prometheus-cAdvisor-Storage-Api-custom | Check container storage usage |
| Container-Task-State | Cloud-Prometheus-cAdvisor-Task-State-Api-custom | Check the state of container tasks |
The services listed above are created automatically when the Cloud-Prometheus-cAdvisor-Api-custom host template is used.
| Service Alias | Service Template | Service Description |
|---|---|---|
| Container-Cpu | Cloud-Prometheus-cAdvisor-Container-Cpu-Api-custom | Check container CPU usage |
| Container-Load | Cloud-Prometheus-cAdvisor-Container-Load-Api-custom | Check container load |
| Container-Memory | Cloud-Prometheus-cAdvisor-Container-Memory-Api-custom | Check container memory usage |
| Container-Storage | Cloud-Prometheus-cAdvisor-Container-Storage-Api-custom | Check container storage usage |
| Container-Task-State | Cloud-Prometheus-cAdvisor-Container-Task-State-Api-custom | Check the state of container tasks |
The services listed above are created automatically when the Cloud-Prometheus-cAdvisor-Api-Container-custom host template is used.
| Service Alias | Service Template | Service Description |
|---|---|---|
| Container-Cpu | Cloud-Prometheus-cAdvisor-Container-Cpu-Api-custom | Check container CPU usage |
| Container-Memory | Cloud-Prometheus-cAdvisor-Container-Memory-Api-custom | Check container memory usage |
The services listed above are created automatically when the Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom host template is used.
The load, storage and task state services are not attached to this host template: the cAdvisor built into the kubelet does not export these metrics (see Prerequisites).
| Service Alias | Service Template | Service Description |
|---|---|---|
| Pod-Cpu | Cloud-Prometheus-cAdvisor-Pod-Cpu-Api-custom | Check pod CPU usage |
| Pod-Memory | Cloud-Prometheus-cAdvisor-Pod-Memory-Api-custom | Check pod memory usage |
The services listed above are created automatically when the Cloud-Prometheus-cAdvisor-Api-Pod-custom host template is used.
| Service Alias | Service Template | Service Description |
|---|---|---|
| Pod-Load | Cloud-Prometheus-cAdvisor-Pod-Load-Api-custom | Check pod load |
| Pod-Storage | Cloud-Prometheus-cAdvisor-Pod-Storage-Api-custom | Check pod storage usage |
| Pod-Task-State | Cloud-Prometheus-cAdvisor-Pod-Task-State-Api-custom | Check the state of pod tasks |
The services listed above are not attached to any host template, in particular not to the Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom and Cloud-Prometheus-cAdvisor-Api-Pod-custom host templates: the cAdvisor built into the kubelet does not export these metrics (see Prerequisites). To use them, create a service manually, then apply the service template you want.
Discovery rulesβ
Host discoveryβ
| Rule name | Description |
|---|---|
| Prometheus cAdvisor | Discover pods and containers (Kubernetes or standalone) from cAdvisor metrics stored in Prometheus |
The discovery lists the pods and containers from the container_last_seen metric and applies a host template according to the type of each discovered resource:
| Discovered resource | Host template | Host name |
|---|---|---|
| Kubernetes pod | Cloud-Prometheus-cAdvisor-Api-Pod-custom | namespace_pod |
| Container of a Kubernetes pod | Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom | namespace_pod_container |
| Container running outside Kubernetes | Cloud-Prometheus-cAdvisor-Api-Container-custom | container |
The discovery also fills in the macros of the hosts: the connection to Prometheus, and the CONTAINER_FILTER, POD_FILTER and NAMESPACE_FILTER filters that select the pod or container of each host.
More information about discovering hosts automatically is available on the dedicated page, in particular about scheduling the discovery job to add the hosts of new pods as your Kubernetes cluster evolves.
Collected metrics & statusβ
Here is the list of services for this connector, detailing all metrics and statuses linked to each service.
- Container-Cpu
- Container-Load
- Container-Memory
- Container-Storage
- Container-Task-State
- Pod-Cpu
- Pod-Load
- Pod-Memory
- Pod-Storage
- Pod-Task-State
| Name | Unit |
|---|---|
| pod_container#container.cpu.utilization.percentage | % |
| pod_container#container.cpu.throttled.percentage | % |
Applies to the following service templates: Cloud-Prometheus-cAdvisor-Cpu-Api-custom, Cloud-Prometheus-cAdvisor-Container-Cpu-Api-custom
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod_container#container.load.count | count |
Applies to the following service templates: Cloud-Prometheus-cAdvisor-Load-Api-custom, Cloud-Prometheus-cAdvisor-Container-Load-Api-custom
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod~container#memory.used.bytes | B |
| pod~container#memory.working.bytes | B |
| pod~container#cache.usage.bytes | B |
| pod~container#rss.usage.bytes | B |
| pod~container#swap.usage.bytes | B |
Applies to the following service templates: Cloud-Prometheus-cAdvisor-Memory-Api-custom, Cloud-Prometheus-cAdvisor-Container-Memory-Api-custom
| Name | Unit |
|---|---|
| pod~container~device#storage.space.usage.bytes | B |
| pod~container~device#storage.space.free.bytes | B |
Applies to the following service templates: Cloud-Prometheus-cAdvisor-Storage-Api-custom, Cloud-Prometheus-cAdvisor-Container-Storage-Api-custom
The storage.space.free.bytes metric replaces storage.space.usage.bytes when the
--freeoption is set in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod_container#tasks.sleeping.count | count |
| pod_container#tasks.running.count | count |
| pod_container#tasks.stopped.count | count |
| pod_container#tasks.uninterruptible.count | count |
| pod_container#tasks.iowaiting.count | count |
Applies to the following service templates: Cloud-Prometheus-cAdvisor-Task-State-Api-custom, Cloud-Prometheus-cAdvisor-Container-Task-State-Api-custom
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod#container.cpu.utilization.percentage | % |
| pod#container.cpu.throttled.percentage | % |
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod#container.load.count | count |
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod#memory.used.bytes | B |
| pod#memory.working.bytes | B |
| pod#cache.usage.bytes | B |
| pod#rss.usage.bytes | B |
| pod#swap.usage.bytes | B |
| Name | Unit |
|---|---|
| pod~device#storage.space.usage.bytes | B |
| pod~device#storage.space.free.bytes | B |
The storage.space.free.bytes metric replaces storage.space.usage.bytes when the
--freeoption is set in the EXTRAOPTIONS service macro.
| Name | Unit |
|---|---|
| pod#tasks.sleeping.count | count |
| pod#tasks.running.count | count |
| pod#tasks.stopped.count | count |
| pod#tasks.uninterruptible.count | count |
| pod#tasks.iowaiting.count | count |
To obtain this new metric format, include --use-new-perfdata in the EXTRAOPTIONS service macro.
The metric instance depends on the resource type:
- Container in a pod: pod name + container name (web-1_nginx or web-1~nginx, depending on the service).
- Pod: pod name.
- Container outside Kubernetes: container name (haproxy). The storage metrics also contain the device (for example
web-1~nginx~/dev/vda1).
Prerequisitesβ
Prometheus and cAdvisorβ
The connector queries the API of a Prometheus server that collects the cAdvisor metrics, from one of the following sources:
- the cAdvisor built into the kubelet (Kubernetes): the
/metrics/cadvisorendpoint of each node, usually collected by thekubeletjob of the Prometheus Operator. It exports the CPU and memory metrics of the pods and containers, but not the load (container_cpu_load_average_10s) and the task state (container_tasks_state) metrics, nor the disk usage of thecontainerdcontainers. - A standalone cAdvisor: on a Docker or Podman host, or deployed in Kubernetes as a DaemonSet. It is required to use the load, storage and task state services.
The default filters use the container, pod and namespace labels set by the kubelet since Kubernetes 1.16 (OpenShift 4.3). On older platforms, these labels are named container_name and pod_name: set the filters accordingly, for example --container='container_name!~"|.*POD.*"' --pod='pod_name=~".*"'.
A standalone cAdvisor deployed in Kubernetes does not set these labels. It only sets the container runtime labels (for example container_label_io_kubernetes_pod_name). In that case, either you can either:
- Use these label names in your filters.
- Configure Prometheus to copy them to container, pod and namespace (for example with metric_relabel_configs).
Best practice: naming your containersβ
By default, Docker gives a container a new random name each time it is recreated. Centreon then creates new metrics and a new RRD file in /var/lib/centreon/metrics, building up stale data.
Always assign a fixed name to each monitored container:
# Command line
docker run -d --name my-nginx nginx
# Docker Compose
services:
web:
image: nginx
container_name: my-nginx
If you are using Kubernetes, the pods of a
StatefulSetkeep a stable name (my-service-0,my-service-1, etc.), as do the pods created directly (kind: Pod). Pods of other controllers (β¦) get a new name each time they are recreated. You can configure host discovery to add a host for each new name and delete the old one. However, metrics collected under two different names are not linked or displayed together.
Installing the monitoring connectorβ
Packβ
The installation procedures for monitoring connectors are slightly different depending on whether your license is offline or online.
- If the platform uses an online license, you can skip the package installation instruction below as it is not required to have the connector displayed within the Configuration > Connectors > Monitoring Connectors menu. If the platform uses an offline license, install the package on the central server with the command corresponding to the operating system's package manager:
- Alma / RHEL / Oracle Linux 8
- Alma / RHEL / Oracle Linux 9
- Debian 11 & 12
- CentOS 7
dnf install centreon-pack-cloud-prometheus-cadvisor-api
dnf install centreon-pack-cloud-prometheus-cadvisor-api
apt install centreon-pack-cloud-prometheus-cadvisor-api
yum install centreon-pack-cloud-prometheus-cadvisor-api
- Whatever the license type (online or offline), install the cAdvisor w/ Prometheus API connector through the Configuration > Connectors > Monitoring Connectors menu.
Pluginβ
Since Centreon 22.04, you can benefit from the 'Automatic plugin installation' feature. When this feature is enabled, you can skip the installation part below.
You still have to manually install the plugin on the poller(s) when:
- Automatic plugin installation is turned off
- You want to run a discovery job from a poller that doesn't monitor any resource of this kind yet
More information in the Installing the plugin section.
Use the commands below according to your operating system's package manager:
- Alma / RHEL / Oracle Linux 8
- Alma / RHEL / Oracle Linux 9
- Debian 11 & 12
- CentOS 7
dnf install centreon-plugin-Cloud-Prometheus-cAdvisor-Api
dnf install centreon-plugin-Cloud-Prometheus-cAdvisor-Api
apt install centreon-plugin-cloud-prometheus-cadvisor-api
yum install centreon-plugin-Cloud-Prometheus-cAdvisor-Api
Using the monitoring connectorβ
Using a host template provided by the connectorβ
- Cloud-Prometheus-cAdvisor-Api-custom
- Cloud-Prometheus-cAdvisor-Api-Container-custom
- Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom
- Cloud-Prometheus-cAdvisor-Api-Pod-custom
- Log into Centreon and add a new host through Configuration > Hosts.
- Fill in the Name, Alias & IP Address/DNS fields according to your resource's settings.
- Apply the Cloud-Prometheus-cAdvisor-Api-custom template to the host. A list of macros appears. Macros allow you to define how the connector will connect to the resource, and to customize the connector's behavior.
- Fill in the macros you want. Some macros are mandatory.
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| PROMETHEUSAPIHOSTNAME | Prometheus hostname | X | |
| PROMETHEUSAPIPROTO | Specify https if needed | http | |
| PROMETHEUSAPIPORT | API port | 9090 | |
| PROMETHEUSAPIURL | API URL path | /api/v1 | |
| EXTRAOPTIONS | Any extra option you may want to add to every command (a --verbose flag for example). All options are listed here. |
- Deploy the configuration. The host appears in the list of hosts, and on the Resources Status page. The command that is sent by the connector is displayed in the details panel of the host: it shows the values of the macros.
This host template is designed to be applied by the host discovery, which creates the hosts and fills in all their macros.
To create a host manually:
- Log into Centreon and add a new host through Configuration > Hosts.
- Fill in the Name, Alias & IP Address/DNS fields according to your resource's settings.
- Apply the Cloud-Prometheus-cAdvisor-Api-Container-custom template to the host.
- The host template does not define the macros below: add them in the Host check options section of the host, and fill them in. Some macros are mandatory.
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| PROMETHEUS_API_HOSTNAME | Prometheus hostname | X | |
| PROMETHEUS_API_PROTO | Specify https if needed (http or https) | X | |
| PROMETHEUS_API_PORT | API port (for example: 9090) | X | |
| PROMETHEUS_API_URL | API URL path (for example: /api/v1) | X | |
| CONTAINER_FILTER | PromQL filter on the container (--container option), for example: name="haproxy" | X | |
| POD_FILTER | PromQL filter on the pod (--pod option), for example: pod=~".*" | X | |
| NAMESPACE_FILTER | Additional PromQL filter (--extra-filter option). It can be used to select the Prometheus target of the container when several Docker hosts have a container with the same name, for example: instance="docker-01:8080" | ||
| EXTRAOPTIONS | Any extra option you may want to add to every command (a --verbose flag for example). All options are listed here. |
The host check is CRITICAL (host down) when no pod or container matches the filters. When a container stops, Prometheus keeps returning its last metrics during its lookback delta (5 minutes by default): The host goes down after this.
- Deploy the configuration. The host appears in the list of hosts, and on the Resources Status page. The command that is sent by the connector is displayed in the details panel of the host: it shows the values of the macros.
This host template is designed to be applied by the host discovery, which creates the hosts and fills in all their macros.
To create a host manually:
- Log into Centreon and add a new host through Configuration > Hosts.
- Fill in the Name, Alias & IP Address/DNS fields according to your resource's settings.
- Apply the Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom template to the host.
- The host template does not define the macros below: add them in the Host check options section of the host, and fill them in. Some macros are mandatory.
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| PROMETHEUS_API_HOSTNAME | Prometheus hostname | X | |
| PROMETHEUS_API_PROTO | Specify https if needed (http or https) | X | |
| PROMETHEUS_API_PORT | API port (for example: 9090) | X | |
| PROMETHEUS_API_URL | API URL path (for example: /api/v1) | X | |
| CONTAINER_FILTER | PromQL filter on the container (--container option), for example: container="nginx" | X | |
| POD_FILTER | PromQL filter on the pod (--pod option), for example: pod="web-1" | X | |
| NAMESPACE_FILTER | PromQL filter on the namespace (--extra-filter option), for example: namespace="default" | ||
| EXTRAOPTIONS | Any extra option you may want to add to every command (a --verbose flag for example). All options are listed here. |
The host check is CRITICAL (host down) when no pod or container matches the filters. When a container stops, Prometheus keeps returning its last metrics during its lookback delta (5 minutes by default): The host goes down after this.
- Deploy the configuration. The host appears in the list of hosts, and on the Resources Status page. The command that is sent by the connector is displayed in the details panel of the host: it shows the values of the macros.
This host template is designed to be applied by the host discovery, which creates the hosts and fills in all their macros.
To create a host manually:
- Log into Centreon and add a new host through Configuration > Hosts.
- Fill in the Name, Alias & IP Address/DNS fields according to your resource's settings.
- Apply the Cloud-Prometheus-cAdvisor-Api-Pod-custom template to the host.
- The host template does not define the macros below: add them in the Host check options section of the host, and fill them in. Some macros are mandatory.
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| PROMETHEUS_API_HOSTNAME | Prometheus hostname | X | |
| PROMETHEUS_API_PROTO | Specify https if needed (http or https) | X | |
| PROMETHEUS_API_PORT | API port (for example: 9090) | X | |
| PROMETHEUS_API_URL | API URL path (for example: /api/v1) | X | |
| CONTAINER_FILTER | PromQL filter on the container (--container option), for example: container="" (the pod as a whole) | X | |
| POD_FILTER | PromQL filter on the pod (--pod option), for example: pod="web-1" | X | |
| NAMESPACE_FILTER | PromQL filter on the namespace (--extra-filter option), for example: namespace="default" | ||
| EXTRAOPTIONS | Any extra option you may want to add to every command (a --verbose flag for example). All options are listed here. |
The host check is CRITICAL (host down) when no pod or container matches the filters. When a container stops, Prometheus keeps returning its last metrics during its lookback delta (5 minutes by default): The host goes down after this.
- Deploy the configuration. The host appears in the list of hosts, and on the Resources Status page. The command that is sent by the connector is displayed in the details panel of the host: it shows the values of the macros.
Using a service template provided by the connectorβ
- If you have used a host template and checked Create Services linked to the Template too, the services linked to the template have been created automatically, using the corresponding service templates. Otherwise, manually create the services you want and apply a service template to them.
- Fill in the macros you want (e.g. to change the thresholds for the alerts). Some macros are mandatory (see the table below).
The service templates of the Cloud-Prometheus-cAdvisor-Api-custom host template select the containers with their own CONTAINER and POD macros. The default values of these macros use the label names of Kubernetes 1.15 and older: with Kubernetes 1.16 and newer, use for example
container!~"|.*POD.*"andpod=~".*"(see Prerequisites).
The service templates of the Cloud-Prometheus-cAdvisor-Api-Container-custom, Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom and Cloud-Prometheus-cAdvisor-Api-Pod-custom host templates select their pod or container with the CONTAINER_FILTER, POD_FILTER and NAMESPACE_FILTER macros of their host.
- Container-Cpu
- Container-Load
- Container-Memory
- Container-Storage
- Container-Task-State
- Pod-Cpu
- Pod-Load
- Pod-Memory
- Pod-Storage
- Pod-Task-State
Cloud-Prometheus-cAdvisor-Cpu-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| CONTAINER | Filter on the container (must be a PromQL filter) | container_name!~".POD." | |
| POD | Filter on the pod (must be a PromQL filter) | pod_name=~".*" | |
| WARNINGUSAGE | Warning threshold on the CPU usage (%) | 80 | |
| CRITICALUSAGE | Critical threshold on the CPU usage (%) | 90 | |
| WARNINGTHROTTLED | Warning threshold on the CPU throttling (%) | 10 | |
| CRITICALTHROTTLED | Critical threshold on the CPU throttling (%) | 20 | |
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Container-Cpu-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_USAGE | Warning threshold on the CPU usage (%) | ||
| CRITICAL_USAGE | Critical threshold on the CPU usage (%) | ||
| WARNING_THROTTLED | Warning threshold on the CPU throttling (%) | ||
| CRITICAL_THROTTLED | Critical threshold on the CPU throttling (%) | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
Cloud-Prometheus-cAdvisor-Load-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| CONTAINER | Filter on the container (must be a PromQL filter) | container_name!~".POD." | |
| POD | Filter on the pod (must be a PromQL filter) | pod_name=~".*" | |
| WARNINGLOAD | Warning threshold | ||
| CRITICALLOAD | Critical threshold | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Container-Load-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_LOAD | Warning threshold | ||
| CRITICAL_LOAD | Critical threshold | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
Cloud-Prometheus-cAdvisor-Memory-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| CONTAINER | Filter on the container (must be a PromQL filter) | container_name!~".POD." | |
| POD | Filter on the pod (must be a PromQL filter) | pod_name=~".*" | |
| WARNINGUSAGE | Warning threshold on the memory usage (%) | 80 | |
| CRITICALUSAGE | Critical threshold on the memory usage (%) | 90 | |
| WARNINGWORKING | Warning threshold on the working set memory (%) | ||
| CRITICALWORKING | Critical threshold on the working set memory (%) | ||
| WARNINGCACHE | Warning threshold in bytes | ||
| CRITICALCACHE | Critical threshold in bytes | ||
| WARNINGRSS | Warning threshold in bytes | ||
| CRITICALRSS | Critical threshold in bytes | ||
| WARNINGSWAP | Warning threshold in bytes | ||
| CRITICALSWAP | Critical threshold in bytes | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Container-Memory-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_USAGE | Warning threshold on the memory usage (%) | ||
| CRITICAL_USAGE | Critical threshold on the memory usage (%) | ||
| WARNING_WORKING | Warning threshold on the working set memory (%) | ||
| CRITICAL_WORKING | Critical threshold on the working set memory (%) | ||
| WARNING_CACHE | Warning threshold in bytes | ||
| CRITICAL_CACHE | Critical threshold in bytes | ||
| WARNING_RSS | Warning threshold in bytes | ||
| CRITICAL_RSS | Critical threshold in bytes | ||
| WARNING_SWAP | Warning threshold in bytes | ||
| CRITICAL_SWAP | Critical threshold in bytes | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
Cloud-Prometheus-cAdvisor-Storage-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| CONTAINER | Filter on the container (must be a PromQL filter) | container_name!~".POD." | |
| POD | Filter on the pod (must be a PromQL filter) | pod_name=~".*" | |
| DEVICE | Filter on the device (must be a PromQL filter) | device=~".*" | |
| UNITS | Units of thresholds ('%', 'B') | % | |
| WARNINGUSAGE | Warning threshold | 80 | |
| CRITICALUSAGE | Critical threshold | 90 | |
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Container-Storage-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| DEVICE | Filter on the device (must be a PromQL filter) | device=~".*" | |
| UNITS | Units of thresholds ('%', 'B') | % | |
| WARNING_USAGE | Warning threshold | 80 | |
| CRITICAL_USAGE | Critical threshold | 90 | |
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Task-State-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| CONTAINER | Filter on the container (must be a PromQL filter) | container_name!~".POD." | |
| POD | Filter on the pod (must be a PromQL filter) | pod_name=~".*" | |
| STATE | Filter on the state (must be a PromQL filter) | state=~".*" | |
| WARNINGSLEEPING | Warning threshold on the number of tasks | ||
| CRITICALSLEEPING | Critical threshold on the number of tasks | ||
| WARNINGRUNNING | Warning threshold on the number of tasks | ||
| CRITICALRUNNING | Critical threshold on the number of tasks | ||
| WARNINGSTOPPED | Warning threshold on the number of tasks | ||
| CRITICALSTOPPED | Critical threshold on the number of tasks | ||
| WARNINGUNINTERRUPTIBLE | Warning threshold on the number of tasks | ||
| CRITICALUNINTERRUPTIBLE | Critical threshold on the number of tasks | ||
| WARNINGIOWAITING | Warning threshold on the number of tasks | ||
| CRITICALIOWAITING | Critical threshold on the number of tasks | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
Cloud-Prometheus-cAdvisor-Container-Task-State-Api-custom
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| STATE | Filter on the state (must be a PromQL filter) | state=~".*" | |
| WARNING_SLEEPING | Warning threshold on the number of tasks | ||
| CRITICAL_SLEEPING | Critical threshold on the number of tasks | ||
| WARNING_RUNNING | Warning threshold on the number of tasks | ||
| CRITICAL_RUNNING | Critical threshold on the number of tasks | ||
| WARNING_STOPPED | Warning threshold on the number of tasks | ||
| CRITICAL_STOPPED | Critical threshold on the number of tasks | ||
| WARNING_UNINTERRUPTIBLE | Warning threshold on the number of tasks | ||
| CRITICAL_UNINTERRUPTIBLE | Critical threshold on the number of tasks | ||
| WARNING_IOWAITING | Warning threshold on the number of tasks | ||
| CRITICAL_IOWAITING | Critical threshold on the number of tasks | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_USAGE | Warning threshold on the CPU usage (%) | ||
| CRITICAL_USAGE | Critical threshold on the CPU usage (%) | ||
| WARNING_THROTTLED | Warning threshold on the CPU throttling (%) | ||
| CRITICAL_THROTTLED | Critical threshold on the CPU throttling (%) | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_LOAD | Warning threshold | ||
| CRITICAL_LOAD | Critical threshold | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| WARNING_USAGE | Warning threshold on the memory usage (%) | ||
| CRITICAL_USAGE | Critical threshold on the memory usage (%) | ||
| WARNING_WORKING | Warning threshold on the working set memory (%) | ||
| CRITICAL_WORKING | Critical threshold on the working set memory (%) | ||
| WARNING_CACHE | Warning threshold in bytes | ||
| CRITICAL_CACHE | Critical threshold in bytes | ||
| WARNING_RSS | Warning threshold in bytes | ||
| CRITICAL_RSS | Critical threshold in bytes | ||
| WARNING_SWAP | Warning threshold in bytes | ||
| CRITICAL_SWAP | Critical threshold in bytes | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. |
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| DEVICE | Filter on the device (must be a PromQL filter) | device=~".*" | |
| UNITS | Units of thresholds ('%', 'B') | % | |
| WARNING_USAGE | Warning threshold | 80 | |
| CRITICAL_USAGE | Critical threshold | 90 | |
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
| Macro | Description | Default value | Mandatory |
|---|---|---|---|
| STATE | Filter on the state (must be a PromQL filter) | state=~".*" | |
| WARNING_SLEEPING | Warning threshold on the number of tasks | ||
| CRITICAL_SLEEPING | Critical threshold on the number of tasks | ||
| WARNING_RUNNING | Warning threshold on the number of tasks | ||
| CRITICAL_RUNNING | Critical threshold on the number of tasks | ||
| WARNING_STOPPED | Warning threshold on the number of tasks | ||
| CRITICAL_STOPPED | Critical threshold on the number of tasks | ||
| WARNING_UNINTERRUPTIBLE | Warning threshold on the number of tasks | ||
| CRITICAL_UNINTERRUPTIBLE | Critical threshold on the number of tasks | ||
| WARNING_IOWAITING | Warning threshold on the number of tasks | ||
| CRITICAL_IOWAITING | Critical threshold on the number of tasks | ||
| EXTRAOPTIONS | Any extra option you may want to add to the command (a --verbose flag for example). All options are listed here. | --verbose |
- Deploy the configuration. The service appears in the list of services, and on the Resources Status page. The command that is sent by the connector is displayed in the details panel of the service: it shows the values of the macros.
How to check in the CLI that the configuration is OK and what are the main options for?β
Once the plugin is installed, log into your Centreon poller's CLI using the
centreon-engine user account (su - centreon-engine). Test that the connector
is able to monitor a resource using a command like this one (replace the sample values with yours):
/usr/lib/centreon/plugins/centreon_prometheus_cadvisor_api.pl \
--plugin=cloud::prometheus::exporters::cadvisor::plugin \
--mode=memory \
--hostname=10.0.0.1 \
--url-path='/api/v1' \
--port='9090' \
--proto='http' \
--container='container="nginx"' \
--pod='pod="web-1"' \
--extra-filter='namespace="default"' \
--warning-usage='' \
--critical-usage='' \
--warning-working='' \
--critical-working='' \
--warning-cache='' \
--critical-cache='' \
--warning-rss='' \
--critical-rss='' \
--warning-swap='' \
--critical-swap='' \
--verbose
The expected command output is shown below:
OK: Container 'nginx' [pod: web-1] Memory Usage: 50.00 MB (50.00% of 100.00 MB), Working: 40.00 MB (40.00% of 100.00 MB), Cache: 10.00 MB, Rss: 38.00 MB, Swap: 0.00 B | 'web-1~nginx#memory.used.bytes'=52428800B;;;0;104857600 'web-1~nginx#memory.working.bytes'=41943040B;;;0;104857600 'web-1~nginx#cache.usage.bytes'=10485760B;;;0; 'web-1~nginx#rss.usage.bytes'=39845888B;;;0; 'web-1~nginx#swap.usage.bytes'=0B;;;0;
Container 'nginx' [pod: web-1] Memory Usage: 50.00 MB (50.00% of 100.00 MB), Working: 40.00 MB (40.00% of 100.00 MB), Cache: 10.00 MB, Rss: 38.00 MB, Swap: 0.00 B
Troubleshootingβ
Please find the troubleshooting documentation for the API-based plugins in this chapter.
Available modesβ
In most cases, a mode corresponds to a service template. The mode appears in the execution command for the connector. In the Centreon interface, you don't need to specify a mode explicitly: its use is implied when you apply a service template. However, you will need to specify the correct mode for the template if you want to test the execution command for the connector in your terminal.
All available modes can be displayed by adding the --list-mode parameter to
the command:
/usr/lib/centreon/plugins/centreon_prometheus_cadvisor_api.pl \
--plugin=cloud::prometheus::exporters::cadvisor::plugin \
--list-mode
The plugin brings the following modes:
| Mode | Linked service template |
|---|---|
| cpu [code] | Cloud-Prometheus-cAdvisor-Cpu-Api-custom Cloud-Prometheus-cAdvisor-Container-Cpu-Api-custom Cloud-Prometheus-cAdvisor-Pod-Cpu-Api-custom |
| discovery [code] | Used for host discovery |
| list-containers [code] | Not used in this Monitoring Connector |
| load [code] | Cloud-Prometheus-cAdvisor-Load-Api-custom Cloud-Prometheus-cAdvisor-Container-Load-Api-custom Cloud-Prometheus-cAdvisor-Pod-Load-Api-custom |
| memory [code] | Cloud-Prometheus-cAdvisor-Memory-Api-custom Cloud-Prometheus-cAdvisor-Container-Memory-Api-custom Cloud-Prometheus-cAdvisor-Pod-Memory-Api-custom |
| presence [code] | Used for the host check of Cloud-Prometheus-cAdvisor-Api-Container-custom Cloud-Prometheus-cAdvisor-Api-Kubernetes-Container-custom Cloud-Prometheus-cAdvisor-Api-Pod-custom |
| storage [code] | Cloud-Prometheus-cAdvisor-Storage-Api-custom Cloud-Prometheus-cAdvisor-Container-Storage-Api-custom Cloud-Prometheus-cAdvisor-Pod-Storage-Api-custom |
| task-state [code] | Cloud-Prometheus-cAdvisor-Task-State-Api-custom Cloud-Prometheus-cAdvisor-Container-Task-State-Api-custom Cloud-Prometheus-cAdvisor-Pod-Task-State-Api-custom |
Available optionsβ
Generic optionsβ
All generic options are listed here:
| Option | Description |
|---|---|
| --mode | Define the mode in which you want the plugin to be executed (see --list-mode). |
| --dyn-mode | Specify a mode with the module's path (advanced). |
| --list-mode | List all available modes. |
| --mode-version | Check minimal version of mode. If not, unknown error. |
| --version | Return the version of the plugin. |
| --custommode | When a plugin offers several ways (CLI, library, etc.) to get information the desired one must be defined with this option. |
| --list-custommode | List all available custom modes. |
| --multiple | Multiple custom mode objects. This may be required by some specific modes (advanced). |
| --pass-manager | Define the password manager you want to use. Supported managers are: environment, file, keepass, hashicorpvault and teampass. |
| --verbose | Display extended status information (long output). |
| --debug | Display debug messages. |
| --show-password | By default, sensitive information in command lines is hidden in debug output and replaced with *** (however, debug logs may still display sensitive information). Using the --show-password option will display the passwords in plain text. |
| --filter-perfdata | Filter perfdata that match the regexp. Example: adding --filter-perfdata='avg' will remove all metrics that do not contain 'avg' from performance data. |
| --filter-perfdata-adv | Filter perfdata based on a "if" condition using the following variables: label, value, unit, warning, critical, min, max. Variables must be written either %{variable} or %(variable). Example: adding --filter-perfdata-adv='not (%(value) == 0 and %(max) eq "")' will remove all metrics whose value equals 0 and that don't have a maximum value. |
| --explode-perfdata-max | Create a new metric for each metric that comes with a maximum limit. The new metric will be named identically with a '_max' suffix. Example: it will split 'used_prct'=26.93%;0:80;0:90;0;100 into 'used_prct'=26.93%;0:80;0:90;0;100 'used_prct_max'=100%;;;; |
| --change-perfdata --extend-perfdata | Change or extend perfdata. Syntax: --extend-perfdata=searchlabel,newlabel,target[,[<new-unit-of-measure>],[min],[max]] Common examples: Convert storage free perfdata into used: --change-perfdata='free,used,invert()' Convert storage used perfdata into free: --change-perfdata='used,free,invert()' Scale traffic values automatically: --change-perfdata='traffic,,scale(auto)' Scale traffic values in Mbps: --change-perfdata='traffic_in,,scale(Mbps),mbps' Change traffic values in percent: --change-perfdata='traffic_in,,percent()' |
| --change-perfdata | Change or extend perfdata. Syntax: --extend-perfdata=searchlabel,newlabel,target[,[<new-unit-of-measure>],[min],[max]] Common examples: Convert storage free perfdata into used: --change-perfdata='free,used,invert()' Convert storage used perfdata into free: --change-perfdata='used,free,invert()' Scale traffic values automatically: --change-perfdata='traffic,,scale(auto)' Scale traffic values in Mbps: --change-perfdata='traffic_in,,scale(Mbps),mbps' Change traffic values in percent: --change-perfdata='traffic_in,,percent()' |
| --extend-perfdata | Change or extend perfdata. Syntax: --extend-perfdata=searchlabel,newlabel,target[,[<new-unit-of-measure>],[min],[max]] Common examples: Convert storage free perfdata into used: --change-perfdata='free,used,invert()' Convert storage used perfdata into free: --change-perfdata='used,free,invert()' Scale traffic values automatically: --change-perfdata='traffic,,scale(auto)' Scale traffic values in Mbps: --change-perfdata='traffic_in,,scale(Mbps),mbps' Change traffic values in percent: --change-perfdata='traffic_in,,percent()' |
| --extend-perfdata-group | Add new aggregated metrics (min, max, average or sum) for groups of metrics defined by a regex match on the metrics' names. Syntax: --extend-perfdata-group=regex,<names-of-new-metrics>,calculation[,[<new-unit-of-measure>],[min],[max]] regex: regular expression <names-of-new-metrics>: how the new metrics' names are composed (can use $1, $2... for groups defined by () in regex). calculation: how the values of the new metrics should be calculated <new-unit-of-measure> (optional): unit of measure for the new metrics min (optional): lowest value the metrics can reach max (optional): highest value the metrics can reach Common examples: Sum wrong packets from all interfaces (with interface need --units-errors=absolute): --extend-perfdata-group=',packets_wrong,sum(packets_(discard|error)_(in|out))' Sum traffic by interface: --extend-perfdata-group='traffic_in_(.*),traffic_$1,sum(traffic_(in|out)_$1)' |
| --change-short-output --change-long-output | Modify the short/long output that is returned by the plugin. Syntax: --change-short-output=pattern~replacement~modifier Most commonly used modifiers are i (case insensitive) and g (replace all occurrences). Example: adding --change-short-output='OK~Up~gi' will replace all occurrences of 'OK', 'ok', 'Ok' or 'oK' with 'Up' |
| --change-short-output | Modify the short/long output that is returned by the plugin. Syntax: --change-short-output=pattern~replacement~modifier Most commonly used modifiers are i (case insensitive) and g (replace all occurrences). Example: adding --change-short-output='OK~Up~gi' will replace all occurrences of 'OK', 'ok', 'Ok' or 'oK' with 'Up' |
| --change-long-output | Modify the short/long output that is returned by the plugin. Syntax: --change-short-output=pattern~replacement~modifier Most commonly used modifiers are i (case insensitive) and g (replace all occurrences). Example: adding --change-short-output='OK~Up~gi' will replace all occurrences of 'OK', 'ok', 'Ok' or 'oK' with 'Up' |
| --change-exit | Replace an exit code with one of your choice. Example: adding --change-exit=unknown=critical will result in a CRITICAL state instead of an UNKNOWN state. |
| --change-output-adv | Replace short output and exit code based on a "if" condition using the following variables: short_output, exit_code. Variables must be written either %{variable} or %(variable). Example: adding --change-output-adv='%(short_output) =~ /UNKNOWN: No daemon/,OK: No daemon,OK' will change the following specific UNKNOWN result to an OK result. |
| --range-perfdata | Rewrite the ranges displayed in the perfdata. Accepted values: 0: nothing is changed. 1: if the lower value of the range is equal to 0, it is removed. 2: remove the thresholds from the perfdata. |
| --filter-uom | Mask the units when they don't match the given regular expression. |
| --opt-exit | Replace the exit code in case of an execution error (i.e. wrong option provided, SSH connection refused, timeout, etc). Default: unknown. |
| --output-ignore-perfdata | Remove all the metrics from the service. The service will still have a status and an output. |
| --output-ignore-label | Remove the status label ("OK:", "WARNING:", "UNKNOWN:", CRITICAL:") from the beginning of the output. Example: 'OK: Ram Total:...' will become 'Ram Total:...' |
| --output-xml | Return the output in XML format (to send to an XML API). |
| --output-json | Return the output in JSON format (to send to a JSON API). |
| --output-openmetrics | Return the output in OpenMetrics format (to send to a tool expecting this format). |
| --output-file | Write output in file (can be combined with JSON, XML and OpenMetrics options). Example: --output-file=/tmp/output.txt will write the output in /tmp/output.txt. |
| --disco-format | Applies only to modes beginning with 'list-'. Returns the list of available macros to configure a service discovery rule (formatted in XML). |
| --disco-show | Applies only to modes beginning with 'list-'. Returns the list of discovered objects (formatted in XML) for service discovery. |
| --float-precision | Define the float precision for thresholds (default: 8). |
| --source-encoding | Define the character encoding of the response sent by the monitored resource. Default: 'UTF-8'. |
| --http-peer-addr | Set the address you want to connect to. Useful if hostname is only a vhost, to avoid IP resolution. |
| --proxyurl | Proxy URL. Example: http://my.proxy:3128 |
| --proxypac | Proxy PAC file (can be a URL or a local file). |
| --insecure | Accept insecure SSL connections. |
| --http-backend | Perl library to use for HTTP transactions. Possible values are: lwp (default) and curl. |
| --timeframe | Set timeframe in seconds (i.e. 3600 to check last hour). |
| --step | Set the step of the metric query (examples: '30s', '1m', '15m', '1h'). |
| --hostname | Prometheus hostname. |
| --url-path | API URL path (default: '/api/v1') |
| --port | API port (default: 9090) |
| --proto | Specify https if needed (default: 'http') |
| --credentials | Specify this option if you access the API with authentication |
| --username | Specify the username for authentication (mandatory if --credentials is specified) |
| --password | Specify the password for authentication (mandatory if --credentials is specified) |
| --basic | Specify this option if you access the API over basic authentication and don't want a '401 UNAUTHORIZED' error to be logged on your web server. Specify this option if you access the API over hidden basic authentication or you'll get a '404 NOT FOUND' error. (use with --credentials) |
| --timeout | Set HTTP timeout |
| --header | Set HTTP header (can be multiple, example: --header='Authorization:Bearer ABCD') Useful to access Prometheus API hosted in a specific environment. |
Modes optionsβ
All available options for each service template are listed below:
- Container-Cpu
- Container-Load
- Container-Memory
- Container-Storage
- Container-Task-State
- Pod-Cpu
- Pod-Load
- Pod-Memory
- Pod-Storage
- Pod-Task-State
- Host check (presence)
| Option | Description |
|---|---|
| --cpu-attribute | Set the CPU attribute to match element (must be a PromQL filter, default: 'cpu="total"'). |
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-usage | Warning threshold. |
| --warning-throttled | Warning threshold. |
| --critical-usage | Critical threshold. |
| --critical-throttled | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - throttled: ^container_cpu_cfs_throttled_seconds_total.* - usage: ^container_cpu_usage_seconds_total.* |
| --filter-counters | Only display some counters (regexp can be used). Example: --filter-counters='throttled' |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-load | Warning threshold. |
| --critical-load | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - load: ^container_cpu_load_average_10s$ |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-usage | Warning threshold. |
| --warning-working | Warning threshold. |
| --warning-cache | Warning threshold in Bytes. |
| --warning-rss | Warning threshold in Bytes. |
| --warning-swap | Warning threshold in Bytes. |
| --critical-usage | Critical threshold. |
| --critical-working | Critical threshold. |
| --critical-cache | Critical threshold in Bytes. |
| --critical-rss | Critical threshold in Bytes. |
| --critical-swap | Critical threshold in Bytes. |
| --units | Units of thresholds (default: '%') ('%', 'B'). |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - limits: ^container_spec_memory_limit_bytes.* - usage: ^container_memory_usage_bytes.* - working: ^container_memory_working_set_bytes.* - cache: ^container_memory_cache.* - rss: ^container_memory_rss.* - swap: ^container_memory_swap.* |
| --filter-counters | Only display some counters (regexp can be used). Example: --filter-counters='usage' |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --device | Filter on a specific device (must be a PromQL filter, default: 'device=~".*"'). |
| --units | Units of thresholds (default: '%') ('%', 'B'). |
| --free | Thresholds are on free space left. |
| --warning-usage | Warning threshold. |
| --critical-usage | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - used: ^container_fs_usage_bytes.* - limit: ^container_fs_limit_bytes.* |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --state | Filter on a specific state (must be a PromQL filter, default: 'state=~".*"'). |
| --warning-sleeping | Warning threshold. |
| --warning-running | Warning threshold. |
| --warning-stopped | Warning threshold. |
| --warning-uninterruptible | Warning threshold. |
| --warning-iowaiting | Warning threshold. |
| --critical-sleeping | Critical threshold. |
| --critical-running | Critical threshold. |
| --critical-stopped | Critical threshold. |
| --critical-uninterruptible | Critical threshold. |
| --critical-iowaiting | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - tasks_state: ^container_tasks_state$ |
| Option | Description |
|---|---|
| --cpu-attribute | Set the CPU attribute to match element (must be a PromQL filter, default: 'cpu="total"'). |
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-usage | Warning threshold. |
| --warning-throttled | Warning threshold. |
| --critical-usage | Critical threshold. |
| --critical-throttled | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - throttled: ^container_cpu_cfs_throttled_seconds_total.* - usage: ^container_cpu_usage_seconds_total.* |
| --filter-counters | Only display some counters (regexp can be used). Example: --filter-counters='throttled' |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-load | Warning threshold. |
| --critical-load | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - load: ^container_cpu_load_average_10s$ |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --warning-usage | Warning threshold. |
| --warning-working | Warning threshold. |
| --warning-cache | Warning threshold in Bytes. |
| --warning-rss | Warning threshold in Bytes. |
| --warning-swap | Warning threshold in Bytes. |
| --critical-usage | Critical threshold. |
| --critical-working | Critical threshold. |
| --critical-cache | Critical threshold in Bytes. |
| --critical-rss | Critical threshold in Bytes. |
| --critical-swap | Critical threshold in Bytes. |
| --units | Units of thresholds (default: '%') ('%', 'B'). |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - limits: ^container_spec_memory_limit_bytes.* - usage: ^container_memory_usage_bytes.* - working: ^container_memory_working_set_bytes.* - cache: ^container_memory_cache.* - rss: ^container_memory_rss.* - swap: ^container_memory_swap.* |
| --filter-counters | Only display some counters (regexp can be used). Example: --filter-counters='usage' |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --device | Filter on a specific device (must be a PromQL filter, default: 'device=~".*"'). |
| --units | Units of thresholds (default: '%') ('%', 'B'). |
| --free | Thresholds are on free space left. |
| --warning-usage | Warning threshold. |
| --critical-usage | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - used: ^container_fs_usage_bytes.* - limit: ^container_fs_limit_bytes.* |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~"|.POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). Two pods with the same name in different namespaces are reported separately, but with the same output and performance data names: filter on the namespace to tell them apart. |
| --state | Filter on a specific state (must be a PromQL filter, default: 'state=~".*"'). |
| --warning-sleeping | Warning threshold. |
| --warning-running | Warning threshold. |
| --warning-stopped | Warning threshold. |
| --warning-uninterruptible | Warning threshold. |
| --warning-iowaiting | Warning threshold. |
| --critical-sleeping | Critical threshold. |
| --critical-running | Critical threshold. |
| --critical-stopped | Critical threshold. |
| --critical-uninterruptible | Critical threshold. |
| --critical-iowaiting | Critical threshold. |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='name=~".pretty."' |
| --metric-overload | Overload default metrics name (can be defined multiple times). Example : --metric-overload='metric,^my_metric_name$' Default : - tasks_state: ^container_tasks_state$ |
| Option | Description |
|---|---|
| --container | Filter on a specific container (must be a PromQL filter, default: 'container!~".POD."'). |
| --pod | Filter on a specific pod (must be a PromQL filter, default: 'pod=~"."'). The label filtered is the first word of the --container and --pod filters. The kubelet cAdvisor metrics label names depend on the platform version: Kubernetes < 1.14: container_name and pod_name only. Kubernetes 1.14 and 1.15: both container_name/pod_name and container/pod. Kubernetes >= 1.16: container and pod only. OpenShift: container_name and pod_name only up to 4.1 (Kubernetes 1.13), both label sets in 4.2 (Kubernetes 1.14), container and pod only from 4.3 (Kubernetes 1.16). Rancher: depends on the Kubernetes version of the managed cluster. Kubernetes 1.16 is available from Rancher 2.3.0 (experimental), generally available in 2.3.2 and the default in 2.3.3. On older platforms, use for example: --container='container_name!~"|.POD."' --pod='pod_name=~"."'. A container running outside Kubernetes has no pod label: filter it on its name label, for example: --container='name="haproxy"' |
| --namespace | Filter on a specific namespace (must be a PromQL filter, default: 'namespace=~".*"'). |
| --name-label | Name of the Prometheus label holding the name of containers running outside Kubernetes, used when a series has neither pod nor container label (default: 'name'). |
| --extra-filter | Add a PromQL filter (can be defined multiple times). Example : --extra-filter='namespace="monitoring"' |
| --metric-last-seen | Regular expression matching the name of the Prometheus metric holding the last time a container was seen (default: '^container_last_seen$'). |
| --warning-resources-detected | Threshold on the number of pods and containers detected. |
| --critical-resources-detected | Threshold on the number of pods and containers detected (default: '1:'). |
| --warning-last-seen | Threshold on the number of seconds since the pod or container was last seen. cAdvisor sets container_last_seen to the scrape time, with an explicit timestamp: in normal conditions, the value stays below the Prometheus scrape interval. Prometheus does not mark these series as stale when a container disappears, it keeps returning their last value during --query.lookback-delta (5 minutes by default): the value then grows up to this delay, before the series disappears. A threshold above this delay never triggers, and the resources-detected threshold is reached after this delay. |
| --critical-last-seen | Threshold on the number of seconds since the pod or container was last seen. |
All available options for a given mode can be displayed by adding the
--help parameter to the command:
/usr/lib/centreon/plugins/centreon_prometheus_cadvisor_api.pl \
--plugin=cloud::prometheus::exporters::cadvisor::plugin \
--mode=memory \
--help