Monitoring Mobile Foundation on Red Hat OpenShift Container Platformimprove this page | report issue
This tutorial outlines how to integrate Prometheus to monitor Mobile Foundation running on Red Hat OpenShift Container Platform.
Mobile Foundation provides monitoring capability by enabling
mpMetrics-2.2 feature to monitor Mobile Foundation components that are instrumented with the MicroProfile metrics API. This helps to monitor the JVM and system level metrics of your Mobile Foundation containers.
The default response formats to
/metrics API request is of text format, which is compatible with Prometheus.
You can enable monitoring of your own services by setting the
techPreviewUserWorkload/enabled flag in the cluster monitoring ConfigMap.
Following are the prerequisites before you begin the process of installing Mobile Foundation instance.
- Make sure you have the
cluster-monitoring-configConfigMap object with the
Complete the following steps to set up the monitoring for Mobile Foundation on OpenShift.
- Start editing the
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
cluster-monitoring-configis not present, then create
cluster-monitoring-config.yamland add the configuration present in step 2 and run the following command to create it.
$ oc create -f cluster-monitoring-config -n openshift-monitoring
- Set the
techPreviewUserWorkloadsetting to true under
apiVersion: v1 kind: ConfigMap metadata: name: cluster-monitoring-config namespace: openshift-monitoring data: config.yaml: | techPreviewUserWorkload: enabled: true
Save the file to apply the changes. Monitoring your own services is enabled automatically.
- Optional: You can check that the
prometheus-user-workloadpods were created.
$ oc -n openshift-user-workload-monitoring get pod NAME READY STATUS RESTARTS AGE prometheus-operator-85bbb7b64d-7jwjd 1/1 Running 0 3m24s prometheus-user-workload-0 5/5 Running 1 3m13sprprometheus-user-workload-1 5/5 Running 1 3m13s
- Create a ServiceMonitor for the Mobile Foundation services.
Create a YAML file called
mf-app-service-monitor.yamlfor the ServiceMonitor configuration. Populate the file with the configuration for creating the ServiceMonitor. ```YAML apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: k8s-app: prometheus-mf-monitor name: prometheus-mf-monitor namespace:
- interval: 30s port: “9080” scheme: http selector: matchLabels: app: ibm-mf-server ```
to the namespace where Mobile Foundation deployments are running.
This configuration makes OpenShift Monitoring scrape the metrics exposed by the service for deployed Mobile Foundation server.
Apply the configuration file to the cluster.
$ oc apply -f mf-app-service-monitor.yaml
Similarly, you can create ServiceMonitor resources for Mobile Foundation Push, Live Update, Analytics and Application Center.
- Check that the ServiceMonitor is running.
$ oc -n <mf-namespace> get servicemonitor NAME AGE prometheus-mf-monitor 44h
Accessing the Mobile Foundation metrics
After you have enabled monitoring for Mobile foundation, you can access the metrics of the service as a cluster administrator, as a developer, or as a user with view permissions for the project.
- Access the Prometheus web console.
- To access the metrics as a cluster administrator, go to the OpenShift Container Platform web console, switch to the Administrator Perspective, and click Monitoring → Metrics.
- To access the metrics as a developer or a user with permissions, go to the OpenShift Container Platform web console, switch to the Developer Perspective, then click Advanced → Metrics. Select the project you want to see the metrics for.
Note: Mobile Foundation metric parameters start with
Some of the metric parameters are listed here.
For more information on User Workload monitoring on OpenShift, see here.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.