From aacc9586655499a9e3ca1cea631f55a0a3eba0cd Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Thu, 14 Nov 2024 19:25:37 +0000 Subject: [PATCH] Add SQL Express Metrics (#18992) --- src/collectors/windows.plugin/perflib-mssql.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/collectors/windows.plugin/perflib-mssql.c b/src/collectors/windows.plugin/perflib-mssql.c index 0abab52817129f..2e960ad4b071a0 100644 --- a/src/collectors/windows.plugin/perflib-mssql.c +++ b/src/collectors/windows.plugin/perflib-mssql.c @@ -7,6 +7,8 @@ #define NETDATA_MAX_INSTANCE_NAME 32 #define NETDATA_MAX_INSTANCE_OBJECT 128 +BOOL is_sqlexpress = FALSE; + enum netdata_mssql_metrics { NETDATA_MSSQL_GENERAL_STATS, NETDATA_MSSQL_SQL_ERRORS, @@ -146,8 +148,11 @@ static void initialize_mssql_objects(struct mssql_instance *p, const char *insta char prefix[NETDATA_MAX_INSTANCE_NAME]; if (!strcmp(instance, "MSSQLSERVER")) { strncpyz(prefix, "SQLServer:", sizeof(prefix) -1); + } else if (!strcmp(instance, "SQLEXPRESS")) { + strncpyz(prefix, "MSSQL$SQLEXPRESS:", sizeof(prefix) -1); } else { - snprintfz(prefix, sizeof(prefix) -1, "MSSQL$:%s:", instance); + char *express = (!is_sqlexpress) ? "" : "SQLEXPRESS" ; + snprintfz(prefix, sizeof(prefix) -1, "MSSQL$%s:%s:", express, instance); } size_t length = strlen(prefix); @@ -287,6 +292,10 @@ static int mssql_fill_dictionary() { if (ret != ERROR_SUCCESS) continue; + if (!strcmp(avalue, "SQLEXPRESS")) { + is_sqlexpress = TRUE; + } + struct mssql_instance *p = dictionary_set(mssql_instances, avalue, NULL, sizeof(*p)); }