PostgreSQL metrics
Use the predefined PostgreSQL metrics to view information about the number of assembly and resource instances in IBM® Cloud Pak for Network Automation. You can also define custom PostgreSQL metrics to retrieve information such as active counts of Site Planner instance data.
- Predefined PostgreSQL metrics
- The
cp4na-o-postgresql-predefined-monitoring
configmap is deployed automatically and contains the following PostgreSQL metrics. These metrics show active information about the number of assembly and resource instances:Metric Description cnp_assembly_instance_toplevel_count The number of higher-level assemblies in your orchestration instance. cnp_assembly_instance_count The number of assembly instances. cnp_resource_instance_count The number of resource instances. Restriction: Thecp4na-o-postgresql-predefined-monitoring
configmap cannot be modified after installation. - Custom PostgreSQL metrics
- You can define custom PostgreSQL metrics by adding SQL queries to the
cp4na-o-postgresql-custom-monitoring
configmap.Tip:You can add the custom SQL queries anytime and you don't need to restart pods or microservices to activate the metrics.
The following database tables and views can be used when you build your custom queries:- The
v_topologyinstance
view in the cp4na schema. The view includes the following columns:Example values for theColumn Type ID Integer Type String Top_level Boolean Type
column includeASSEMBLYINSTANCE
,CLUSTERINSTANCE
, andRESOURCEINSTANCE
. - If Site Planner is installed, the custom tables that are generated by the Site Planner plug-ins
can be used.
The table names use the following format: <plugin-name>_<model-name>.
Where:- <plugin-name> is the name of your Site Planner plug-in
- <model-name> is the name of your model
For example, if your plug-in that is named
fiveg
adds a model that is namedSliceProfile
, the table is namedfiveg_sliceprofile
.
Add or modify custom metrics by completing the following steps:- Ensure that your instance of IBM Cloud Pak for Network
Automation is in the
Ready
state before you edit the configmap. Run the following command:oc get orchestration -n <cp4na_namespace>
<cp4na_namespace> is the namespace where IBM Cloud Pak for Network Automation is installed.
- Open the configmap for editing by running the following command:
oc edit configmap cp4na-o-postgresql-custom-monitoring -n <cp4na_namespace>
- In the
queries
section of the configmap, add or modify metrics by using the format in the following example metric:cluster_instance: query: | SELECT COUNT(*) AS count FROM cp4na.V_TOPOLOGYINSTANCE WHERE TYPE = 'CLUSTERINSTANCE' metrics: - count: usage: "GAUGE" description: "Number of cluster instances" target_databases: - app
- Save the changes to the configmap.
The new and modified metrics are shown automatically in the Prometheus output. The example metric,
cluster_instance
, is shown in Prometheus ascnp_cluster_instance_count
. - Optional: Verify that the updated metrics are in the configmap by running the following command:
oc get configmap cp4na-o-postgresql-custom-monitoring -o yaml
- The