From 4e704b2869ceb5c0e91648585213651446e58984 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 13 Jan 2025 15:18:58 +0530 Subject: [PATCH 01/12] initial changes --- charts/mgmt-agent/README.md | 1 + .../prometheus-scrape-config-json-readme.md | 48 +++++++++++++++++++ .../resources/prometheus-scrape-config.json | 2 + .../mgmt-agent/templates/env-configmap.yaml | 1 + .../templates/metrics-configmap.yaml | 2 + charts/mgmt-agent/values.schema.json | 7 ++- charts/mgmt-agent/values.yaml | 4 ++ 7 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md create mode 100644 charts/mgmt-agent/resources/prometheus-scrape-config.json diff --git a/charts/mgmt-agent/README.md b/charts/mgmt-agent/README.md index a34471a..a677abe 100644 --- a/charts/mgmt-agent/README.md +++ b/charts/mgmt-agent/README.md @@ -25,6 +25,7 @@ A Helm chart for collecting Kubernetes Metrics using OCI Management Agent into O | kubernetesCluster.overrideAllowMetricsCluster | string | `nil` | Provide the specific list of comma separated metric names for agent computed metrics to be collected | | kubernetesCluster.overrideAllowMetricsKubelet | string | `nil` | Provide the specific list of comma separated metric names for Kubelet (/api/v1/nodes//proxy/metrics) metrics to be collected | | kubernetesCluster.overrideAllowMetricsNode | string | `nil` | Provide the specific list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics to be collected | +| kubernetesCluster.enableAutomaticPrometheusEmitterCollection | bool | `false` | Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods | | mgmtagent.image.secret | string | `nil` | Image secrets to use for pulling container image (base64 encoded content of ~/.docker/config.json file) | | mgmtagent.image.url | string | `nil` | Replace this value with actual docker image URL for Management Agent | | mgmtagent.installKey | string | `"resources/input.rsp"` | Copy the downloaded Management Agent Install Key file under root helm directory as resources/input.rsp | diff --git a/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md b/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md new file mode 100644 index 0000000..caa33a6 --- /dev/null +++ b/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md @@ -0,0 +1,48 @@ +# prometheus-scrape-config.json + +# Sample JSON with all elements (including optional) +``` +[ + { + "podMatcher": + { + "namespace": "pod_namespace", + "podNameRegex": "sample-pod.*" + }, + "config": + { + "path": "/path/to/metrics/endpoint", + "port": 9100, + "namespace": "push_metrics_to_namespace", + "allowMetrics": "sampleMetric1,sampleMetric2", + "compartmentId": "ocid1.compartment.oc1..sample", + "scheduleMins": 1 + }, + "disable": false + }, + ... +] +``` + +# First class members +| member | required | Description | +|--------|----------|-------------| +| podMatcher | yes | Elements used to match pods | +| config | no | Collection configuration for PrometheusEmitter data source, of the matching pod. This is optional, if disable is set to `true` | +| disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | + +# podMatcher +| member | required | type | Description | +|--------|----------|----- | ------------| +| namespace | yes | `string` | Pod's namespace | +| podNameRegex | yes | `string` | Complete regular expression to match pod name | + +# config +| member | required | type | default | Description | +|--------|----------|----- | ------- | ----------- | +| path | yes | `string` | NA | Path on which metrics are being emitted. e.g. /metrics | +| port | yes | `string` | NA | Complete regular expression to match pod name | +| namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed | +| allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all. | +| compartmentId | no | `string` | Agent's compartmentId | Compartment to which metrics are pushed. If not provided, then metrics will be pushed to same compartment where agent is installed | +| scheduleMins | no | `int` | 1 | Minute interval at which metrics are collected. | \ No newline at end of file diff --git a/charts/mgmt-agent/resources/prometheus-scrape-config.json b/charts/mgmt-agent/resources/prometheus-scrape-config.json new file mode 100644 index 0000000..32960f8 --- /dev/null +++ b/charts/mgmt-agent/resources/prometheus-scrape-config.json @@ -0,0 +1,2 @@ +[ +] \ No newline at end of file diff --git a/charts/mgmt-agent/templates/env-configmap.yaml b/charts/mgmt-agent/templates/env-configmap.yaml index a0a6c0b..6682639 100644 --- a/charts/mgmt-agent/templates/env-configmap.yaml +++ b/charts/mgmt-agent/templates/env-configmap.yaml @@ -15,3 +15,4 @@ data: {{- if .Values.deployment.cleanupEpochTime }} POD_CLEANUP_ID: "{{ .Values.deployment.cleanupEpochTime }}" {{- end }} + ENABLE_AUTOMATIC_PROMETHEUSEMITTERS: "{{ .Values.kubernetesCluster.enableAutomaticPrometheusEmitterCollection }}" diff --git a/charts/mgmt-agent/templates/metrics-configmap.yaml b/charts/mgmt-agent/templates/metrics-configmap.yaml index c09296b..06d6e25 100644 --- a/charts/mgmt-agent/templates/metrics-configmap.yaml +++ b/charts/mgmt-agent/templates/metrics-configmap.yaml @@ -34,3 +34,5 @@ data: # list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics overrideAllowMetricsNode={{ .Values.kubernetesCluster.overrideAllowMetricsNode }} {{- end }} + prometheus-scrape-config.json: | +{{ .Files.Get "resources/prometheus-scrape-config.json" | indent 4 }} diff --git a/charts/mgmt-agent/values.schema.json b/charts/mgmt-agent/values.schema.json index 2c614ee..fbbeb5a 100644 --- a/charts/mgmt-agent/values.schema.json +++ b/charts/mgmt-agent/values.schema.json @@ -131,11 +131,16 @@ "type": "null" } ] + }, + "enableAutomaticPrometheusEmitterCollection": + { + "type": "boolean" } }, "required": [ - "namespace" + "namespace", + "enableAutomaticPrometheusEmitterCollection" ] }, "deployment": diff --git a/charts/mgmt-agent/values.yaml b/charts/mgmt-agent/values.yaml index 0ac47f8..1c2a0ec 100644 --- a/charts/mgmt-agent/values.yaml +++ b/charts/mgmt-agent/values.yaml @@ -67,6 +67,10 @@ kubernetesCluster: overrideAllowMetricsKubelet: # -- Provide the specific list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics to be collected. overrideAllowMetricsNode: + # Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods. + # Add pod specific configuration to ./resources/prometheus-scrape-config.json + # Check ./resources/prometheus-scrape-config-json-readme.md for more information. + enableAutomaticPrometheusEmitterCollection: false deployment: security: From a19cf3b77281dd132a45c84c93d6ef90d98134b6 Mon Sep 17 00:00:00 2001 From: prasebha Date: Wed, 15 Jan 2025 09:29:48 +0530 Subject: [PATCH 02/12] update readme, update comments --- .../prometheus-scrape-config-json-readme.md | 48 ------------ .../prometheus_scrape_config_readme.md | 73 +++++++++++++++++++ charts/mgmt-agent/values.yaml | 5 +- 3 files changed, 75 insertions(+), 51 deletions(-) delete mode 100644 charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md create mode 100644 charts/mgmt-agent/resources/prometheus_scrape_config_readme.md diff --git a/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md b/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md deleted file mode 100644 index caa33a6..0000000 --- a/charts/mgmt-agent/resources/prometheus-scrape-config-json-readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# prometheus-scrape-config.json - -# Sample JSON with all elements (including optional) -``` -[ - { - "podMatcher": - { - "namespace": "pod_namespace", - "podNameRegex": "sample-pod.*" - }, - "config": - { - "path": "/path/to/metrics/endpoint", - "port": 9100, - "namespace": "push_metrics_to_namespace", - "allowMetrics": "sampleMetric1,sampleMetric2", - "compartmentId": "ocid1.compartment.oc1..sample", - "scheduleMins": 1 - }, - "disable": false - }, - ... -] -``` - -# First class members -| member | required | Description | -|--------|----------|-------------| -| podMatcher | yes | Elements used to match pods | -| config | no | Collection configuration for PrometheusEmitter data source, of the matching pod. This is optional, if disable is set to `true` | -| disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | - -# podMatcher -| member | required | type | Description | -|--------|----------|----- | ------------| -| namespace | yes | `string` | Pod's namespace | -| podNameRegex | yes | `string` | Complete regular expression to match pod name | - -# config -| member | required | type | default | Description | -|--------|----------|----- | ------- | ----------- | -| path | yes | `string` | NA | Path on which metrics are being emitted. e.g. /metrics | -| port | yes | `string` | NA | Complete regular expression to match pod name | -| namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed | -| allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all. | -| compartmentId | no | `string` | Agent's compartmentId | Compartment to which metrics are pushed. If not provided, then metrics will be pushed to same compartment where agent is installed | -| scheduleMins | no | `int` | 1 | Minute interval at which metrics are collected. | \ No newline at end of file diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md new file mode 100644 index 0000000..ce038cf --- /dev/null +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -0,0 +1,73 @@ +# 1. Introduction +Automatic PrometheusEmitter collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the PrometheusEmitter configuration to collect metrics. + +# 2. Identification types (in order) +## 2.1. prometheus scrape config json +User can provide their custom configuration in [prometheus-scrape-config.json](./prometheus-scrape-config.json) +This takes highest precedence and overrides other types. + +### 2.1.1 Sample JSON with all supported elements (including optional) +``` +[ + { + "podMatcher": + { + "namespace": "pod_namespace", + "podNameRegex": "sample-pod.*" + }, + "config": + { + "path": "/path/to/metrics/endpoint", + "port": 9100, + "namespace": "push_metrics_to_namespace", + "allowMetrics": "sampleMetric1,sampleMetric2", + "compartmentId": "ocid1.compartment.oc1..sample", + "scheduleMins": 1 + }, + "disable": false + }, + ... +] +``` + +### 2.1.2 First class members +| member | required | Description | +|--------|----------|-------------| +| podMatcher | yes | Elements used to match pods | +| config | no | Collection configuration for PrometheusEmitter data source of the matching pod. This is optional, if disable is set to `true` | +| disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | + +### 2.1.3 podMatcher +| member | required | type | Description | +|--------|----------|----- | ------------| +| namespace | yes | `string` | Pod's namespace | +| podNameRegex | yes | `string` | Complete regular expression to match pod name | + +### 2.1.4 config +| member | required | type | default | Description | +|--------|----------|----- | ------- | ----------- | +| path | yes | `string` | NA | Path on which metrics are being emitted, e.g. /metrics | +| port | yes | `int` | NA | Port on which metrics are being emitted | +| namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed | +| allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all | +| compartmentId | no | `string` | Agent's compartmentId | Compartment to which metrics are pushed. If not provided, then metrics will be pushed to same compartment where agent is installed | +| scheduleMins | no | `int` | 1 | Minute interval at which metrics are collected | + +## 2.2 Prometheus.io scrape annotation +If there's no custom scrape json configuration available for a Pod, then agent will look for the standardized +prometheus.io annotation to build the basic configuration.
+Other configurations than `path` and `port` are set to their default. + +## 2.2.1 Sample Annotation +``` + annotations: + prometheus.io/path: "/path/to/metrics" + prometheus.io/port: "8080" + prometheus.io/scrape: "true" +``` +Agent will only scrape if `prometheus.io/scrape` is set to `true`.
+The `prometheus.io/path` is optional, if not set, then it will default to `/metrics`. + +## 2.3 Pod port specification +This is the fallback way, if none of the above configurations are defined. Here Agent looks for port spec with port name as `metrics` and port protocol as `TCP`.
+The path is set to default, i.e. `/metrics`. The rest of the configuration is set to default as well. \ No newline at end of file diff --git a/charts/mgmt-agent/values.yaml b/charts/mgmt-agent/values.yaml index 1c2a0ec..2ee0f03 100644 --- a/charts/mgmt-agent/values.yaml +++ b/charts/mgmt-agent/values.yaml @@ -67,9 +67,8 @@ kubernetesCluster: overrideAllowMetricsKubelet: # -- Provide the specific list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics to be collected. overrideAllowMetricsNode: - # Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods. - # Add pod specific configuration to ./resources/prometheus-scrape-config.json - # Check ./resources/prometheus-scrape-config-json-readme.md for more information. + # Setting this to true will automatically enable PrometheusEmitter metrics collection for eligible pods. + # To customize and get more information, refer ./resources/prometheus_scrape_config_readme.md enableAutomaticPrometheusEmitterCollection: false deployment: From 14e56a483c9a617ccf11ad3ecf44b54f4474d36e Mon Sep 17 00:00:00 2001 From: prasebha Date: Thu, 16 Jan 2025 10:05:44 +0530 Subject: [PATCH 03/12] update readme --- .../prometheus_scrape_config_readme.md | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md index ce038cf..4d9f82e 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -1,12 +1,30 @@ # 1. Introduction Automatic PrometheusEmitter collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the PrometheusEmitter configuration to collect metrics. -# 2. Identification types (in order) -## 2.1. prometheus scrape config json -User can provide their custom configuration in [prometheus-scrape-config.json](./prometheus-scrape-config.json) -This takes highest precedence and overrides other types. +# 2. Identification of configuration -### 2.1.1 Sample JSON with all supported elements (including optional) +## 2.1 Out of the box +Management Agent will look for pod port spec with port name as `metrics` and port protocol as `TCP`.
+Once found, the configuration is build using default path as `/metrics`. The rest of the configuration is set to default as well. + +## 2.2 Prometheus.io Annotation +The out of the box path and port configuration can be modified using the standardized prometheus.io annotations.
+ +### Sample annotation +``` + annotations: + prometheus.io/path: "/path/to/metrics" + prometheus.io/port: "8080" + prometheus.io/scrape: "true" +``` +Agent will only scrape if `prometheus.io/scrape` is set to `true`.
+The `prometheus.io/path` is optional, if not set, then it will default to `/metrics`. The rest of the configuration is set to default as well. + +## 2.3. prometheus scrape config json +The configuration can be fine tuned by providing custom json in [prometheus-scrape-config.json](./prometheus-scrape-config.json). This exposes all available PrometheusEmitter parameters.
+Json takes highest precedence and overrides other types (annotation and out of the box) + +### 2.3.1 Sample JSON with all supported parameters (including optional) ``` [ { @@ -30,44 +48,25 @@ This takes highest precedence and overrides other types. ] ``` -### 2.1.2 First class members +### 2.3.2 First class members | member | required | Description | |--------|----------|-------------| | podMatcher | yes | Elements used to match pods | | config | no | Collection configuration for PrometheusEmitter data source of the matching pod. This is optional, if disable is set to `true` | | disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | -### 2.1.3 podMatcher +### 2.3.3 podMatcher | member | required | type | Description | |--------|----------|----- | ------------| | namespace | yes | `string` | Pod's namespace | | podNameRegex | yes | `string` | Complete regular expression to match pod name | -### 2.1.4 config +### 2.3.4 config | member | required | type | default | Description | |--------|----------|----- | ------- | ----------- | -| path | yes | `string` | NA | Path on which metrics are being emitted, e.g. /metrics | +| path | no | `string` | `/metrics` | Path on which metrics are being emitted, e.g. /metrics | | port | yes | `int` | NA | Port on which metrics are being emitted | | namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed | | allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all | | compartmentId | no | `string` | Agent's compartmentId | Compartment to which metrics are pushed. If not provided, then metrics will be pushed to same compartment where agent is installed | | scheduleMins | no | `int` | 1 | Minute interval at which metrics are collected | - -## 2.2 Prometheus.io scrape annotation -If there's no custom scrape json configuration available for a Pod, then agent will look for the standardized -prometheus.io annotation to build the basic configuration.
-Other configurations than `path` and `port` are set to their default. - -## 2.2.1 Sample Annotation -``` - annotations: - prometheus.io/path: "/path/to/metrics" - prometheus.io/port: "8080" - prometheus.io/scrape: "true" -``` -Agent will only scrape if `prometheus.io/scrape` is set to `true`.
-The `prometheus.io/path` is optional, if not set, then it will default to `/metrics`. - -## 2.3 Pod port specification -This is the fallback way, if none of the above configurations are defined. Here Agent looks for port spec with port name as `metrics` and port protocol as `TCP`.
-The path is set to default, i.e. `/metrics`. The rest of the configuration is set to default as well. \ No newline at end of file From 56da6413a1d1f1c1c5b20eec492d99476217fa2a Mon Sep 17 00:00:00 2001 From: prasebha Date: Sat, 18 Jan 2025 14:03:33 +0530 Subject: [PATCH 04/12] update readme --- .../resources/prometheus_scrape_config_readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md index 4d9f82e..5c2e0bd 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -49,22 +49,22 @@ Json takes highest precedence and overrides other types (annotation and out of t ``` ### 2.3.2 First class members -| member | required | Description | +| member | required | description | |--------|----------|-------------| | podMatcher | yes | Elements used to match pods | | config | no | Collection configuration for PrometheusEmitter data source of the matching pod. This is optional, if disable is set to `true` | | disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | ### 2.3.3 podMatcher -| member | required | type | Description | +| member | required | type | description | |--------|----------|----- | ------------| | namespace | yes | `string` | Pod's namespace | | podNameRegex | yes | `string` | Complete regular expression to match pod name | ### 2.3.4 config -| member | required | type | default | Description | +| member | required | type | default | description | |--------|----------|----- | ------- | ----------- | -| path | no | `string` | `/metrics` | Path on which metrics are being emitted, e.g. /metrics | +| path | no | `string` | /metrics | Path on which metrics are being emitted, e.g. /metrics | | port | yes | `int` | NA | Port on which metrics are being emitted | | namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed | | allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all | From 7d9ba5d9674ae7914fa64e34e61aef4e049fa4d9 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 20 Jan 2025 09:33:14 +0530 Subject: [PATCH 05/12] update readme --- .../prometheus_scrape_config_readme.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md index 5c2e0bd..9c7b5ec 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -1,14 +1,18 @@ # 1. Introduction Automatic PrometheusEmitter collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the PrometheusEmitter configuration to collect metrics. -# 2. Identification of configuration +# 2. Identification of metric collection configuration ## 2.1 Out of the box +Management Agent has capabilities to detect metrics emitting pods, without making any custom configuration changes. + +### 2.1.1 Pod' ports specification Management Agent will look for pod port spec with port name as `metrics` and port protocol as `TCP`.
Once found, the configuration is build using default path as `/metrics`. The rest of the configuration is set to default as well. -## 2.2 Prometheus.io Annotation -The out of the box path and port configuration can be modified using the standardized prometheus.io annotations.
+### 2.1.2 Prometheus.io Annotation +Deployments using industry standard prometheus.io annotations to enable scrapping, will be automatically detected out of the box by agent.
+The pod's ports specification configuration can be modified using the standardized prometheus.io annotations.
### Sample annotation ``` @@ -20,11 +24,11 @@ The out of the box path and port configuration can be modified using the standar Agent will only scrape if `prometheus.io/scrape` is set to `true`.
The `prometheus.io/path` is optional, if not set, then it will default to `/metrics`. The rest of the configuration is set to default as well. -## 2.3. prometheus scrape config json +## 2.2. prometheus scrape config json The configuration can be fine tuned by providing custom json in [prometheus-scrape-config.json](./prometheus-scrape-config.json). This exposes all available PrometheusEmitter parameters.
Json takes highest precedence and overrides other types (annotation and out of the box) -### 2.3.1 Sample JSON with all supported parameters (including optional) +### 2.2.1 Sample JSON with all supported parameters (including optional) ``` [ { @@ -48,20 +52,20 @@ Json takes highest precedence and overrides other types (annotation and out of t ] ``` -### 2.3.2 First class members +### 2.2.2 First class members | member | required | description | |--------|----------|-------------| | podMatcher | yes | Elements used to match pods | | config | no | Collection configuration for PrometheusEmitter data source of the matching pod. This is optional, if disable is set to `true` | | disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics | -### 2.3.3 podMatcher +### 2.2.3 podMatcher | member | required | type | description | |--------|----------|----- | ------------| | namespace | yes | `string` | Pod's namespace | | podNameRegex | yes | `string` | Complete regular expression to match pod name | -### 2.3.4 config +### 2.2.4 config | member | required | type | default | description | |--------|----------|----- | ------- | ----------- | | path | no | `string` | /metrics | Path on which metrics are being emitted, e.g. /metrics | From ea0d1ab9225432225370f1abe8df16369e0ab087 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 3 Feb 2025 18:23:56 +0530 Subject: [PATCH 06/12] update readme --- .../mgmt-agent/resources/prometheus_scrape_config_readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md index 9c7b5ec..9bc9777 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -34,7 +34,7 @@ Json takes highest precedence and overrides other types (annotation and out of t { "podMatcher": { - "namespace": "pod_namespace", + "namespaceRegex": "pod_namespace", "podNameRegex": "sample-pod.*" }, "config": @@ -62,8 +62,8 @@ Json takes highest precedence and overrides other types (annotation and out of t ### 2.2.3 podMatcher | member | required | type | description | |--------|----------|----- | ------------| -| namespace | yes | `string` | Pod's namespace | -| podNameRegex | yes | `string` | Complete regular expression to match pod name | +| namespaceRegex | yes | `string` | Complete regular expression to match pod's namespace | +| podNameRegex | yes | `string` | Complete regular expression to match pod's name | ### 2.2.4 config | member | required | type | default | description | From 03a30013da66255d98ecc3ef29c050cb0a6c127a Mon Sep 17 00:00:00 2001 From: prasebha Date: Thu, 6 Feb 2025 12:03:09 +0530 Subject: [PATCH 07/12] update readme --- charts/mgmt-agent/resources/prometheus_scrape_config_readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md index 9bc9777..e44feea 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md @@ -26,7 +26,8 @@ The `prometheus.io/path` is optional, if not set, then it will default to `/metr ## 2.2. prometheus scrape config json The configuration can be fine tuned by providing custom json in [prometheus-scrape-config.json](./prometheus-scrape-config.json). This exposes all available PrometheusEmitter parameters.
-Json takes highest precedence and overrides other types (annotation and out of the box) +Json takes highest precedence and overrides other types (annotation and out of the box)
+If a pod matches multiple configs, then the last matching config will be applied. ### 2.2.1 Sample JSON with all supported parameters (including optional) ``` From f0ac6a329209b32051e90d566d767e95f6dd306f Mon Sep 17 00:00:00 2001 From: prasebha Date: Wed, 26 Feb 2025 19:13:03 +0530 Subject: [PATCH 08/12] update var, readme --- ..._config_readme.md => auto_prometheus_collection_readme.md} | 4 ++-- charts/mgmt-agent/templates/env-configmap.yaml | 2 +- charts/mgmt-agent/values.schema.json | 4 ++-- charts/mgmt-agent/values.yaml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) rename charts/mgmt-agent/resources/{prometheus_scrape_config_readme.md => auto_prometheus_collection_readme.md} (92%) diff --git a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md b/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md similarity index 92% rename from charts/mgmt-agent/resources/prometheus_scrape_config_readme.md rename to charts/mgmt-agent/resources/auto_prometheus_collection_readme.md index e44feea..4ba7cd2 100644 --- a/charts/mgmt-agent/resources/prometheus_scrape_config_readme.md +++ b/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md @@ -1,5 +1,5 @@ # 1. Introduction -Automatic PrometheusEmitter collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the PrometheusEmitter configuration to collect metrics. +Automatic Prometheus collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the Prometheus configuration to collect metrics. # 2. Identification of metric collection configuration @@ -35,7 +35,7 @@ If a pod matches multiple configs, then the last matching config will be applied { "podMatcher": { - "namespaceRegex": "pod_namespace", + "namespaceRegex": "pod_namespace.*", "podNameRegex": "sample-pod.*" }, "config": diff --git a/charts/mgmt-agent/templates/env-configmap.yaml b/charts/mgmt-agent/templates/env-configmap.yaml index 6682639..97ed6db 100644 --- a/charts/mgmt-agent/templates/env-configmap.yaml +++ b/charts/mgmt-agent/templates/env-configmap.yaml @@ -15,4 +15,4 @@ data: {{- if .Values.deployment.cleanupEpochTime }} POD_CLEANUP_ID: "{{ .Values.deployment.cleanupEpochTime }}" {{- end }} - ENABLE_AUTOMATIC_PROMETHEUSEMITTERS: "{{ .Values.kubernetesCluster.enableAutomaticPrometheusEmitterCollection }}" + ENABLE_AUTOMATIC_PROMETHEUS_DETECTION: "{{ .Values.kubernetesCluster.enableAutomaticPrometheusDetection }}" diff --git a/charts/mgmt-agent/values.schema.json b/charts/mgmt-agent/values.schema.json index fbbeb5a..bec0244 100644 --- a/charts/mgmt-agent/values.schema.json +++ b/charts/mgmt-agent/values.schema.json @@ -132,7 +132,7 @@ } ] }, - "enableAutomaticPrometheusEmitterCollection": + "enableAutomaticPrometheusDetection": { "type": "boolean" } @@ -140,7 +140,7 @@ "required": [ "namespace", - "enableAutomaticPrometheusEmitterCollection" + "enableAutomaticPrometheusDetection" ] }, "deployment": diff --git a/charts/mgmt-agent/values.yaml b/charts/mgmt-agent/values.yaml index 2ee0f03..3975f31 100644 --- a/charts/mgmt-agent/values.yaml +++ b/charts/mgmt-agent/values.yaml @@ -68,8 +68,8 @@ kubernetesCluster: # -- Provide the specific list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics to be collected. overrideAllowMetricsNode: # Setting this to true will automatically enable PrometheusEmitter metrics collection for eligible pods. - # To customize and get more information, refer ./resources/prometheus_scrape_config_readme.md - enableAutomaticPrometheusEmitterCollection: false + # To customize and get more information, refer ./resources/auto_prometheus_collection_readme.md + enableAutomaticPrometheusDetection: false deployment: security: From 21eadf34b9badbf50eee59e03493ec3b5711beeb Mon Sep 17 00:00:00 2001 From: prasebha Date: Thu, 27 Feb 2025 21:18:12 +0530 Subject: [PATCH 09/12] update readme --- charts/mgmt-agent/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/mgmt-agent/README.md b/charts/mgmt-agent/README.md index a677abe..5871a09 100644 --- a/charts/mgmt-agent/README.md +++ b/charts/mgmt-agent/README.md @@ -25,7 +25,7 @@ A Helm chart for collecting Kubernetes Metrics using OCI Management Agent into O | kubernetesCluster.overrideAllowMetricsCluster | string | `nil` | Provide the specific list of comma separated metric names for agent computed metrics to be collected | | kubernetesCluster.overrideAllowMetricsKubelet | string | `nil` | Provide the specific list of comma separated metric names for Kubelet (/api/v1/nodes//proxy/metrics) metrics to be collected | | kubernetesCluster.overrideAllowMetricsNode | string | `nil` | Provide the specific list of comma separated metric names for Node (/api/v1/nodes//proxy/metrics/resource, /api/v1/nodes//proxy/metrics/cadvisor) metrics to be collected | -| kubernetesCluster.enableAutomaticPrometheusEmitterCollection | bool | `false` | Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods | +| kubernetesCluster.enableAutomaticPrometheusDetection | bool | `false` | Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods | | mgmtagent.image.secret | string | `nil` | Image secrets to use for pulling container image (base64 encoded content of ~/.docker/config.json file) | | mgmtagent.image.url | string | `nil` | Replace this value with actual docker image URL for Management Agent | | mgmtagent.installKey | string | `"resources/input.rsp"` | Copy the downloaded Management Agent Install Key file under root helm directory as resources/input.rsp | From 247abcb2113efa62044290979d694928df651937 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 26 May 2025 12:00:27 +0530 Subject: [PATCH 10/12] update docker image to 1.8 --- charts/oci-onm/values.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/charts/oci-onm/values.yaml b/charts/oci-onm/values.yaml index 09f6106..bfac7b0 100644 --- a/charts/oci-onm/values.yaml +++ b/charts/oci-onm/values.yaml @@ -9,7 +9,7 @@ global: # -- OKE OCID for an OKE cluster or an unique ID for other Kubernetes clusters. kubernetesClusterID: # -- Provide a unique name for the cluster. This would help uniquely identifying the logs and metrics data at OCI Logging Analytics and OCI Monitoring respectivelt, when moitoring multiple clustersa - kubernetesClusterName: + kubernetesClusterName: k8s_test_inventory oci-onm-common: # -- By default, a cluster role, cluster role binding and serviceaccount will be created for the monitoring pods to be able to (readonly) access various objects within the cluster, to support collection of various telemetry data. You may set this to false and provide your own serviceaccount which has the necessary cluster role(s) binded to it. Refer, README for the cluster role definition and other details. @@ -24,6 +24,7 @@ oci-onm-common: serviceAccount: "{{ .Values.global.resourceNamePrefix }}" oci-onm-logan: + enabled: false oci-onm-common: enabled: false namespace: "{{ .Values.global.namespace }}" @@ -56,6 +57,6 @@ oci-onm-mgmt-agent: # Follow steps documented at https://github.com/oracle/docker-images/tree/main/OracleManagementAgent to build docker image. image: # Replace this value with actual docker image URL for Management Agent - url: container-registry.oracle.com/oci_observability_management/oci-management-agent:1.6.0 + url: container-registry.oracle.com/oci_observability_management/oci-management-agent:1.8.0 # Image secrets to use for pulling container image (base64 encoded content of ~/.docker/config.json file) secret: From f8ee64aae116c8c5b419c9ac5ddd437943956d99 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 26 May 2025 12:05:14 +0530 Subject: [PATCH 11/12] update readme --- .../mgmt-agent/resources/auto_prometheus_collection_readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md b/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md index 4ba7cd2..e96fd0a 100644 --- a/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md +++ b/charts/mgmt-agent/resources/auto_prometheus_collection_readme.md @@ -1,5 +1,5 @@ # 1. Introduction -Automatic Prometheus collection is a feature that allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the Prometheus configuration to collect metrics. +Automatic Prometheus collection allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the Prometheus configuration to collect metrics. # 2. Identification of metric collection configuration From 73b4162a62fad66f942a85202f71ec9a8b485409 Mon Sep 17 00:00:00 2001 From: prasebha Date: Mon, 26 May 2025 12:07:36 +0530 Subject: [PATCH 12/12] clean up --- charts/oci-onm/values.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/oci-onm/values.yaml b/charts/oci-onm/values.yaml index 9a7d2c6..74194e4 100644 --- a/charts/oci-onm/values.yaml +++ b/charts/oci-onm/values.yaml @@ -9,7 +9,7 @@ global: # -- OKE OCID for an OKE cluster or an unique ID for other Kubernetes clusters. kubernetesClusterID: # -- Provide a unique name for the cluster. This would help uniquely identifying the logs and metrics data at OCI Logging Analytics and OCI Monitoring respectivelt, when moitoring multiple clustersa - kubernetesClusterName: k8s_test_inventory + kubernetesClusterName: oci-onm-common: # -- By default, a cluster role, cluster role binding and serviceaccount will be created for the monitoring pods to be able to (readonly) access various objects within the cluster, to support collection of various telemetry data. You may set this to false and provide your own serviceaccount which has the necessary cluster role(s) binded to it. Refer, README for the cluster role definition and other details. @@ -24,7 +24,6 @@ oci-onm-common: serviceAccount: "{{ .Values.global.resourceNamePrefix }}" oci-onm-logan: - enabled: false oci-onm-common: enabled: false namespace: "{{ .Values.global.namespace }}"