sum(argocd_app_info{dest_namespace=~"<your_defined_namespace>",health_status!=""}) by (health_status) (1)
By default, the Red Hat OpenShift GitOps Operator automatically detects an installed Argo CD instance in your defined namespace, for example, openshift-gitops
, and connects it to the monitoring stack of the cluster to provide alerts for out-of-sync applications.
You have access to the cluster with cluster-admin
privileges.
You have access to the OpenShift Container Platform web console.
You have installed the Red Hat OpenShift GitOps Operator in your cluster.
You have installed an Argo CD application in your defined namespace, for example, openshift-gitops
.
You can monitor the health status of an Argo CD application by running Prometheus metrics queries against it.
In the Developer perspective of the web console, select the namespace where your Argo CD application is installed, and navigate to Observe → Metrics.
From the Select query drop-down list, select Custom query.
To check the health status of your Argo CD application, enter the Prometheus Query Language (PromQL) query similar to the following example in the Expression field:
sum(argocd_app_info{dest_namespace=~"<your_defined_namespace>",health_status!=""}) by (health_status) (1)
1 | Replace the <your_defined_namespace> variable with the actual name of your defined namespace, for example openshift-gitops . |
By default, the Red Hat OpenShift GitOps Operator automatically scrapes metrics for all Argo CD instances to measure the performance. As a result, the Operator creates the following resources and label to the namespace where the Argo CD instance is installed:
gitops-operator-argocd-alerts
prometheus rule
<argocd_namespace>-read
role
<argocd_name>
, <argocd_name>-repo-server
, and <argocd_name>-server
service monitors
<argocd_namespace>-prometheus-k8s-read-binding
role binding
openshift.io/cluster-monitoring=true
label
Scraping metrics for multiple Argo CD instances in a cluster might result in excessive storage usage. As a preventive measure, use the web console’s YAML view and configure the ArgoCD
custom resource (CR) to disable the automatic scraping of metrics for your Argo CD instance.
As a cluster administrator, by disabling metric scraping for individual instances, you can give your users better control, flexibility, and stability to manage their defined namespaces.
Log in to the OpenShift Container Platform web console.
In the Administrator perspective of the web console, click Operators → Installed Operators.
From the Project list, select the project where the user-defined Argo CD instance is installed.
Select Red Hat OpenShift GitOps from the installed Operators list and go to the Argo CD tab.
Click your user-defined Argo CD instance.
Configure the ArgoCD
CR of your user-defined Argo CD instance to disable the automatic scraping of metrics:
Click the YAML tab and edit the YAML file of the ArgoCD
CR.
In the ArgoCD
CR, set the spec.monitoring.disableMetrics
field value to true
:
ArgoCD
CRapiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
name: example (1)
namespace: spring-petclinic (2)
spec:
monitoring:
disableMetrics: true
1 | The name of the user-defined Argo CD instance. |
2 | The namespace where you want to run the user-defined Argo CD instance. |
Alternatively, use the following command to disable the automatic scraping of metrics in the Red Hat OpenShift GitOps Example command
Example output
|
Verify that the Operator adds the openshift.io/cluster-monitoring=false
label to your defined namespace:
Go to Administration → Namespaces.
The Namespaces page displays the created namespaces.
Click your defined namespace, go to the YAML tab, and verify that under the metadata.labels
section, the openshift.io/cluster-monitoring=false
label is added by the Operator.
Verify that the Operator deletes the following resources from your defined namespace:
Go to Home → Search.
From the Resources list, select PrometheusRule, Role, RoleBinding, and ServiceMonitors.
The Search page displays the selected resources.
In the Search page, verify that under the PrometheusRule section, the gitops-operator-argocd-alerts
prometheus rule is removed.
Under the Roles section, from the Filter list, select Namespace Roles.
Verify that the <argocd_namespace>-read
role is removed.
Under the RoleBindings section, from the Filter list, select Namespace RoleBindings.
Verify that the <argocd_namespace>-prometheus-k8s-read-binding
role binding is removed.
Verify that under the ServiceMonitors section, the <argocd_name>
, <argocd_name>-repo-server
, and <argocd_name>-server
service monitors are removed.
You can enable the metrics for your instance by modifying the |