Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State and Votes columns in SQL dashboard are empty #351

Open
0UserName opened this issue Aug 3, 2019 · 2 comments
Open

State and Votes columns in SQL dashboard are empty #351

0UserName opened this issue Aug 3, 2019 · 2 comments

Comments

@0UserName
Copy link

0UserName commented Aug 3, 2019

I have WSFC clusters with multiple AG as resources. The following snippet is an example of my Opserver configuration:

{
   "defaultConnectionString":"Application Name=opserver;Data Source=$ServerName$;Initial Catalog=master;User ID=USER;Password=PASS",
   "clusters":[
      {
         "name":"P001 Cluster",
         "nodes":[
            {
               "name":"P001-A" # listener 
            },
            {
               "name":"P001-B" # listener 
            },
            {
               "name":"P001-C" # listener 
            }
         ]
      },
      {
         "name":"S001 Cluster",
         "nodes":[
            {
               "name":"S001-A" # listener 
            },
            {
               "name":"S001-B" # listener 
            },
            {
               "name":"S001-C" # listener 
            }
         ]
      }
   ]
}

But with the configuration described, I get the following result:

dashboard

If go deeper into the source code, we will find the following code:

foreach (var m in state.Members)
{
    m.IsLocal = string.Equals(m.MemberName, ServerProperties.Data?.ServerName, StringComparison.InvariantCultureIgnoreCase);
}

Something like that: {{machine}} == {{machine}}+{{instance}}. All elements will have the IsLocal property, evaluated to false.

The MemberName property of the AGClusterMemberInfo class is mapped to the member_name column:

SELECT member_name            MemberName,
       member_type            Type,
       member_state           State,
       number_of_quorum_votes Votes
FROM   sys.dm_hadr_cluster_members;  

Then the following method is called:

public AGClusterMemberInfo AGClusterMember =>
    AGClusterInfo.Data?.Members.Find(c => c.IsLocal) ?? new AGClusterMemberInfo();

If the IsLocal property is false, the default object will be returned - State and Votes columns will are empty on SQL dashboard.


If I change the code above to:

foreach (var m in state.Members)
{
    m.IsLocal = string.Equals(m.MemberName, ServerProperties.Data?.MachineName, StringComparison.InvariantCultureIgnoreCase);
} 

Everything works fine, anyway for my configuration.

dashboard

But I'm not sure about this approach. Maybe I misconfigured Opserver? Or is there really an mistake?

@0UserName 0UserName changed the title State and Batches columns in SQL dashboard are empty State and Votes columns in SQL dashboard are empty Aug 4, 2019
@0UserName
Copy link
Author

0UserName commented Aug 4, 2019

I think using named instances is expected, but using listeners also works, except for showing details by nodes in sql/servers in GetAvailabilityGroups.

@NickCraver, what do you think about using listeners with some limitation? I mean the availability of data only from primary replicas.


I added small changes in PR.

Before:
before_0
before_1
before_2

After:
after_0
after_1
after_2

@0UserName
Copy link
Author

Is it possible get feedback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant