mssql_exporter icon indicating copy to clipboard operation
mssql_exporter copied to clipboard

Prometheus Error - invalid metric type "GAUGE"

Open avalenti opened this issue 4 years ago • 4 comments

I have Prometheus setup in a test environment connecting to a few servers for various exporters and they are working fine. I have node exporter, wmi exporter, mysql exporter and I just added the mssql exporter. For the mssql exporter, I am getting this error in Prometheus - invalid metric type "GAUGE".

Thanks, Anthony

avalenti avatar Mar 04 '20 18:03 avalenti

When I view the http://localhost/metrics URL, it looks like this:

# TYPE mssql_up GAUGE
mssql_up 0
# HELP mssql_timeouts Number of queries timing out.
# TYPE mssql_timeouts GAUGE
mssql_timeouts 0
# HELP mssql_exceptions Number of queries throwing exceptions.
# TYPE mssql_exceptions GAUGE
mssql_exceptions 3
# HELP mssql_process_status Counts the number of processes per status
# TYPE mssql_process_status GAUGE
# HELP mssql_deadlocks mssql_deadlocks
# TYPE mssql_deadlocks GAUGE
mssql_deadlocks 0```

So the "GAUGE"s are in all caps, while the example that you show on the main page for the project shows them in all lowercase.   How can I change that or how did it get that way?

avalenti avatar Mar 04 '20 21:03 avalenti

@avalenti can you share your metrics.json file? SQL Server Version?

Mario-Hofstaetter avatar Apr 29 '20 15:04 Mario-Hofstaetter

The SQL version is 13.0.5698.0 (2016)

The metrics.json is: { "Queries": [ { "Name": "mssql_process_status", "Query": "SELECT status, COUNT(*) count FROM sys.sysprocesses GROUP BY status", "Description": "Counts the number of processes per status", "Usage": "GaugesWithLabels", "Columns": [ { "Name": "status", "Label": "status", "Usage": "GaugeLabel", "Order": 0 }, { "Name": "count", "Label": "count", "Usage": "Gauge" } ] }, { "Name": "mssql_deadlocks", "Query": "SELECT cntr_value FROM sys.dm_os_performance_counters where counter_name = 'Number of Deadlocks/sec' AND instance_name = '_Total'", "Description": "Number of lock requests per second that resulted in a deadlock since last restart", "Columns": [ { "Name": "cntr_value", "Label": "mssql_deadlocks", "Usage": "Gauge", "DefaultValue": 0 } ] } ], "MillisecondTimeout": 4000 }

avalenti avatar Apr 29 '20 15:04 avalenti

This gives me gauge in lowercases:

# HELP mssql_deadlocks mssql_deadlocks
# TYPE mssql_deadlocks gauge
mssql_deadlocks 0
# HELP mssql_exceptions Number of queries throwing exceptions.
# TYPE mssql_exceptions gauge
mssql_exceptions 0
# HELP mssql_process_status Counts the number of processes per status
# TYPE mssql_process_status gauge
mssql_process_status{status="sleeping"} 38
mssql_process_status{status="background"} 24
mssql_process_status{status="runnable"} 2
# HELP mssql_up mssql_up
# TYPE mssql_up gauge
mssql_up 1
# HELP mssql_timeouts Number of queries timing out.
# TYPE mssql_timeouts gauge
mssql_timeouts 0

Running mssql_exporter v0.4.7 with .NET Core 3.1.201 with Microsoft SQL Server 2019 (RTM-GDR) (KB4517790) - 15.0.2070.41 (X64) Oct 28 2019 19:56:59 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 18363: ) (Hypervisor)

Do you use the latest version? Googling the issue brougth up this: https://github.com/prometheus-net/prometheus-net/issues/96 Which should be long fixed.

Mario-Hofstaetter avatar Apr 29 '20 16:04 Mario-Hofstaetter