Extending Monitoring Configuration with Custom Data Points
Prometheus clients offer the flexibility to process multiple configuration files. This allows you to add custom data points and extend the default monitoring scope. Take advantage of this feature by creating a separate file containing your tailored data points. The next example showcases how to implement this by adding a new file and publishing a single data point to the Prometheus server.
Steps
-
Create a Custom Metrics File: Inside your project, create a file named
customMetrics.yaml
(or similar) within a suitable directory (e.g., data/metrics).Note: The PromClient searches in all folders defined in your projectconfig
file. -
Define Your Custom Metric: Edit
customMetrics.yaml
with the following YAML snippet:globalVariables: defaultLabels: metricObjects: CustomValue: help: Custom metric value type: Gauge labelNames: - type metricData: - objectType: CustomValue value: !dpGet dpId: ExampleDP_Arg1.:_original.._value labels: type: "Custom Value" function: set
This creates a metric named
CustomValue
of typeGauge
with a single labeltype
. Data for this metric comes from thedpGet
method, referencingExampleDP_Arg1
data point. Theset
function ensures the gauge reflects the latest value. This metric inherits default labels from the parent configuration. -
Configure Prometheus Client: Modify your Prometheus client progs to include both configuration files:
promClient.js -f metrics/defaultMetrics.yaml -f data/metrics/customMetrics.yaml
- Start the Client and Monitor: Start your Prometheus client. The newly defined
CustomValue
metric will now appear alongside default metrics in the Prometheus server.Note: Note that Prometheus health reporting is not a replacement for proper value archiving. The poll rate for obtaining health metrics is typically set very low, and the number of archived data points is also low. Despite these limitations, the feature has been tested and confirmed to work within the expected performance limits, supporting up to 10,000 unique configured DPEs being reported from the WinCC OA system.