Monitoring the PostgreSQL datastore for Watson Speech services
You can enable monitoring of the PostgreSQL datastore to receive updates on its usage and status by the Watson Speech services. The events can be consumed by Prometheus monitoring software or whatever application you use for monitoring.
- Permissions you need for these tasks:
- You must have login credentials for the cluster.
Monitoring the PostgreSQL datastore
By enabling monitoring for user-defined projects in addition to the default platform monitoring, you can monitor your own projects with the Red Hat® OpenShift® Container Platform monitoring stack.
Set the property
spec.global.datastores.postgressql.enablePodMonitortotruein the Speech services custom resource. This causes the Speech operator to set the propertyspec.monitoring.enablePodMonitortotruein the PostgreSQL custom resource. The PostgreSQL operator creates aPodMonitorobject that watches the PostgreSQL pods for metrics and makes them available to the Red Hat OpenShift Container Platform monitoring stackoc patch watsonspeech ${CUSTOM_RESOURCE_SPEECH} --type='json' \ -p='[{"op": "add", "path": "/spec/global", "value":{"datastores":{"postgressql":{"enablePodMonitor": "true"}}}}]'Create the
cluster-monitoring-configconfigmap and setenableUserWorkloadtotrueunderdata/config.yaml. (If the configmap already exists, this command overwrites it.) When set totrue, theenableUserWorkloadparameter enables monitoring for user-defined projects in a cluster.cat << EOF | oc apply -f - apiVersion: v1 kind: ConfigMap metadata: name: cluster-monitoring-config namespace: openshift-monitoring data: config.yaml: | enableUserWorkload: true EOFSet
openshift.io/user-monitoringtotruefor the IBM Cloud Pak for Data project (namespace). This enables user monitoring when the Network Policy is created.oc label namespace ${PROJECT_CPD_INST_OPERANDS} openshift.io/user-monitoring=trueCreate a Network Policy to allow Prometheus to monitor the
PodMonitorresource in the instance namespace. This allows the project to accept connections from the Red Hat OpenShift Container Platform monitoring stack.cat << EOF | oc apply -f - kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: allow-from-openshift-monitoring namespace: ${PROJECT_CPD_INST_OPERANDS} spec: ingress: - from: - namespaceSelector: matchLabels: network.openshift.io/policy-group: monitoring podSelector: {} policyTypes: - Ingress EOFEnsure that you can see the PostgreSQL metrics from your monitoring stack. For a list of predefined metrics that are exposed by PostgreSQL and for information about how to define your own metrics, see Monitoring in the EDB PostgreSQL for Kubernetes documentation.