Custom metrics configuration for NetScaler CPX using ConfigMap
schema.json and reference_schema.json) that include CPX.
/var/metrics_conf directory. If you mount a ConfigMap at /cpx/custom_metrics_conf, CPX validates each JSON file and copies valid files into /var/metrics_conf alongside the defaults.
-
Custom JSON files must contain valid JSON. Invalid files are skipped during startup, and an error is logged in
boot.log. -
Default files (
schema.json,reference_schema.json) are always placed first. -
Custom files with the same name as a default file override the default file.
Configure custom metrics
To configure by using the CLI
{
"counter": "http_requests_total",
"label": "method",
"description": "Total HTTP requests by method"
}
kubectl create configmap command. For example, to create a ConfigMap named custom-metrics-conf based on the configuration file custom_schema.json:
kubectl create configmap custom-metrics-conf --from-file=custom_schema.json=./custom_schema.json
kubectl get configmap command.
kubectl get configmap custom-metrics-conf -o yaml
apiVersion: v1
data:
custom_schema.json: |
{
"counter": "http_requests_total",
"label": "method",
"description": "Total HTTP requests by method"
}
kind: ConfigMap
metadata:
creationTimestamp: 2026-05-14T06:26:50Z
name: custom-metrics-conf
namespace: default
resourceVersion: "8865149"
uid: c1c7cb5b-ea05-11e7-914a-926745c10b02
To configure using a YAML file
custom-metrics-conf, in the YAML file used to deploy the NetScaler CPX instance. The following sample configuration shows how to include the ConfigMap in the deployment YAML:
apiVersion: v1
kind: Pod
metadata:
name: cpx-1
labels:
app: cpx-daemon
annotations:
NETSCALER_AS_APP: "True"
spec:
containers:
- name: cpx
image: "quay.io/netscaler/netscaler-cpx:14.1-72.56"
securityContext:
privileged: true
volumeMounts:
- name: config-volume
mountPath: /cpx/bootup_conf
- name: custom-metrics-volume
mountPath: /cpx/custom_metrics_conf
env:
- name: "EULA"
value: "yes"
imagePullPolicy: IfNotPresent
volumes:
- name: config-volume
configMap:
name: cpx-config
- name: custom-metrics-volume
configMap:
name: custom-metrics-conf
schema.json and reference_schema.json) are placed in /var/metrics_conf. The custom JSON files from the ConfigMap mounted at /cpx/custom_metrics_conf are validated and copied into /var/metrics_conf.