Custom Metrics Development
The following two methods are supported for developing custom metrics.
-
Developing custom metrics using a file
You create a custom metrics file that meets the requirements based on the Custom Metrics File. When starting NPU Exporter, configure the
-textMetricsFilePathparameter to specify the path to this custom metrics file. For details, see NPU Exporter Startup Parameters. NPU Exporter reads the custom metrics file in each data collection cycle and reports the file content to Prometheus or Telegraf.The development example is as follows:
Use NPU Exporter to integrate and collect the
hccs_bandwidthmetric generated by the Devkit tool. For details, see NPU Exporter Integration with Devkit Deployment Guide. For an explanation of thehccs_bandwidthmetric information, see HCCS Bandwidth Monitoring. -
Developing custom metrics using a plugin
You can customize metrics by writing a plugin. Before using the plugin, learn and understand the language features of cgo and Go, and read the README to understand the usage method.
Note
- Custom metrics must not have the same name as existing metrics.
- You are responsible for the stability of custom plugins, ensuring that issues such as runtime panics are not introduced.
- You are responsible for the correctness of the custom metric file format.