Open hristodragolovbede opened 5 years ago
@debfx Are we missing some distinguishing labels?
@hristodragolovbede Do you also have a targets section in your config? At least that's the error you would get when you try to gather metrics for the same resource through targets and resource_groups.
No, there is nothing in the targets section. Config file is populated only with the config described above (including authentication stuff)
I added a regex to include specific databases by using resource_name_include_re: It worked. But if you specify a regex matching everything it fails again with the same error.
I tried few more things:
Hi hristodragolovbede: Did you resolve the issue? Were you able to monitor more than one SQL Server as PaaS in the same Resource Group? If so, how did you solve it? I have the same issue, 3 SQL Servers in the same RG but only one can be monitored. The same issue for App Services
Hi hristodragolovbede: Did you resolve the issue? Were you able to monitor more than one SQL Server as PaaS in the same Resource Group? If so, how did you solve it? I have the same issue, 3 SQL Servers in the same RG but only one can be monitored. The same issue for App Services
No, I didn't find a solution unfortunately.
Were you able to monitor more than one SQL Database with targets instead of Resource Groups? If so, could you paste the code? I´ve tried both but no luck
I´ve configured the monitor of three instances with Azure Grafana plugin and it works, so I suppose that is exporter issue. Someone could help me with this? I´ve not able to do it neither resource_group nor target.
Same issue here. I can confirm, it works if I add "resource_name_include_re" with my databases name as value. But doesn't work with a regex value which match everything. Does the problem could not be related to the metric label "resource_name" with the value of the SQL Server and not the SQL server database? As one SQL Server can have one or more SQL databases. Don't really know...
Hi mboret: Can you monitor all the SQL Databases using resource_name_include_re one by one? Not server but SQL Database name? I will try it but I think that I tried it but no luck
@chaconcin No it doesn't work. When I've only one database it works , but adding another one generates exporter errors. I think this confirms what I've supposed, database metrics are stored with the sql server name as resource_name label. So with one database it works but with more than one it fails as the metric already exist.
@debfx
The problem seems in the utils.go:
func CreateResourceLabels(resourceID string) map[string]string {
labels := make(map[string]string)
labels["resource_group"] = strings.Split(resourceID, "/")[4]
labels["resource_name"] = strings.Split(resourceID, "/")[8]
return labels
}
For a DB SQL database the resourceID is:
/subscriptions/XXXX-XXXXX-XXXXX-XXXXX-XXXXX/resourceGroups/rg-test/providers/Microsoft.Sql/servers/test-sql-server/databases/test-database-a/providers/microsoft.Insights
And for a app service site the resourceID is:
/subscriptions/XXXX-XXXXX-XXXXX-XXXXX-XXXXX/resourceGroups/rg-test/providers/Microsoft.Web/sites/test-backend/providers/microsoft.Insights
For the SQL DB, the "resource_name" is always the SQL server name and not the database name. Maybe we can solve the issue by adding another label:
func CreateResourceLabels(resourceID string) map[string]string {
labels := make(map[string]string)
labels["resource_group"] = strings.Split(resourceID, "/")[4]
labels["resource_name"] = strings.Split(resourceID, "/")[8]
if len(strings.Split(resourceID, "/")) > 13 {
labels["sub_resource_name"] = strings.Split(resourceID, "/")[10]
}
return labels
}
I'm trying to get database metrics using resource group filtering which was added recently. Targeting the database directly using the following resource:
/resourceGroups/SOMERG/providers/Microsoft.Sql/servers/SERVER/databases/DATABASE
works fine but when I try retrieving the metrics with resource group filtering it fails with: collected metric storage_percent_percent_total label: label: gauge: was collected before with the same name and label values
I'm using the following configuration:
resource_groups:
I wasn't sure what the resource_types should be and tried specifying different combinations but none was displaying anything except this one.