Add custom metrics to expose MSSQL server hostname #382
-
I am not sure weather I should call this improvement suggestion or weather this is by design. I am adding the following custom metrics to mssql_standard.collector.yml file. While other custom metrics such as mssql_last_elapsed_time etc are working well, I can't seem to be able to add the following metric to expose database hostname. Below was my first attempt:
Which produced error as it cannot convert string hostname to numeric gauge. Then, I tried other variations and the last that nearly worked was:
Which produced error: I used 1 as a placeholder value, hoping that I can retrieve the hostname by whatever means using PromQL. I am wondering if there is another way to expose servername/hostname on which MSSQL runs to Prometheus. I am unable to find MSSQL metrics that exposes hostname as part of its label or other attributes |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @barywhyte, for this purpose there's a new field As a workaround, I suggest you to construct a query so it returns two columns: the hostname string and some static value. Something like this:
Then you specify |
Beta Was this translation helpful? Give feedback.
Hey @barywhyte, for this purpose there's a new field
static_value
which serves exactly as a placeholder if you just need to extract a string label. This feature is not released yet, but will be available in the upcomingv0.13
.As a workaround, I suggest you to construct a query so it returns two columns: the hostname string and some static value. Something like this:
Then you specify
value
in thevalues
field in the config.