Skip to content

Commit

Permalink
Add SQL Express Metrics (netdata#18992)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm authored Nov 14, 2024
1 parent a5238b4 commit aacc958
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/collectors/windows.plugin/perflib-mssql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}

Expand Down

0 comments on commit aacc958

Please sign in to comment.