Parameters | Description |
name | Exporter name, which should meet the following requirements: The name should be unique. The name should conform to the following regular expression: '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'. |
user | The username of MSSQL. |
password | The password of MSSQL. |
Host | The service domain name of MSSQL. |
Port | The service port of MSSQL. |
tag | Custom labels for metrics. |
apiVersion: apps/v1kind: Deploymentmetadata:labels:k8s-app: mssql-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the MSSQL instance.name: mssql-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the MSSQL instance.namespace: mssql-demo # Adjust to the corresponding namespace based on business requirements.spec:replicas: 1selector:matchLabels:k8s-app: mssql-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the MSSQL instance.template:metadata:labels:k8s-app: mssql-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the MSSQL instance.spec:containers:- env:- name: SERVERvalue: "127.0.0.1" # Adjust to the corresponding MSSQL domain name based on business requirements.- name: PORTvalue: "1433" # Adjust to the corresponding MSSQL port based on business requirements.- name: USERNAMEvalue: user # Adjust to the corresponding MSSQL username based on business requirements.- name: PASSWORDvalue: "123456" # Adjust to the corresponding MSSQL password based on business requirements.- name: EXPOSEvalue: "4000" # Metrics export port. Adjust to the corresponding port based on business requirements.image: ccr.ccs.tencentyun.com/rig-agent/common-image:mssql-exporter-v1.3.0imagePullPolicy: IfNotPresentname: mssql-exporterports:- containerPort: 4000 # Open the port corresponding to the EXPOSE environment variable specified above.name: metric-portterminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstimagePullSecrets:- name: qcloudregistrykeyrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30
wget -qO- http://localhost:4000/metrics
PodMonitor
via service discovery to define the collection task. The YAML example is as follows:apiVersion: monitoring.coreos.com/v1kind: PodMonitormetadata:name: mssql-exporter # Enter a unique name.namespace: cm-prometheus # Pay-as-you-go instance: Use the namespace of the cluster. Monthly subscription instance (no longer available): The namespace is fixed. Do not change it.spec:podMetricsEndpoints:- interval: 30sport: metric-port # Enter the port of the Prometheus Exporter in the Pod YAML file.path: /metrics # Enter the path of the Prometheus Exporter. Default value: /metrics.relabelings:- action: replacesourceLabels:- instanceregex: (.*)targetLabel: instancereplacement: 'crs-xxxxxx' # Replace with the corresponding MSSQL instance ID.namespaceSelector: # Select the namespace where the MSSQL Exporter pod to be monitored is located.matchNames:- mssql-demoselector: # Enter the labels of the Pod to be monitored to locate the target Pod.matchLabels:k8s-app: mssql-exporter
Name | Description |
SERVER | Required. The service IP or domain name of MSSQL. |
PORT | MSSQL service port. The default port is 1433. |
USERNAME | Required. The service username of MSSQL. |
PASSWORD | Required. The service password of MSSQL. |
ENCRYPT | Enforced encryption setting. The default value is true. |
TRUST_SERVER_CERTIFICATE | Indicates whether to trust the server’s certificate. The default value is true. |
DEBUG | A comma-separated list of enabled logs. Currently supports app and metrics. |
Was this page helpful?