diff --git a/changelog/content/experimental/unreleased.md b/changelog/content/experimental/unreleased.md
index 4dd1df2aa..3150bea93 100644
--- a/changelog/content/experimental/unreleased.md
+++ b/changelog/content/experimental/unreleased.md
@@ -8,6 +8,16 @@ version:
- {{% tag added %}} Provide scraper for Azure Application Insights ([docs](https://docs.promitor.io/configuration/v2.x/metrics/application-insights)
| [#1239](https://github.com/tomkerkhove/promitor/issues/1239))
+- {{% tag added %}} Provide scraper for Azure Cache for Redis Enterprise ([docs](https://docs.promitor.io/configuration/v2.x/metrics/redis-enterprise-cache)
+ | [#1880](https://github.com/tomkerkhove/promitor/issues/1880))
+- {{% tag added %}} Provide scraper for Azure CDN ([docs](https://docs.promitor.io/configuration/v2.x/metrics/cdn)
+ | [#1664](https://github.com/tomkerkhove/promitor/issues/1664))
+- {{% tag added %}} Provide scraper for Azure Database for MariaDB ([docs](https://docs.promitor.io/configuration/v2.x/metrics/maria-db)
+ | [#1795](https://github.com/tomkerkhove/promitor/issues/1795))
+- {{% tag added %}} Provide scraper for Azure Load Balancer ([docs](https://docs.promitor.io/configuration/v2.x/metrics/load-balancer)
+ | [#1845](https://github.com/tomkerkhove/promitor/issues/1845))
+- {{% tag added %}} Provide scraper for Azure Virtual Network ([docs](https://docs.promitor.io/configuration/v2.x/metrics/virtual-network)
+ | [#1170](https://github.com/tomkerkhove/promitor/issues/1170))
- {{% tag added %}} Provide support for scraping Azure Database for PostgreSQL Flexible & Hyperscale resources ([docs](https://docs.promitor.io/configuration/v2.x/metrics/postgresql)
| [#1870](https://github.com/tomkerkhove/promitor/issues/1870))
- {{% tag added %}} Information concerning .NET & OS in logs on startup
@@ -19,6 +29,16 @@ version:
- {{% tag added %}} Provide scraper for Azure Application Insights ([docs](https://docs.promitor.io/configuration/v2.x/metrics/application-insights)
| [#1239](https://github.com/tomkerkhove/promitor/issues/1239))
+- {{% tag added %}} Provide scraper for Azure Cache for Redis Enterprise ([docs](https://docs.promitor.io/configuration/v2.x/metrics/redis-enterprise-cache)
+ | [#1880](https://github.com/tomkerkhove/promitor/issues/1880))
+- {{% tag added %}} Provide scraper for Azure CDN ([docs](https://docs.promitor.io/configuration/v2.x/metrics/cdn)
+ | [#1664](https://github.com/tomkerkhove/promitor/issues/1664))
+- {{% tag added %}} Provide scraper for Azure Database for MariaDB ([docs](https://docs.promitor.io/configuration/v2.x/metrics/maria-db)
+ | [#1795](https://github.com/tomkerkhove/promitor/issues/1795))
+- {{% tag added %}} Provide scraper for Azure Load Balancer ([docs](https://docs.promitor.io/configuration/v2.x/metrics/load-balancer)
+ | [#1845](https://github.com/tomkerkhove/promitor/issues/1845))
+- {{% tag added %}} Provide scraper for Azure Virtual Network ([docs](https://docs.promitor.io/configuration/v2.x/metrics/virtual-network)
+ | [#1170](https://github.com/tomkerkhove/promitor/issues/1170))
- {{% tag added %}} Provide support for scraping Azure Database for PostgreSQL Flexible & Hyperscale resources ([docs](https://docs.promitor.io/configuration/v2.x/metrics/postgresql)
| [#1870](https://github.com/tomkerkhove/promitor/issues/1870))
- {{% tag added %}} Information concerning .NET & OS in logs on startup
diff --git a/config/promitor/resource-discovery/resource-discovery-declaration.yaml b/config/promitor/resource-discovery/resource-discovery-declaration.yaml
index eec65896c..163163ea1 100644
--- a/config/promitor/resource-discovery/resource-discovery-declaration.yaml
+++ b/config/promitor/resource-discovery/resource-discovery-declaration.yaml
@@ -15,6 +15,8 @@ resourceDiscoveryGroups:
type: AppPlan
- name: automation-accounts
type: AutomationAccount
+- name: cdn-landscape
+ type: Cdn
- name: container-instances
type: ContainerInstance
- name: container-registry-landscape
@@ -35,14 +37,20 @@ resourceDiscoveryGroups:
type: IoTHub
- name: key-vaults
type: KeyVault
+- name: load-balancers
+ type: LoadBalancer
- name: autoscaling-rules
type: MonitorAutoscale
+- name: mariadb-servers
+ type: MariaDb
- name: network-interfaces
type: NetworkInterface
- name: postgres-databases
type: PostgreSql
- name: redis-caches
type: RedisCache
+- name: redis-enterprise-caches
+ type: RedisEnterpriseCache
- name: sql-databases
type: SqlDatabase
- name: sql-managed-instances
@@ -63,6 +71,8 @@ resourceDiscoveryGroups:
type: VirtualMachine
- name: virtual-machine-scale-sets
type: VirtualMachineScaleSet
+- name: virtual-networks
+ type: VirtualNetwork
- name: web-apps-north-europe
type: WebApp
criteria:
diff --git a/config/promitor/scraper/metrics.yaml b/config/promitor/scraper/metrics.yaml
index 637d158d8..9a6ef97a8 100644
--- a/config/promitor/scraper/metrics.yaml
+++ b/config/promitor/scraper/metrics.yaml
@@ -257,6 +257,42 @@ metrics:
# Application Insights with data in Log Analytics
- name: promitor-automation-data-generation-we-telemetry
resourceGroupName: promitor-automation-data-generation
+ - name: promitor_demo_cdn_requests_discovered
+ description: "Amount of requests sent to Azure CDN"
+ resourceType: Cdn
+ azureMetricConfiguration:
+ metricName: RequestCount
+ aggregation:
+ type: Total
+ resourceDiscoveryGroups:
+ - name: cdn-landscape
+ - name: promitor_demo_maria_db_cpu_discovered
+ description: "CPU usage of Maria DB servers"
+ resourceType: MariaDb
+ azureMetricConfiguration:
+ metricName: cpu_percent
+ aggregation:
+ type: Average
+ resourceDiscoveryGroups:
+ - name: mariadb-servers
+ - name: promitor_demo_load_balancers_requests_discovered
+ description: "Amount of bytes sent through the Azure Load Balancer"
+ resourceType: LoadBalancer
+ azureMetricConfiguration:
+ metricName: ByteCount
+ aggregation:
+ type: Total
+ resourceDiscoveryGroups:
+ - name: load-balancers
+ - name: promitor_demo_vnet_ddos_discovered
+ description: "Amount of requests at the origin of our Azure CDN"
+ resourceType: VirtualNetwork
+ azureMetricConfiguration:
+ metricName: IfUnderDDoSAttack
+ aggregation:
+ type: Maximum
+ resourceDiscoveryGroups:
+ - name: virtual-networks
# This uses our large-scale data set containing 1000+ Azure Logic App instances
# Uncomment if you want to test with this scale
# - name: azure_logic_apps_failed_run_discovery
diff --git a/config/promitor/scraper/runtime.yaml b/config/promitor/scraper/runtime.yaml
index ccd2607ce..24015cdc5 100644
--- a/config/promitor/scraper/runtime.yaml
+++ b/config/promitor/scraper/runtime.yaml
@@ -12,11 +12,11 @@ metricSinks:
host: graphite
port: 8125
metricPrefix: promitor.
- atlassianStatuspage:
- pageId: 4mwc0ny6bgw1
- systemMetricMapping:
- - id: 333802sjqpr9
- promitorMetricName: promitor_demo_documentation_availability
+ # atlassianStatuspage:
+ # pageId: 4mwc0ny6bgw1
+ # systemMetricMapping:
+ # - id: 333802sjqpr9
+ # promitorMetricName: promitor_demo_documentation_availability
metricsConfiguration:
absolutePath: /config/metrics-declaration.yaml
telemetry:
diff --git a/docs/configuration/v2.x/metrics/cdn.md b/docs/configuration/v2.x/metrics/cdn.md
new file mode 100644
index 000000000..0dfac7003
--- /dev/null
+++ b/docs/configuration/v2.x/metrics/cdn.md
@@ -0,0 +1,41 @@
+---
+layout: default
+title: Azure Content Delivery Network (CDN) Declaration
+---
+
+## Azure Content Delivery Network (CDN)
+
+![Availability Badge](https://img.shields.io/badge/Available%20Starting-v2.6-green.svg)![Resource Discovery Support Badge](https://img.shields.io/badge/Support%20for%20Resource%20Discovery-Yes-green.svg)
+
+You can declare to scrape an Azure CDN via the `Cdn` resource
+type.
+
+When using declared resources, the following fields need to be provided:
+
+- `cdnName` - The name of the Azure CDN resource
+
+All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftcdnprofiles).
+
+> 🚨 The availability of metrics depends on the SKU of the Azure CDN resource.
+
+Example:
+
+```yaml
+name: azure_cdn_requests
+description: "Amount of requests sent to Azure CDN"
+resourceType: Cdn
+azureMetricConfiguration:
+ metricName: RequestCount
+ aggregation:
+ type: Total
+resources: # Optional, required when no resource discovery is configured
+- cdnName: promitor-cdn-1
+- cdnName: promitor-cdn-2
+resourceDiscoveryGroups: # Optional, requires Promitor Resource Discovery agent (https://promitor.io/concepts/how-it-works#using-resource-discovery)
+- name: cdn-landscape
+```
+
+
+[← back to metrics declarations](/configuration/v2.x/metrics)
+[← back to introduction](/)
+
diff --git a/docs/configuration/v2.x/metrics/index.md b/docs/configuration/v2.x/metrics/index.md
index b3dfb8259..78a242922 100644
--- a/docs/configuration/v2.x/metrics/index.md
+++ b/docs/configuration/v2.x/metrics/index.md
@@ -23,12 +23,15 @@ We also provide a simplified way to scrape the following Azure resources:
- [Azure Application Insights](application-insights)
- [Azure App Plan](app-plan)
- [Azure Cache for Redis](redis-cache)
+- [Azure Cache for Redis Enterprise](redis-enterprise-cache)
+- [Azure Content Delivery Network (CDN)](cdn)
- [Azure Container Instances](container-instances)
- [Azure Container Registry](container-registry)
- [Azure Cosmos DB](cosmos-db)
- [Azure Data Factory](data-factory)
- [Azure Data Share](data-share)
- [Azure Database for PostgreSQL](postgresql)
+- [Azure Database for MariaDB](maria-db)
- [Azure Event Hubs](event-hubs)
- [Azure Express Route Circuit](express-route-circuit)
- [Azure Front Door](front-door)
@@ -37,6 +40,7 @@ We also provide a simplified way to scrape the following Azure resources:
- [Azure IoT Hub Device Provisioning Service (DPS)](iot-hub-device-provisioning-service)
- [Azure Key Vault](key-vault)
- [Azure Kubernetes Service](kubernetes)
+- [Azure Load Balancer](load-balancer)
- [Azure Logic Apps](logic-apps)
- [Azure Monitor Autoscale](monitor-autoscale)
- [Azure Network Gateway](network-gateway)
@@ -55,6 +59,7 @@ We also provide a simplified way to scrape the following Azure resources:
- [Azure Synapse (Workspace)](synapse-workspace)
- [Azure Virtual Machine](virtual-machine)
- [Azure Virtual Machine Scale Set (VMSS)](virtual-machine-scale-set)
+- [Azure Virtual Network](virtual-network)
- [Azure Web App](web-app)
Want to help out? Create an issue and [contribute a new scraper](https://github.com/tomkerkhove/promitor/blob/master/adding-a-new-scraper.md).
diff --git a/docs/configuration/v2.x/metrics/load-balancer.md b/docs/configuration/v2.x/metrics/load-balancer.md
new file mode 100644
index 000000000..6ec3246d7
--- /dev/null
+++ b/docs/configuration/v2.x/metrics/load-balancer.md
@@ -0,0 +1,39 @@
+---
+layout: default
+title: Azure Load Balancer Declaration
+---
+
+## Azure Load Balancer
+
+![Availability Badge](https://img.shields.io/badge/Available%20Starting-v2.6-green.svg)![Resource Discovery Support Badge](https://img.shields.io/badge/Support%20for%20Resource%20Discovery-Yes-green.svg)
+
+You can declare to scrape an Azure Load Balancer via the `LoadBalancer` resource
+type.
+
+When using declared resources, the following fields need to be provided:
+
+- `loadBalancerName` - The name of the Azure Load Balancer resource
+
+All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftnetworkloadbalancers).
+
+Example:
+
+```yaml
+name: azure_load_balancer_traffic_bytes
+description: "Average amount of bytes sent through an Azure Load Balancer"
+resourceType: LoadBalancer
+azureMetricConfiguration:
+ metricName: ByteCount
+ aggregation:
+ type: Average
+resources: # Optional, required when no resource discovery is configured
+- loadBalancerName: promitor-load-balancer-1
+- loadBalancerName: promitor-load-balancer-2
+resourceDiscoveryGroups: # Optional, requires Promitor Resource Discovery agent (https://promitor.io/concepts/how-it-works#using-resource-discovery)
+- name: load-balancer-landscape
+```
+
+
+[← back to metrics declarations](/configuration/v2.x/metrics)
+[← back to introduction](/)
+
diff --git a/docs/configuration/v2.x/metrics/maria-db.md b/docs/configuration/v2.x/metrics/maria-db.md
new file mode 100644
index 000000000..6a8a3bcf3
--- /dev/null
+++ b/docs/configuration/v2.x/metrics/maria-db.md
@@ -0,0 +1,39 @@
+---
+layout: default
+title: Azure Database for MariaDB Declaration
+---
+
+## Azure Database for MariaDB
+
+![Availability Badge](https://img.shields.io/badge/Available%20Starting-v2.6-green.svg)![Resource Discovery Support Badge](https://img.shields.io/badge/Support%20for%20Resource%20Discovery-Yes-green.svg)
+
+You can declare to scrape an Azure Database for MariaDB via the `MariaDb` resource
+type.
+
+When using declared resources, the following fields need to be provided:
+
+- `serverName` - The name of the Azure Database for MariaDB server
+
+All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftdbformariadbservers).
+
+Example:
+
+```yaml
+name: azure_db_mariadb_percentage_cpu
+description: "Average percentage cpu usage on an Azure Database for MariaDB"
+resourceType: MariaDb
+azureMetricConfiguration:
+ metricName: cpu_percent
+ aggregation:
+ type: Average
+resources: # Optional, required when no resource discovery is configured
+- serverName: promitor-maria-db-1
+- serverName: promitor-maria-db-2
+resourceDiscoveryGroups: # Optional, requires Promitor Resource Discovery agent (https://promitor.io/concepts/how-it-works#using-resource-discovery)
+- name: maria-db-landscape
+```
+
+
+[← back to metrics declarations](/configuration/v2.x/metrics)
+[← back to introduction](/)
+
diff --git a/docs/configuration/v2.x/metrics/redis-enterprise-cache.md b/docs/configuration/v2.x/metrics/redis-enterprise-cache.md
new file mode 100644
index 000000000..ed5c95e1c
--- /dev/null
+++ b/docs/configuration/v2.x/metrics/redis-enterprise-cache.md
@@ -0,0 +1,39 @@
+---
+layout: default
+title: Azure Cache for Redis Enterprise Declaration
+---
+
+## Azure Cache for Redis Enterprise
+
+![Availability Badge](https://img.shields.io/badge/Available%20Starting-v2.6-green.svg)![Resource Discovery Support Badge](https://img.shields.io/badge/Support%20for%20Resource%20Discovery-Yes-green.svg)
+
+You can declare to scrape an Azure Cache for Redis Enterprise via the `RedisEnterpriseCache` resource
+type.
+
+When using declared resources, the following fields need to be provided:
+
+- `cacheName` - The name of the Azure Cache for Redis Enterprise resource
+
+All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftcacheredisenterprise).
+
+Example:
+
+```yaml
+name: azure_cache_redis_enterprise_percentage_cpu
+description: "Average percentage cpu usage on an Azure Cache for Redis Enterprise"
+resourceType: RedisEnterpriseCache
+azureMetricConfiguration:
+ metricName: usedmemorypercentage
+ aggregation:
+ type: Average
+resources: # Optional, required when no resource discovery is configured
+- cacheName: promitor-redis-enterprise-cache-1
+- cacheName: promitor-redis-enterprise-cache-2
+resourceDiscoveryGroups: # Optional, requires Promitor Resource Discovery agent (https://promitor.io/concepts/how-it-works#using-resource-discovery)
+- name: redis-enterprise-cache-landscape
+```
+
+
+[← back to metrics declarations](/configuration/v2.x/metrics)
+[← back to introduction](/)
+
diff --git a/docs/configuration/v2.x/metrics/virtual-network.md b/docs/configuration/v2.x/metrics/virtual-network.md
new file mode 100644
index 000000000..8209bc8ab
--- /dev/null
+++ b/docs/configuration/v2.x/metrics/virtual-network.md
@@ -0,0 +1,39 @@
+---
+layout: default
+title: Azure Virtual Network Declaration
+---
+
+## Azure Virtual Network
+
+![Availability Badge](https://img.shields.io/badge/Available%20Starting-v2.6-green.svg)![Resource Discovery Support Badge](https://img.shields.io/badge/Support%20for%20Resource%20Discovery-Yes-green.svg)
+
+You can declare to scrape an Azure Virtual Network via the `VirtualNetwork` resource
+type.
+
+When using declared resources, the following fields need to be provided:
+
+- `virtualNetworkName` - The name of the Azure Virtual Network resource
+
+All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftnetworkvirtualnetworks).
+
+Example:
+
+```yaml
+name: azure_virtual_network_ddos_attack
+description: "Indication whether or not there is a DDOS attack on the Azure Virtual Network"
+resourceType: VirtualNetwork
+azureMetricConfiguration:
+ metricName: IfUnderDDoSAttack
+ aggregation:
+ type: Maximum
+resources: # Optional, required when no resource discovery is configured
+- virtualNetworkName: promitor-virtual-network-1
+- virtualNetworkName: promitor-virtual-network-2
+resourceDiscoveryGroups: # Optional, requires Promitor Resource Discovery agent (https://promitor.io/concepts/how-it-works#using-resource-discovery)
+- name: virtual-network-landscape
+```
+
+
+[← back to metrics declarations](/configuration/v2.x/metrics)
+[← back to introduction](/)
+
diff --git a/docs/configuration/v2.x/resource-discovery.md b/docs/configuration/v2.x/resource-discovery.md
index f5e9b0316..7e0e13e4d 100644
--- a/docs/configuration/v2.x/resource-discovery.md
+++ b/docs/configuration/v2.x/resource-discovery.md
@@ -93,12 +93,15 @@ Dynamic resource discovery is supported for the following scrapers:
- [Azure App Plan](metrics/app-plan)
- [Azure Automation](metrics/automation-account)
- [Azure Cache for Redis](metrics/redis-cache)
+- [Azure Cache for Redis Enterprise](metrics/redis-enterprise-cache)
+- [Azure Content Delivery Network (CDN)](metrics/cdn)
- [Azure Container Instances](metrics/container-instances)
- [Azure Container Registry](metrics/container-registry)
- [Azure Cosmos DB](metrics/cosmos-db)
- [Azure Data Factory](metrics/data-factory)
- [Azure Data Share](metrics/data-share)
- [Azure Database for PostgreSQL](metrics/postgresql)
+- [Azure Database for MariaDB](metrics/maria-db)
- [Azure Event Hubs](metrics/event-hubs)
- [Azure Express Route Circuit](metrics/express-route-circuit)
- [Azure Front Door](metrics/front-door)
@@ -107,6 +110,7 @@ Dynamic resource discovery is supported for the following scrapers:
- [Azure IoT Hub Device Provisioning Service (DPS)](metrics/iot-hub-device-provisioning-service)
- [Azure Key Vault](metrics/key-vault)
- [Azure Kubernetes Service](metrics/kubernetes)
+- [Azure Load Balancer](metrics/load-balancer)
- [Azure Logic Apps](metrics/logic-apps)
- [Azure Monitor Autoscale](metrics/monitor-autoscale)
- [Azure Network Gateway](metrics/network-gateway)
@@ -121,6 +125,7 @@ Dynamic resource discovery is supported for the following scrapers:
- [Azure Synapse (Workspace)](metrics/synapse-workspace)
- [Azure Virtual Machine](metrics/virtual-machine)
- [Azure Virtual Machine Scale Set (VMSS)](metrics/virtual-machine-scale-set)
+- [Azure Virtual Network](metrics/virtual-network)
- [Azure Web App](metrics/web-app)
[← back](/)
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceDiscoveryFactory.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceDiscoveryFactory.cs
index eaad9012a..8602d78ab 100644
--- a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceDiscoveryFactory.cs
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceDiscoveryFactory.cs
@@ -20,8 +20,8 @@ public static ResourceDiscoveryQuery UseResourceDiscoveryFor(ResourceType resour
return new AppPlanDiscoveryQuery();
case ResourceType.AutomationAccount:
return new AutomationAccountResourceDiscoveryQuery();
- case ResourceType.ContainerInstance:
- return new ContainerInstanceDiscoveryQuery();
+ case ResourceType.Cdn:
+ return new CdnDiscoveryQuery();
case ResourceType.ContainerRegistry:
return new ContainerRegistryDiscoveryQuery();
case ResourceType.CosmosDb:
@@ -46,8 +46,12 @@ public static ResourceDiscoveryQuery UseResourceDiscoveryFor(ResourceType resour
return new KeyVaultDiscoveryQuery();
case ResourceType.KubernetesService:
return new KubernetesServiceDiscoveryQuery();
+ case ResourceType.LoadBalancer:
+ return new LoadBalancerDiscoveryQuery();
case ResourceType.LogicApp:
return new LogicAppDiscoveryQuery();
+ case ResourceType.MariaDb:
+ return new MariaDbDiscoveryQuery();
case ResourceType.MonitorAutoscale:
return new MonitorAutoscaleDiscoveryQuery();
case ResourceType.NetworkGateway:
@@ -56,6 +60,8 @@ public static ResourceDiscoveryQuery UseResourceDiscoveryFor(ResourceType resour
return new NetworkInterfaceDiscoveryQuery();
case ResourceType.RedisCache:
return new RedisCacheDiscoveryQuery();
+ case ResourceType.RedisEnterpriseCache:
+ return new RedisEnterpriseCacheDiscoveryQuery();
case ResourceType.PostgreSql:
return new PostgreSqlDiscoveryQuery();
case ResourceType.ServiceBusNamespace:
@@ -78,6 +84,8 @@ public static ResourceDiscoveryQuery UseResourceDiscoveryFor(ResourceType resour
return new VirtualMachineDiscoveryQuery();
case ResourceType.VirtualMachineScaleSet:
return new VirtualMachineScaleSetDiscoveryQuery();
+ case ResourceType.VirtualNetwork:
+ return new VirtualNetworkDiscoveryQuery();
case ResourceType.WebApp:
return new WebAppDiscoveryQuery();
default:
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/CdnDiscoveryQuery.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/CdnDiscoveryQuery.cs
new file mode 100644
index 000000000..9979fef19
--- /dev/null
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/CdnDiscoveryQuery.cs
@@ -0,0 +1,22 @@
+using GuardNet;
+using Newtonsoft.Json.Linq;
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.ResourceDiscovery.Graph.ResourceTypes
+{
+ public class CdnDiscoveryQuery : ResourceDiscoveryQuery
+ {
+ public override string[] ResourceTypes => new[] { "microsoft.cdn/profiles" };
+ public override string[] ProjectedFieldNames => new[] { "subscriptionId", "resourceGroup", "name" };
+
+ public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
+ {
+ Guard.NotNull(resultRowEntry, nameof(resultRowEntry));
+
+ var cdnName = resultRowEntry[2]?.ToString();
+ var resource = new CdnResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), cdnName);
+ return resource;
+ }
+ }
+}
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/LoadBalancerDiscoveryQuery.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/LoadBalancerDiscoveryQuery.cs
new file mode 100644
index 000000000..f4741e30f
--- /dev/null
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/LoadBalancerDiscoveryQuery.cs
@@ -0,0 +1,22 @@
+using GuardNet;
+using Newtonsoft.Json.Linq;
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.ResourceDiscovery.Graph.ResourceTypes
+{
+ public class LoadBalancerDiscoveryQuery : ResourceDiscoveryQuery
+ {
+ public override string[] ResourceTypes => new[] { "microsoft.network/loadbalancers" };
+ public override string[] ProjectedFieldNames => new[] { "subscriptionId", "resourceGroup", "name" };
+
+ public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
+ {
+ Guard.NotNull(resultRowEntry, nameof(resultRowEntry));
+
+ var loadBalancerName = resultRowEntry[2]?.ToString();
+ var resource = new LoadBalancerResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), loadBalancerName);
+ return resource;
+ }
+ }
+}
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/MariaDbDiscoveryQuery.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/MariaDbDiscoveryQuery.cs
new file mode 100644
index 000000000..9c1119c1c
--- /dev/null
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/MariaDbDiscoveryQuery.cs
@@ -0,0 +1,22 @@
+using GuardNet;
+using Newtonsoft.Json.Linq;
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.ResourceDiscovery.Graph.ResourceTypes
+{
+ public class MariaDbDiscoveryQuery : ResourceDiscoveryQuery
+ {
+ public override string[] ResourceTypes => new[] { "microsoft.dbformariadb/servers" };
+ public override string[] ProjectedFieldNames => new[] { "subscriptionId", "resourceGroup", "name" };
+
+ public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
+ {
+ Guard.NotNull(resultRowEntry, nameof(resultRowEntry));
+
+ var serverName = resultRowEntry[2]?.ToString();
+ var resource = new MariaDbResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), serverName);
+ return resource;
+ }
+ }
+}
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/RedisEnterpriseCacheDiscoveryQuery.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/RedisEnterpriseCacheDiscoveryQuery.cs
new file mode 100644
index 000000000..01814bfab
--- /dev/null
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/RedisEnterpriseCacheDiscoveryQuery.cs
@@ -0,0 +1,22 @@
+using GuardNet;
+using Newtonsoft.Json.Linq;
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.ResourceDiscovery.Graph.ResourceTypes
+{
+ public class RedisEnterpriseCacheDiscoveryQuery : ResourceDiscoveryQuery
+ {
+ public override string[] ResourceTypes => new[] { "microsoft.cache/redisenterprise" };
+ public override string[] ProjectedFieldNames => new[] { "subscriptionId", "resourceGroup", "name" };
+
+ public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
+ {
+ Guard.NotNull(resultRowEntry, nameof(resultRowEntry));
+
+ var cacheName = resultRowEntry[2]?.ToString();
+ var resource = new RedisEnterpriseCacheResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), cacheName);
+ return resource;
+ }
+ }
+}
diff --git a/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/VirtualNetworkDiscoveryQuery.cs b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/VirtualNetworkDiscoveryQuery.cs
new file mode 100644
index 000000000..b5dabc006
--- /dev/null
+++ b/src/Promitor.Agents.ResourceDiscovery/Graph/ResourceTypes/VirtualNetworkDiscoveryQuery.cs
@@ -0,0 +1,22 @@
+using GuardNet;
+using Newtonsoft.Json.Linq;
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.ResourceDiscovery.Graph.ResourceTypes
+{
+ public class VirtualNetworkDiscoveryQuery : ResourceDiscoveryQuery
+ {
+ public override string[] ResourceTypes => new[] { "microsoft.network/virtualnetworks" };
+ public override string[] ProjectedFieldNames => new[] { "subscriptionId", "resourceGroup", "name" };
+
+ public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
+ {
+ Guard.NotNull(resultRowEntry, nameof(resultRowEntry));
+
+ var virtualNetworkName = resultRowEntry[2]?.ToString();
+ var resource = new VirtualNetworkResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), virtualNetworkName);
+ return resource;
+ }
+ }
+}
diff --git a/src/Promitor.Agents.Scraper/Docs/Open-Api.xml b/src/Promitor.Agents.Scraper/Docs/Open-Api.xml
index 99cab09ee..5456ea92f 100644
--- a/src/Promitor.Agents.Scraper/Docs/Open-Api.xml
+++ b/src/Promitor.Agents.Scraper/Docs/Open-Api.xml
@@ -75,6 +75,14 @@
Metric definition to validate
List of validation errors
+
+
+ Validates objects.
+
+
+
+
+
Validates objects.
diff --git a/src/Promitor.Agents.Scraper/Validation/Factories/MetricValidatorFactory.cs b/src/Promitor.Agents.Scraper/Validation/Factories/MetricValidatorFactory.cs
index 8ef00a096..b22122e81 100644
--- a/src/Promitor.Agents.Scraper/Validation/Factories/MetricValidatorFactory.cs
+++ b/src/Promitor.Agents.Scraper/Validation/Factories/MetricValidatorFactory.cs
@@ -23,6 +23,8 @@ internal static IMetricValidator GetValidatorFor(ResourceType resourceType)
return new AutomationAccountMetricValidator();
case ResourceType.BlobStorage:
return new BlobStorageMetricValidator();
+ case ResourceType.Cdn:
+ return new CdnMetricValidator();
case ResourceType.ContainerInstance:
return new ContainerInstanceMetricValidator();
case ResourceType.ContainerRegistry:
@@ -53,8 +55,12 @@ internal static IMetricValidator GetValidatorFor(ResourceType resourceType)
return new KeyVaultMetricValidator();
case ResourceType.KubernetesService:
return new KubernetesServiceMetricValidator();
+ case ResourceType.LoadBalancer:
+ return new LoadBalancerMetricValidator();
case ResourceType.LogicApp:
return new LogicAppMetricValidator();
+ case ResourceType.MariaDb:
+ return new MariaDbMetricValidator();
case ResourceType.MonitorAutoscale:
return new MonitorAutoscaleMetricValidator();
case ResourceType.NetworkGateway:
@@ -65,6 +71,8 @@ internal static IMetricValidator GetValidatorFor(ResourceType resourceType)
return new PostgreSqlMetricValidator();
case ResourceType.RedisCache:
return new RedisCacheMetricValidator();
+ case ResourceType.RedisEnterpriseCache:
+ return new RedisEnterpriseCacheMetricValidator();
case ResourceType.ServiceBusNamespace:
return new ServiceBusNamespaceMetricValidator();
case ResourceType.SqlDatabase:
@@ -87,6 +95,8 @@ internal static IMetricValidator GetValidatorFor(ResourceType resourceType)
return new SynapseWorkspaceMetricValidator();
case ResourceType.VirtualMachineScaleSet:
return new VirtualMachineScaleSetMetricValidator();
+ case ResourceType.VirtualNetwork:
+ return new VirtualNetworkMetricValidator();
case ResourceType.VirtualMachine:
return new VirtualMachineMetricValidator();
case ResourceType.WebApp:
diff --git a/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/CdnMetricValidator.cs b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/CdnMetricValidator.cs
new file mode 100644
index 000000000..78077c576
--- /dev/null
+++ b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/CdnMetricValidator.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.Linq;
+using GuardNet;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+using Promitor.Agents.Scraper.Validation.MetricDefinitions.Interfaces;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.Scraper.Validation.MetricDefinitions.ResourceTypes
+{
+ internal class CdnMetricValidator : IMetricValidator
+ {
+ public IEnumerable Validate(MetricDefinition metricDefinition)
+ {
+ Guard.NotNull(metricDefinition, nameof(metricDefinition));
+
+ foreach (var definition in metricDefinition.Resources.Cast())
+ {
+ if (string.IsNullOrWhiteSpace(definition.CdnName))
+ {
+ yield return "No CDN name is configured";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/LoadBalancerMetricValidator.cs b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/LoadBalancerMetricValidator.cs
new file mode 100644
index 000000000..655ecbd24
--- /dev/null
+++ b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/LoadBalancerMetricValidator.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.Linq;
+using GuardNet;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+using Promitor.Agents.Scraper.Validation.MetricDefinitions.Interfaces;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.Scraper.Validation.MetricDefinitions.ResourceTypes
+{
+ internal class LoadBalancerMetricValidator : IMetricValidator
+ {
+ public IEnumerable Validate(MetricDefinition metricDefinition)
+ {
+ Guard.NotNull(metricDefinition, nameof(metricDefinition));
+
+ foreach (var resourceDefinition in metricDefinition.Resources.Cast())
+ {
+ if (string.IsNullOrWhiteSpace(resourceDefinition.LoadBalancerName))
+ {
+ yield return "No load balancer name is configured";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/MariaDbMetricValidator.cs b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/MariaDbMetricValidator.cs
new file mode 100644
index 000000000..4cbe2d41c
--- /dev/null
+++ b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/MariaDbMetricValidator.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.Linq;
+using GuardNet;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+using Promitor.Agents.Scraper.Validation.MetricDefinitions.Interfaces;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.Scraper.Validation.MetricDefinitions.ResourceTypes
+{
+ ///
+ /// Validates objects.
+ ///
+ public class MariaDbMetricValidator : IMetricValidator
+ {
+ ///
+ public IEnumerable Validate(MetricDefinition metricDefinition)
+ {
+ Guard.NotNull(metricDefinition, nameof(metricDefinition));
+
+ foreach (var definition in metricDefinition.Resources.Cast())
+ {
+ if (string.IsNullOrWhiteSpace(definition.ServerName))
+ {
+ yield return "No server name is configured";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/RedisEnterpriseCacheMetricValidator.cs b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/RedisEnterpriseCacheMetricValidator.cs
new file mode 100644
index 000000000..adc514322
--- /dev/null
+++ b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/RedisEnterpriseCacheMetricValidator.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.Linq;
+using GuardNet;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+using Promitor.Agents.Scraper.Validation.MetricDefinitions.Interfaces;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.Scraper.Validation.MetricDefinitions.ResourceTypes
+{
+ internal class RedisEnterpriseCacheMetricValidator : IMetricValidator
+ {
+ public IEnumerable Validate(MetricDefinition metricDefinition)
+ {
+ Guard.NotNull(metricDefinition, nameof(metricDefinition));
+
+ foreach (var resourceDefinition in metricDefinition.Resources.Cast())
+ {
+ if (string.IsNullOrWhiteSpace(resourceDefinition.CacheName))
+ {
+ yield return "No cache name is configured";
+ }
+ }
+ }
+ }
+}
diff --git a/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/VirtualNetworkMetricValidator.cs b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/VirtualNetworkMetricValidator.cs
new file mode 100644
index 000000000..99c1634a5
--- /dev/null
+++ b/src/Promitor.Agents.Scraper/Validation/MetricDefinitions/ResourceTypes/VirtualNetworkMetricValidator.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.Linq;
+using GuardNet;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+using Promitor.Agents.Scraper.Validation.MetricDefinitions.Interfaces;
+using Promitor.Core.Contracts.ResourceTypes;
+
+namespace Promitor.Agents.Scraper.Validation.MetricDefinitions.ResourceTypes
+{
+ internal class VirtualNetworkMetricValidator : IMetricValidator
+ {
+ public IEnumerable Validate(MetricDefinition metricDefinition)
+ {
+ Guard.NotNull(metricDefinition, nameof(metricDefinition));
+
+ foreach (var resourceDefinition in metricDefinition.Resources.Cast())
+ {
+ if (string.IsNullOrWhiteSpace(resourceDefinition.VirtualNetworkName))
+ {
+ yield return "No virtual network name is configured";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Contracts/ResourceType.cs b/src/Promitor.Core.Contracts/ResourceType.cs
index 6d91ee189..233385f2f 100644
--- a/src/Promitor.Core.Contracts/ResourceType.cs
+++ b/src/Promitor.Core.Contracts/ResourceType.cs
@@ -42,6 +42,11 @@ public enum ResourceType
MonitorAutoscale = 37,
DataFactory = 38,
DataShare = 39,
- ApplicationInsights = 40
+ ApplicationInsights = 40,
+ RedisEnterpriseCache = 41,
+ MariaDb = 42,
+ Cdn = 43,
+ VirtualNetwork = 44,
+ LoadBalancer = 45,
}
}
\ No newline at end of file
diff --git a/src/Promitor.Core.Contracts/ResourceTypes/CdnResourceDefinition.cs b/src/Promitor.Core.Contracts/ResourceTypes/CdnResourceDefinition.cs
new file mode 100644
index 000000000..e3bf36930
--- /dev/null
+++ b/src/Promitor.Core.Contracts/ResourceTypes/CdnResourceDefinition.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Contracts.ResourceTypes
+{
+ public class CdnResourceDefinition : AzureResourceDefinition
+ {
+ public CdnResourceDefinition(string subscriptionId, string resourceGroupName, string cdnName)
+ : base(ResourceType.Cdn, subscriptionId, resourceGroupName, cdnName)
+ {
+ CdnName = cdnName;
+ }
+
+ public string CdnName { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Contracts/ResourceTypes/LoadBalancerResourceDefinition.cs b/src/Promitor.Core.Contracts/ResourceTypes/LoadBalancerResourceDefinition.cs
new file mode 100644
index 000000000..4e5e0a721
--- /dev/null
+++ b/src/Promitor.Core.Contracts/ResourceTypes/LoadBalancerResourceDefinition.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Contracts.ResourceTypes
+{
+ public class LoadBalancerResourceDefinition : AzureResourceDefinition
+ {
+ public LoadBalancerResourceDefinition(string subscriptionId, string resourceGroupName, string loadBalancerName)
+ : base(ResourceType.LoadBalancer, subscriptionId, resourceGroupName, loadBalancerName)
+ {
+ LoadBalancerName = loadBalancerName;
+ }
+
+ public string LoadBalancerName { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Contracts/ResourceTypes/MariaDbResourceDefinition.cs b/src/Promitor.Core.Contracts/ResourceTypes/MariaDbResourceDefinition.cs
new file mode 100644
index 000000000..13f180d24
--- /dev/null
+++ b/src/Promitor.Core.Contracts/ResourceTypes/MariaDbResourceDefinition.cs
@@ -0,0 +1,25 @@
+namespace Promitor.Core.Contracts.ResourceTypes
+{
+ ///
+ /// Represents an Azure Database for MariaDb.
+ ///
+ public class MariaDbResourceDefinition : AzureResourceDefinition
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Specify a subscription to scrape that defers from the default subscription.
+ /// The name of the resource group the server is in.
+ /// The name of the Azure Database for MariaDb instance.
+ public MariaDbResourceDefinition(string subscriptionId, string resourceGroupName, string serverName)
+ : base(ResourceType.MariaDb, subscriptionId, resourceGroupName, serverName)
+ {
+ ServerName = serverName;
+ }
+
+ ///
+ /// The name of the MariaDb server instance.
+ ///
+ public string ServerName { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Contracts/ResourceTypes/RedisEnterpriseCacheResourceDefinition.cs b/src/Promitor.Core.Contracts/ResourceTypes/RedisEnterpriseCacheResourceDefinition.cs
new file mode 100644
index 000000000..0543728dc
--- /dev/null
+++ b/src/Promitor.Core.Contracts/ResourceTypes/RedisEnterpriseCacheResourceDefinition.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Contracts.ResourceTypes
+{
+ public class RedisEnterpriseCacheResourceDefinition : AzureResourceDefinition
+ {
+ public RedisEnterpriseCacheResourceDefinition(string subscriptionId, string resourceGroupName, string cacheName)
+ : base(ResourceType.RedisEnterpriseCache, subscriptionId, resourceGroupName, cacheName)
+ {
+ CacheName = cacheName;
+ }
+
+ public string CacheName { get; }
+ }
+}
diff --git a/src/Promitor.Core.Contracts/ResourceTypes/VirtualNetworkResourceDefinition.cs b/src/Promitor.Core.Contracts/ResourceTypes/VirtualNetworkResourceDefinition.cs
new file mode 100644
index 000000000..2c05134cf
--- /dev/null
+++ b/src/Promitor.Core.Contracts/ResourceTypes/VirtualNetworkResourceDefinition.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Contracts.ResourceTypes
+{
+ public class VirtualNetworkResourceDefinition : AzureResourceDefinition
+ {
+ public VirtualNetworkResourceDefinition(string subscriptionId, string resourceGroupName, string virtualNetworkName)
+ : base(ResourceType.VirtualNetwork, subscriptionId, resourceGroupName, virtualNetworkName)
+ {
+ VirtualNetworkName = virtualNetworkName;
+ }
+
+ public string VirtualNetworkName { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AzureResourceDeserializerFactory.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AzureResourceDeserializerFactory.cs
index 80ab3baf1..bb4390f78 100644
--- a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AzureResourceDeserializerFactory.cs
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Core/AzureResourceDeserializerFactory.cs
@@ -39,6 +39,9 @@ public IDeserializer GetDeserializerFor(ResourceType
case ResourceType.BlobStorage:
var blobStorageLogger = _loggerFactory.CreateLogger();
return new BlobStorageDeserializer(blobStorageLogger);
+ case ResourceType.Cdn:
+ var cdnLogger = _loggerFactory.CreateLogger();
+ return new CdnDeserializer(cdnLogger);
case ResourceType.ContainerInstance:
var containerInstanceLogger = _loggerFactory.CreateLogger();
return new ContainerInstanceDeserializer(containerInstanceLogger);
@@ -84,9 +87,15 @@ public IDeserializer GetDeserializerFor(ResourceType
case ResourceType.KubernetesService:
var kubernetesServiceLogger = _loggerFactory.CreateLogger();
return new KubernetesServiceDeserializer(kubernetesServiceLogger);
+ case ResourceType.LoadBalancer:
+ var loadBalancerLogger = _loggerFactory.CreateLogger();
+ return new LoadBalancerDeserializer(loadBalancerLogger);
case ResourceType.LogicApp:
var logicAppLogger = _loggerFactory.CreateLogger();
return new LogicAppDeserializer(logicAppLogger);
+ case ResourceType.MariaDb:
+ var mariaDbLogger = _loggerFactory.CreateLogger();
+ return new MariaDbDeserializer(mariaDbLogger);
case ResourceType.MonitorAutoscale:
var monitorAutoscaleLogger = _loggerFactory.CreateLogger();
return new MonitorAutoscaleDeserializer(monitorAutoscaleLogger);
@@ -102,6 +111,9 @@ public IDeserializer GetDeserializerFor(ResourceType
case ResourceType.RedisCache:
var redisCacheLogger = _loggerFactory.CreateLogger();
return new RedisCacheDeserializer(redisCacheLogger);
+ case ResourceType.RedisEnterpriseCache:
+ var redisEnterpriseCacheLogger = _loggerFactory.CreateLogger();
+ return new RedisEnterpriseCacheDeserializer(redisEnterpriseCacheLogger);
case ResourceType.ServiceBusNamespace:
var serviceBusLogger = _loggerFactory.CreateLogger();
return new ServiceBusNamespaceDeserializer(serviceBusLogger);
@@ -138,6 +150,9 @@ public IDeserializer GetDeserializerFor(ResourceType
case ResourceType.VirtualMachineScaleSet:
var virtualMachineScaleSetLogger = _loggerFactory.CreateLogger();
return new VirtualMachineScaleSetDeserializer(virtualMachineScaleSetLogger);
+ case ResourceType.VirtualNetwork:
+ var virtualNetworkLogger = _loggerFactory.CreateLogger();
+ return new VirtualNetworkDeserializer(virtualNetworkLogger);
case ResourceType.WebApp:
var webAppLogger = _loggerFactory.CreateLogger();
return new WebAppDeserializer(webAppLogger);
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Mapping/V1MappingProfile.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Mapping/V1MappingProfile.cs
index ef76567b2..3a6759c70 100644
--- a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Mapping/V1MappingProfile.cs
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Mapping/V1MappingProfile.cs
@@ -29,6 +29,7 @@ public V1MappingProfile()
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
CreateMap();
CreateMap();
@@ -44,12 +45,15 @@ public V1MappingProfile()
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
CreateMap();
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
CreateMap();
CreateMap();
@@ -60,6 +64,7 @@ public V1MappingProfile()
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
CreateMap();
CreateMap();
@@ -78,6 +83,7 @@ public V1MappingProfile()
.Include()
.Include()
.Include()
+ .Include()
.Include()
.Include()
.Include()
@@ -91,12 +97,15 @@ public V1MappingProfile()
.Include()
.Include()
.Include()
+ .Include()
.Include()
+ .Include()
.Include()
.Include()
.Include()
.Include()
.Include()
+ .Include()
.Include()
.Include()
.Include()
@@ -107,6 +116,7 @@ public V1MappingProfile()
.Include()
.Include()
.Include()
+ .Include()
.Include()
.Include()
.Include();
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/CdnResourceV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/CdnResourceV1.cs
new file mode 100644
index 000000000..af5e15a0e
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/CdnResourceV1.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes
+{
+ ///
+ /// Contains the configuration required to scrape an Azure CDN.
+ ///
+ public class CdnResourceV1 : AzureResourceDefinitionV1
+ {
+ ///
+ /// The name of the Azure CDN instance.
+ ///
+ public string CdnName { get; set; }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/LoadBalancerResourceV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/LoadBalancerResourceV1.cs
new file mode 100644
index 000000000..054016ccc
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/LoadBalancerResourceV1.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes
+{
+ ///
+ /// Contains the configuration required to scrape an Azure Load Balancer.
+ ///
+ public class LoadBalancerResourceV1 : AzureResourceDefinitionV1
+ {
+ ///
+ /// The name of the Azure Load Balancer to get metrics for.
+ ///
+ public string LoadBalancerName { get; set; }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/MariaDbResourceV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/MariaDbResourceV1.cs
new file mode 100644
index 000000000..152e4e321
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/MariaDbResourceV1.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes
+{
+ ///
+ /// Contains the configuration required to scrape an Azure Database for Maria DB instance.
+ ///
+ public class MariaDbResourceV1 : AzureResourceDefinitionV1
+ {
+ ///
+ /// The name of the Azure Database for Maria DB server instance.
+ ///
+ public string ServerName { get; set; }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/RedisEnterpriseCacheResourceV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/RedisEnterpriseCacheResourceV1.cs
new file mode 100644
index 000000000..464e797e1
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/RedisEnterpriseCacheResourceV1.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes
+{
+ ///
+ /// Contains the configuration required to scrape an Azure Cache for Redis (Enterprise).
+ ///
+ public class RedisEnterpriseCacheResourceV1 : AzureResourceDefinitionV1
+ {
+ ///
+ /// The name of the Azure Cache for Redis (Enterprise) instance.
+ ///
+ public string CacheName { get; set; }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/VirtualNetworkResourceV1.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/VirtualNetworkResourceV1.cs
new file mode 100644
index 000000000..1a82757bf
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/VirtualNetworkResourceV1.cs
@@ -0,0 +1,13 @@
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes
+{
+ ///
+ /// Contains the configuration required to scrape an Azure Virtual Network.
+ ///
+ public class VirtualNetworkResourceV1 : AzureResourceDefinitionV1
+ {
+ ///
+ /// The name of the Azure Virtual Network to get metrics for.
+ ///
+ public string VirtualNetworkName { get; set; }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/CdnDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/CdnDeserializer.cs
new file mode 100644
index 000000000..34d08f549
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/CdnDeserializer.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Logging;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers
+{
+ public class CdnDeserializer : ResourceDeserializer
+ {
+ public CdnDeserializer(ILogger logger) : base(logger)
+ {
+ Map(resource => resource.CdnName)
+ .IsRequired();
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/LoadBalancerDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/LoadBalancerDeserializer.cs
new file mode 100644
index 000000000..9bbeb69c1
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/LoadBalancerDeserializer.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Logging;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers
+{
+ public class LoadBalancerDeserializer : ResourceDeserializer
+ {
+ public LoadBalancerDeserializer(ILogger logger) : base(logger)
+ {
+ Map(resource => resource.LoadBalancerName)
+ .IsRequired();
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/MariaDbDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/MariaDbDeserializer.cs
new file mode 100644
index 000000000..248083b1b
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/MariaDbDeserializer.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Logging;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers
+{
+ public class MariaDbDeserializer : ResourceDeserializer
+ {
+ public MariaDbDeserializer(ILogger logger) : base(logger)
+ {
+ Map(resource => resource.ServerName)
+ .IsRequired();
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/RedisEnterpriseCacheDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/RedisEnterpriseCacheDeserializer.cs
new file mode 100644
index 000000000..b6c95e44a
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/RedisEnterpriseCacheDeserializer.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Logging;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers
+{
+ public class RedisEnterpriseCacheDeserializer : ResourceDeserializer
+ {
+ public RedisEnterpriseCacheDeserializer(ILogger logger) : base(logger)
+ {
+ Map(resource => resource.CacheName)
+ .IsRequired();
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/VirtualNetworkDeserializer.cs b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/VirtualNetworkDeserializer.cs
new file mode 100644
index 000000000..57130ee0b
--- /dev/null
+++ b/src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/VirtualNetworkDeserializer.cs
@@ -0,0 +1,14 @@
+using Microsoft.Extensions.Logging;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+
+namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers
+{
+ public class VirtualNetworkDeserializer : ResourceDeserializer
+ {
+ public VirtualNetworkDeserializer(ILogger logger) : base(logger)
+ {
+ Map(resource => resource.VirtualNetworkName)
+ .IsRequired();
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/Factories/MetricScraperFactory.cs b/src/Promitor.Core.Scraping/Factories/MetricScraperFactory.cs
index 2d47bf3c2..9c0abff3a 100644
--- a/src/Promitor.Core.Scraping/Factories/MetricScraperFactory.cs
+++ b/src/Promitor.Core.Scraping/Factories/MetricScraperFactory.cs
@@ -46,6 +46,8 @@ public IScraper CreateScraper(ResourceType metricDefin
return new AutomationAccountScraper(scraperConfiguration);
case ResourceType.BlobStorage:
return new BlobStorageScraper(scraperConfiguration);
+ case ResourceType.Cdn:
+ return new CdnScraper(scraperConfiguration);
case ResourceType.ContainerInstance:
return new ContainerInstanceScraper(scraperConfiguration);
case ResourceType.ContainerRegistry:
@@ -76,8 +78,12 @@ public IScraper CreateScraper(ResourceType metricDefin
return new KeyVaultScraper(scraperConfiguration);
case ResourceType.KubernetesService:
return new KubernetesServiceScraper(scraperConfiguration);
+ case ResourceType.LoadBalancer:
+ return new LoadBalancerScraper(scraperConfiguration);
case ResourceType.LogicApp:
return new LogicAppScraper(scraperConfiguration);
+ case ResourceType.MariaDb:
+ return new MariaDbScraper(scraperConfiguration);
case ResourceType.MonitorAutoscale:
return new MonitorAutoscaleScraper(scraperConfiguration);
case ResourceType.NetworkGateway:
@@ -88,6 +94,8 @@ public IScraper CreateScraper(ResourceType metricDefin
return new PostgreSqlScraper(scraperConfiguration);
case ResourceType.RedisCache:
return new RedisCacheScraper(scraperConfiguration);
+ case ResourceType.RedisEnterpriseCache:
+ return new RedisEnterpriseCacheScraper(scraperConfiguration);
case ResourceType.ServiceBusNamespace:
return new ServiceBusNamespaceScraper(scraperConfiguration);
case ResourceType.SqlDatabase:
@@ -112,6 +120,8 @@ public IScraper CreateScraper(ResourceType metricDefin
return new VirtualMachineScraper(scraperConfiguration);
case ResourceType.VirtualMachineScaleSet:
return new VirtualMachineScaleSetScraper(scraperConfiguration);
+ case ResourceType.VirtualNetwork:
+ return new VirtualNetworkScraper(scraperConfiguration);
case ResourceType.WebApp:
return new WebAppScraper(scraperConfiguration);
default:
diff --git a/src/Promitor.Core.Scraping/ResourceTypes/CdnScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/CdnScraper.cs
new file mode 100644
index 000000000..0e0b949e0
--- /dev/null
+++ b/src/Promitor.Core.Scraping/ResourceTypes/CdnScraper.cs
@@ -0,0 +1,21 @@
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+
+namespace Promitor.Core.Scraping.ResourceTypes
+{
+ public class CdnScraper : AzureMonitorScraper
+ {
+ private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Cdn/profiles/{2}";
+
+ public CdnScraper(ScraperConfiguration scraperConfiguration)
+ : base(scraperConfiguration)
+ {
+ }
+
+ protected override string BuildResourceUri(string subscriptionId, ScrapeDefinition scrapeDefinition, CdnResourceDefinition resource)
+ {
+ return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.CdnName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Scraping/ResourceTypes/LoadBalancerScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/LoadBalancerScraper.cs
new file mode 100644
index 000000000..eb3bb6633
--- /dev/null
+++ b/src/Promitor.Core.Scraping/ResourceTypes/LoadBalancerScraper.cs
@@ -0,0 +1,21 @@
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+
+namespace Promitor.Core.Scraping.ResourceTypes
+{
+ public class LoadBalancerScraper : AzureMonitorScraper
+ {
+ private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/loadBalancers/{2}";
+
+ public LoadBalancerScraper(ScraperConfiguration scraperConfiguration)
+ : base(scraperConfiguration)
+ {
+ }
+
+ protected override string BuildResourceUri(string subscriptionId, ScrapeDefinition scrapeDefinition, LoadBalancerResourceDefinition resource)
+ {
+ return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.LoadBalancerName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Scraping/ResourceTypes/MariaDbScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/MariaDbScraper.cs
new file mode 100644
index 000000000..a5c44d4ba
--- /dev/null
+++ b/src/Promitor.Core.Scraping/ResourceTypes/MariaDbScraper.cs
@@ -0,0 +1,24 @@
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+
+namespace Promitor.Core.Scraping.ResourceTypes
+{
+ ///
+ /// Scrapes an Azure Database for MariaDB instance.
+ ///
+ public class MariaDbScraper : AzureMonitorScraper
+ {
+ private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.DBforMariaDB/servers/{2}";
+
+ public MariaDbScraper(ScraperConfiguration scraperConfiguration)
+ : base(scraperConfiguration)
+ {
+ }
+
+ protected override string BuildResourceUri(string subscriptionId, ScrapeDefinition scrapeDefinition, MariaDbResourceDefinition resource)
+ {
+ return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.ServerName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Core.Scraping/ResourceTypes/RedisEnterpriseCacheScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/RedisEnterpriseCacheScraper.cs
new file mode 100644
index 000000000..9a2c608cd
--- /dev/null
+++ b/src/Promitor.Core.Scraping/ResourceTypes/RedisEnterpriseCacheScraper.cs
@@ -0,0 +1,21 @@
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+
+namespace Promitor.Core.Scraping.ResourceTypes
+{
+ public class RedisEnterpriseCacheScraper : AzureMonitorScraper
+ {
+ private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Cache/RedisEnterprise/{2}";
+
+ public RedisEnterpriseCacheScraper(ScraperConfiguration scraperConfiguration)
+ : base(scraperConfiguration)
+ {
+ }
+
+ protected override string BuildResourceUri(string subscriptionId, ScrapeDefinition scrapeDefinition, RedisEnterpriseCacheResourceDefinition resource)
+ {
+ return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.CacheName);
+ }
+ }
+}
diff --git a/src/Promitor.Core.Scraping/ResourceTypes/VirtualNetworkScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/VirtualNetworkScraper.cs
new file mode 100644
index 000000000..e5aab4a3f
--- /dev/null
+++ b/src/Promitor.Core.Scraping/ResourceTypes/VirtualNetworkScraper.cs
@@ -0,0 +1,21 @@
+using Promitor.Core.Contracts;
+using Promitor.Core.Contracts.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Model.Metrics;
+
+namespace Promitor.Core.Scraping.ResourceTypes
+{
+ internal class VirtualNetworkScraper : AzureMonitorScraper
+ {
+ private const string ResourceUriTemplate = "subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/virtualNetworks/{2}";
+
+ public VirtualNetworkScraper(ScraperConfiguration scraperConfiguration)
+ : base(scraperConfiguration)
+ {
+ }
+
+ protected override string BuildResourceUri(string subscriptionId, ScrapeDefinition scrapeDefinition, VirtualNetworkResourceDefinition resource)
+ {
+ return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.VirtualNetworkName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Builders/Metrics/v1/MetricsDeclarationBuilder.cs b/src/Promitor.Tests.Unit/Builders/Metrics/v1/MetricsDeclarationBuilder.cs
index dcb50c136..df94684d6 100644
--- a/src/Promitor.Tests.Unit/Builders/Metrics/v1/MetricsDeclarationBuilder.cs
+++ b/src/Promitor.Tests.Unit/Builders/Metrics/v1/MetricsDeclarationBuilder.cs
@@ -70,196 +70,168 @@ public string Build(IMapper mapper)
return configurationSerializer.Serialize(metricsDeclaration);
}
- public MetricsDeclarationBuilder WithServiceBusMetric(string metricName = "promitor-service-bus",
+ public MetricsDeclarationBuilder WithApiManagementMetric(string metricName = "promitor-api-management",
string metricDescription = "Description for a metric",
- string metricDimension = "",
- string queueName = "promitor-queue",
- string topicName = "",
- string serviceBusNamespace = "promitor-namespace",
- string azureMetricName = "Total",
+ string instanceName = "promitor-app-plan",
+ string locationName = "West Europe",
+ string azureMetricName = "TotalRequests",
string resourceDiscoveryGroupName = "",
- bool omitResource = false,
- List queueNames = null,
int? azureMetricLimit = null,
- Dictionary labels = null)
+ bool omitResource = false)
{
- var serviceBusQueueResources = new List();
-
- if (queueNames != null)
- {
- foreach (string queue in queueNames)
- {
- var resource = new ServiceBusNamespaceResourceV1
- {
- QueueName = queue,
- Namespace = serviceBusNamespace
- };
- serviceBusQueueResources.Add(resource);
- }
- }
- else
+ var resource = new ApiManagementResourceV1
{
- var resource = new ServiceBusNamespaceResourceV1
- {
- QueueName = queueName,
- TopicName = topicName,
- Namespace = serviceBusNamespace
- };
- serviceBusQueueResources.Add(resource);
- }
+ InstanceName = instanceName,
+ LocationName = locationName
+ };
+
+ CreateAndAddMetricDefinition(ResourceType.ApiManagement, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
- CreateAndAddMetricDefinition(ResourceType.ServiceBusNamespace, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, serviceBusQueueResources, metricDimension, labels);
-
return this;
}
- public MetricsDeclarationBuilder WithContainerInstanceMetric(string metricName = "promitor-container-instance",
+ public MetricsDeclarationBuilder WithApplicationGatewayMetric(string metricName = "promitor-application-gateway",
string metricDescription = "Description for a metric",
- string containerGroup = "promitor-group",
- string azureMetricName = "Total",
+ string applicationGatewayName = "promitor-application-gateway-name",
+ string azureMetricName = "ApplicationGatewayTotalTime",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ContainerInstanceResourceV1
+ var resource = new ApplicationGatewayResourceV1
{
- ContainerGroup = containerGroup
+ ApplicationGatewayName = applicationGatewayName
};
- CreateAndAddMetricDefinition(ResourceType.ContainerInstance, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.ApplicationGateway, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithContainerRegistryMetric(string metricName = "promitor-container-registry",
+ public MetricsDeclarationBuilder WithApplicationInsightsMetric(string metricName = "promitor-application-gateway",
string metricDescription = "Description for a metric",
- string registryName = "promitor-container-registry",
- string azureMetricName = "Total",
+ string applicationInsightsName = "promitor-application-insights-name",
+ string azureMetricName = "ApplicationGatewayTotalTime",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ContainerRegistryResourceV1
+ var resource = new ApplicationInsightsResourceV1
{
- RegistryName = registryName
+ Name = applicationInsightsName
};
- CreateAndAddMetricDefinition(ResourceType.ContainerRegistry, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.ApplicationInsights, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithDataShareMetric(string metricName = "promitor-data-share",
+ public MetricsDeclarationBuilder WithAppPlanMetric(string metricName = "promitor-app-plan",
string metricDescription = "Description for a metric",
- string accountName = "promitor-data-share-account",
- string shareName = "promitor-data-share",
+ string appPlanName = "promitor-app-plan",
string azureMetricName = "TotalRequests",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new DataShareResourceV1
+ var resource = new AppPlanResourceV1
{
- AccountName = accountName,
- ShareName = shareName
+ AppPlanName = appPlanName
};
- CreateAndAddMetricDefinition(ResourceType.DataShare, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.AppPlan, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithDataFactoryMetric(string metricName = "promitor-data-factory",
+ public MetricsDeclarationBuilder WithAutomationAccountMetric(string metricName = "promitor-automation-metrics",
string metricDescription = "Description for a metric",
- string factoryName = "promitor-data-factory",
- string pipelineName = "promitor-data-pipeline",
- string azureMetricName = "TotalRequests",
+ string accountName = "promitor-automation-account",
+ string runbookName = "",
+ string azureMetricName = "TotalJob",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new DataFactoryResourceV1
+ var resource = new AutomationAccountResourceV1
{
- FactoryName = factoryName,
- PipelineName = pipelineName
+ AccountName = accountName,
+ RunbookName = runbookName
};
- CreateAndAddMetricDefinition(ResourceType.DataFactory, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.AutomationAccount, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithEventHubsMetric(string metricName = "promitor-event-hubs",
+ public MetricsDeclarationBuilder WithBlobStorageMetric(string metricName = "promitor",
string metricDescription = "Description for a metric",
- string metricDimension = "",
- string topicName = "promitor-queue",
- string eventHubsNamespace = "promitor-namespace",
+ string accountName = "promitor-account",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new EventHubsResourceV1
+ var resource = new BlobStorageResourceV1
{
- TopicName = topicName,
- Namespace = eventHubsNamespace
+ AccountName = accountName
};
- CreateAndAddMetricDefinition(ResourceType.EventHubs, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource, metricDimension);
+ CreateAndAddMetricDefinition(ResourceType.BlobStorage, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithExpressRouteCircuitMetric(string metricName = "promitor-express-route-circuit",
+ public MetricsDeclarationBuilder WithCdnMetric(string metricName = "promitor-cdn",
string metricDescription = "Description for a metric",
- string expressRouteCircuitName = "promitor-express-route-circuit-name",
- string azureMetricName = "ArpAvailability",
+ string cdnName = "promitor-cdn-name",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ExpressRouteCircuitResourceV1
+ var resource = new CdnResourceV1
{
- ExpressRouteCircuitName = expressRouteCircuitName
+ CdnName = cdnName
};
- CreateAndAddMetricDefinition(ResourceType.ExpressRouteCircuit, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.Cdn, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithLogicAppMetric(string metricName = "promitor-logic-apps-failed-runs",
+ public MetricsDeclarationBuilder WithContainerInstanceMetric(string metricName = "promitor-container-instance",
string metricDescription = "Description for a metric",
- string workflowName = "promitor-workflow",
+ string containerGroup = "promitor-group",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new LogicAppResourceV1
+ var resource = new ContainerInstanceResourceV1
{
- WorkflowName = workflowName
+ ContainerGroup = containerGroup
};
- CreateAndAddMetricDefinition(ResourceType.LogicApp, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.ContainerInstance, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithMonitorAutoscaleMetric(string metricName = "promitor-autoscale",
+ public MetricsDeclarationBuilder WithContainerRegistryMetric(string metricName = "promitor-container-registry",
string metricDescription = "Description for a metric",
- string autoscaleSettingsName = "promitor-autoscale-rules",
- string azureMetricName = "ObservedCapacity",
+ string registryName = "promitor-container-registry",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new MonitorAutoscaleResourceV1
+ var resource = new ContainerRegistryResourceV1
{
- AutoscaleSettingsName = autoscaleSettingsName
+ RegistryName = registryName
};
- CreateAndAddMetricDefinition(ResourceType.MonitorAutoscale, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.ContainerRegistry, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
@@ -282,96 +254,99 @@ public MetricsDeclarationBuilder WithCosmosDbMetric(string metricName = "promito
return this;
}
- public MetricsDeclarationBuilder WithApplicationGatewayMetric(string metricName = "promitor-application-gateway",
+ public MetricsDeclarationBuilder WithDataShareMetric(string metricName = "promitor-data-share",
string metricDescription = "Description for a metric",
- string applicationGatewayName = "promitor-application-gateway-name",
- string azureMetricName = "ApplicationGatewayTotalTime",
+ string accountName = "promitor-data-share-account",
+ string shareName = "promitor-data-share",
+ string azureMetricName = "TotalRequests",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ApplicationGatewayResourceV1
+ var resource = new DataShareResourceV1
{
- ApplicationGatewayName = applicationGatewayName
+ AccountName = accountName,
+ ShareName = shareName
};
- CreateAndAddMetricDefinition(ResourceType.ApplicationGateway, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.DataShare, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithApplicationInsightsMetric(string metricName = "promitor-application-gateway",
+ public MetricsDeclarationBuilder WithDataFactoryMetric(string metricName = "promitor-data-factory",
string metricDescription = "Description for a metric",
- string applicationInsightsName = "promitor-application-insights-name",
- string azureMetricName = "ApplicationGatewayTotalTime",
+ string factoryName = "promitor-data-factory",
+ string pipelineName = "promitor-data-pipeline",
+ string azureMetricName = "TotalRequests",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ApplicationInsightsResourceV1
+ var resource = new DataFactoryResourceV1
{
- Name = applicationInsightsName
+ FactoryName = factoryName,
+ PipelineName = pipelineName
};
- CreateAndAddMetricDefinition(ResourceType.ApplicationInsights, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.DataFactory, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithAppPlanMetric(string metricName = "promitor-app-plan",
+ public MetricsDeclarationBuilder WithDeviceProvisioningServiceMetric(string metricName = "promitor-dps",
string metricDescription = "Description for a metric",
- string appPlanName = "promitor-app-plan",
- string azureMetricName = "TotalRequests",
+ string deviceProvisioningServiceName = "promitor-dps",
+ string azureMetricName = "AttestationAttempts",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new AppPlanResourceV1
+ var resource = new DeviceProvisioningServiceResourceV1
{
- AppPlanName = appPlanName
+ DeviceProvisioningServiceName = deviceProvisioningServiceName
};
- CreateAndAddMetricDefinition(ResourceType.AppPlan, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.DeviceProvisioningService, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithApiManagementMetric(string metricName = "promitor-api-management",
+ public MetricsDeclarationBuilder WithEventHubsMetric(string metricName = "promitor-event-hubs",
string metricDescription = "Description for a metric",
- string instanceName = "promitor-app-plan",
- string locationName = "West Europe",
- string azureMetricName = "TotalRequests",
+ string metricDimension = "",
+ string topicName = "promitor-queue",
+ string eventHubsNamespace = "promitor-namespace",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new ApiManagementResourceV1
+ var resource = new EventHubsResourceV1
{
- InstanceName = instanceName,
- LocationName = locationName
+ TopicName = topicName,
+ Namespace = eventHubsNamespace
};
- CreateAndAddMetricDefinition(ResourceType.ApiManagement, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.EventHubs, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource, metricDimension);
return this;
}
- public MetricsDeclarationBuilder WithAutomationAccountMetric(string metricName = "promitor-automation-metrics",
+ public MetricsDeclarationBuilder WithExpressRouteCircuitMetric(string metricName = "promitor-express-route-circuit",
string metricDescription = "Description for a metric",
- string accountName = "promitor-automation-account",
- string runbookName = "",
- string azureMetricName = "TotalJob",
+ string expressRouteCircuitName = "promitor-express-route-circuit-name",
+ string azureMetricName = "ArpAvailability",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new AutomationAccountResourceV1
+ var resource = new ExpressRouteCircuitResourceV1
{
- AccountName = accountName,
- RunbookName = runbookName
+ ExpressRouteCircuitName = expressRouteCircuitName
};
- CreateAndAddMetricDefinition(ResourceType.AutomationAccount, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.ExpressRouteCircuit, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
@@ -394,157 +369,184 @@ public MetricsDeclarationBuilder WithFunctionAppMetric(string metricName = "prom
return this;
}
- public MetricsDeclarationBuilder WithStorageQueueMetric(string metricName = "promitor",
+ public MetricsDeclarationBuilder WithFileStorageMetric(string metricName = "promitor",
string metricDescription = "Description for a metric",
- string queueName = "promitor-queue",
string accountName = "promitor-account",
- string sasToken = "?sig=promitor",
- string azureMetricName = AzureStorageConstants.Queues.Metrics.MessageCount,
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var secret = new SecretV1
+ var resource = new FileStorageResourceV1
{
- RawValue = sasToken
+ AccountName = accountName
};
- var resource = new StorageQueueResourceV1
+ CreateAndAddMetricDefinition(ResourceType.FileStorage, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ return this;
+ }
+
+ public MetricsDeclarationBuilder WithFrontDoorMetric(string metricName = "promitor",
+ string metricDescription = "Description for a metric",
+ string name = "BackendHealthPercentage",
+ string azureMetricName = "Total",
+ string resourceDiscoveryGroupName = "",
+ int? azureMetricLimit = null,
+ bool omitResource = false)
+ {
+ var resource = new FrontDoorResourceV1
{
- QueueName = queueName,
- AccountName = accountName,
- SasToken = secret
+ Name = name
};
- CreateAndAddMetricDefinition(ResourceType.StorageQueue, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.FrontDoor, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithStorageAccountMetric(string metricName = "promitor",
+ public MetricsDeclarationBuilder WithGenericMetric(string metricName = "foo",
string metricDescription = "Description for a metric",
- string accountName = "promitor-account",
+ string resourceUri = "Microsoft.ServiceBus/namespaces/promitor-messaging",
+ string filter = "EntityName eq \'orders\'",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new StorageAccountResourceV1
+ var resource = new GenericResourceV1
{
- AccountName = accountName
+ ResourceUri = resourceUri,
+ Filter = filter
};
- CreateAndAddMetricDefinition(ResourceType.StorageAccount, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.Generic, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithFileStorageMetric(string metricName = "promitor",
+ public MetricsDeclarationBuilder WithIoTHubMetric(string metricName = "promitor-iot-hub",
string metricDescription = "Description for a metric",
- string accountName = "promitor-account",
- string azureMetricName = "Total",
+ string iotHubName = "promitor-iot-hub",
+ string azureMetricName = "devices.totalDevices",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new FileStorageResourceV1
+ var resource = new IoTHubResourceV1
{
- AccountName = accountName
+ IoTHubName = iotHubName
};
- CreateAndAddMetricDefinition(ResourceType.FileStorage, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.IoTHub, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithFrontDoorMetric(string metricName = "promitor",
+ public MetricsDeclarationBuilder WithKeyVaultMetric(string metricName = "promitor-kv",
string metricDescription = "Description for a metric",
- string name = "BackendHealthPercentage",
- string azureMetricName = "Total",
+ string vaultName = "promitor-kv",
+ string azureMetricName = "ServiceApiLatency",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new FrontDoorResourceV1
+ var resource = new KeyVaultResourceV1
{
- Name = name
+ VaultName = vaultName
};
- CreateAndAddMetricDefinition(ResourceType.FrontDoor, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.KeyVault, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithBlobStorageMetric(string metricName = "promitor",
+ public MetricsDeclarationBuilder WithKubernetesServiceMetric(string metricName = "promitor-aks",
string metricDescription = "Description for a metric",
- string accountName = "promitor-account",
- string azureMetricName = "Total",
+ string clusterName = "promitor-aks",
+ string azureMetricName = "kube_node_status_condition",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new BlobStorageResourceV1
+ var resource = new KubernetesServiceResourceV1
{
- AccountName = accountName
+ ClusterName = clusterName
};
- CreateAndAddMetricDefinition(ResourceType.BlobStorage, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.KubernetesService, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithVirtualMachineMetric(string metricName = "promitor-virtual-machine",
+ public MetricsDeclarationBuilder WithLoadBalancerMetric(string metricName = "promitor-load-balancer",
string metricDescription = "Description for a metric",
- string virtualMachineName = "promitor-virtual-machine-name",
+ string loadBalancerName = "promitor-load-balancer-name",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new VirtualMachineResourceV1
+ var resource = new LoadBalancerResourceV1()
{
- VirtualMachineName = virtualMachineName
+ LoadBalancerName = loadBalancerName
};
- CreateAndAddMetricDefinition(ResourceType.VirtualMachine, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.LoadBalancer, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithWebAppMetric(string metricName = "promitor-web-app",
+ public MetricsDeclarationBuilder WithLogicAppMetric(string metricName = "promitor-logic-apps-failed-runs",
string metricDescription = "Description for a metric",
- string webAppName = "promitor-web-app-name",
- string slotName = "production",
+ string workflowName = "promitor-workflow",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new WebAppResourceV1
+ var resource = new LogicAppResourceV1
{
- WebAppName = webAppName,
- SlotName = slotName
+ WorkflowName = workflowName
};
- CreateAndAddMetricDefinition(ResourceType.WebApp, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.LogicApp, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithVirtualMachineScaleSetMetric(string metricName = "promitor-virtual-machine-scale-set",
+ public MetricsDeclarationBuilder WithMariaDbMetric(string metricName = "promitor-maria-db",
string metricDescription = "Description for a metric",
- string scaleSetName = "promitor-scale-set-name",
+ string serverName = "promitor-maria-db-name",
string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new VirtualMachineScaleSetResourceV1()
+ var resource = new MariaDbResourceV1
{
- ScaleSetName = scaleSetName
+ ServerName = serverName
};
- CreateAndAddMetricDefinition(ResourceType.VirtualMachineScaleSet, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.MariaDb, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ return this;
+ }
+
+ public MetricsDeclarationBuilder WithMonitorAutoscaleMetric(string metricName = "promitor-autoscale",
+ string metricDescription = "Description for a metric",
+ string autoscaleSettingsName = "promitor-autoscale-rules",
+ string azureMetricName = "ObservedCapacity",
+ string resourceDiscoveryGroupName = "",
+ int? azureMetricLimit = null,
+ bool omitResource = false)
+ {
+ var resource = new MonitorAutoscaleResourceV1
+ {
+ AutoscaleSettingsName = autoscaleSettingsName
+ };
+
+ CreateAndAddMetricDefinition(ResourceType.MonitorAutoscale, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
@@ -585,22 +587,22 @@ public MetricsDeclarationBuilder WithNetworkInterfaceMetric(string metricName =
return this;
}
- public MetricsDeclarationBuilder WithGenericMetric(string metricName = "foo",
+ public MetricsDeclarationBuilder WithPostgreSqlMetric(string metricName = "promitor-postgresql",
string metricDescription = "Description for a metric",
- string resourceUri = "Microsoft.ServiceBus/namespaces/promitor-messaging",
- string filter = "EntityName eq \'orders\'",
- string azureMetricName = "Total",
+ string serverName = "promitor-postgresql",
+ string azureMetricName = "cpu_percent",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
+ PostgreSqlServerType serverType = PostgreSqlServerType.Single,
bool omitResource = false)
{
- var resource = new GenericResourceV1
+ var resource = new PostgreSqlResourceV1
{
- ResourceUri = resourceUri,
- Filter = filter
+ ServerName = serverName,
+ Type = serverType
};
- CreateAndAddMetricDefinition(ResourceType.Generic, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.PostgreSql, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
@@ -623,22 +625,63 @@ public MetricsDeclarationBuilder WithRedisCacheMetric(string metricName = "promi
return this;
}
- public MetricsDeclarationBuilder WithPostgreSqlMetric(string metricName = "promitor-postgresql",
+ public MetricsDeclarationBuilder WithRedisEnterpriseCacheMetric(string metricName = "promitor-redis-enterprise",
string metricDescription = "Description for a metric",
- string serverName = "promitor-postgresql",
- string azureMetricName = "cpu_percent",
+ string cacheName = "promitor-redis-enterprise-cache-name",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
- PostgreSqlServerType serverType = PostgreSqlServerType.Single,
bool omitResource = false)
{
- var resource = new PostgreSqlResourceV1
+ var resource = new RedisEnterpriseCacheResourceV1
{
- ServerName = serverName,
- Type = serverType
+ CacheName = cacheName
};
- CreateAndAddMetricDefinition(ResourceType.PostgreSql, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.RedisEnterpriseCache, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ return this;
+ }
+
+ public MetricsDeclarationBuilder WithServiceBusMetric(string metricName = "promitor-service-bus",
+ string metricDescription = "Description for a metric",
+ string metricDimension = "",
+ string queueName = "promitor-queue",
+ string topicName = "",
+ string serviceBusNamespace = "promitor-namespace",
+ string azureMetricName = "Total",
+ string resourceDiscoveryGroupName = "",
+ bool omitResource = false,
+ List queueNames = null,
+ int? azureMetricLimit = null,
+ Dictionary labels = null)
+ {
+ var serviceBusQueueResources = new List();
+
+ if (queueNames != null)
+ {
+ foreach (string queue in queueNames)
+ {
+ var resource = new ServiceBusNamespaceResourceV1
+ {
+ QueueName = queue,
+ Namespace = serviceBusNamespace
+ };
+ serviceBusQueueResources.Add(resource);
+ }
+ }
+ else
+ {
+ var resource = new ServiceBusNamespaceResourceV1
+ {
+ QueueName = queueName,
+ TopicName = topicName,
+ Namespace = serviceBusNamespace
+ };
+ serviceBusQueueResources.Add(resource);
+ }
+
+ CreateAndAddMetricDefinition(ResourceType.ServiceBusNamespace, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, serviceBusQueueResources, metricDimension, labels);
return this;
}
@@ -723,6 +766,51 @@ public MetricsDeclarationBuilder WithSqlManagedInstanceMetric(
return this;
}
+ public MetricsDeclarationBuilder WithStorageQueueMetric(string metricName = "promitor",
+ string metricDescription = "Description for a metric",
+ string queueName = "promitor-queue",
+ string accountName = "promitor-account",
+ string sasToken = "?sig=promitor",
+ string azureMetricName = AzureStorageConstants.Queues.Metrics.MessageCount,
+ string resourceDiscoveryGroupName = "",
+ int? azureMetricLimit = null,
+ bool omitResource = false)
+ {
+ var secret = new SecretV1
+ {
+ RawValue = sasToken
+ };
+
+ var resource = new StorageQueueResourceV1
+ {
+ QueueName = queueName,
+ AccountName = accountName,
+ SasToken = secret
+ };
+
+ CreateAndAddMetricDefinition(ResourceType.StorageQueue, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ return this;
+ }
+
+ public MetricsDeclarationBuilder WithStorageAccountMetric(string metricName = "promitor",
+ string metricDescription = "Description for a metric",
+ string accountName = "promitor-account",
+ string azureMetricName = "Total",
+ string resourceDiscoveryGroupName = "",
+ int? azureMetricLimit = null,
+ bool omitResource = false)
+ {
+ var resource = new StorageAccountResourceV1
+ {
+ AccountName = accountName
+ };
+
+ CreateAndAddMetricDefinition(ResourceType.StorageAccount, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ return this;
+ }
+
public MetricsDeclarationBuilder WithSynapseApacheSparkPoolMetric(
string metricName = "promitor-sql-db",
string azureMetricName = "cpu_percent",
@@ -784,74 +872,76 @@ public MetricsDeclarationBuilder WithSynapseWorkspaceMetric(
return this;
}
- public MetricsDeclarationBuilder WithIoTHubMetric(string metricName = "promitor-iot-hub",
+ public MetricsDeclarationBuilder WithVirtualMachineMetric(string metricName = "promitor-virtual-machine",
string metricDescription = "Description for a metric",
- string iotHubName = "promitor-iot-hub",
- string azureMetricName = "devices.totalDevices",
+ string virtualMachineName = "promitor-virtual-machine-name",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new IoTHubResourceV1
+ var resource = new VirtualMachineResourceV1
{
- IoTHubName = iotHubName
+ VirtualMachineName = virtualMachineName
};
- CreateAndAddMetricDefinition(ResourceType.IoTHub, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.VirtualMachine, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithDeviceProvisioningServiceMetric(string metricName = "promitor-dps",
+ public MetricsDeclarationBuilder WithVirtualMachineScaleSetMetric(string metricName = "promitor-virtual-machine-scale-set",
string metricDescription = "Description for a metric",
- string deviceProvisioningServiceName = "promitor-dps",
- string azureMetricName = "AttestationAttempts",
+ string scaleSetName = "promitor-scale-set-name",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new DeviceProvisioningServiceResourceV1
+ var resource = new VirtualMachineScaleSetResourceV1()
{
- DeviceProvisioningServiceName = deviceProvisioningServiceName
+ ScaleSetName = scaleSetName
};
-
- CreateAndAddMetricDefinition(ResourceType.DeviceProvisioningService, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+
+ CreateAndAddMetricDefinition(ResourceType.VirtualMachineScaleSet, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithKeyVaultMetric(string metricName = "promitor-kv",
+ public MetricsDeclarationBuilder WithVirtualNetworkMetric(string metricName = "promitor-virtual-network",
string metricDescription = "Description for a metric",
- string vaultName = "promitor-kv",
- string azureMetricName = "ServiceApiLatency",
+ string virtualNetworkName = "promitor-virtual-network-name",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new KeyVaultResourceV1
+ var resource = new VirtualNetworkResourceV1
{
- VaultName = vaultName
+ VirtualNetworkName = virtualNetworkName
};
- CreateAndAddMetricDefinition(ResourceType.KeyVault, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.VirtualNetwork, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
- public MetricsDeclarationBuilder WithKubernetesServiceMetric(string metricName = "promitor-aks",
+ public MetricsDeclarationBuilder WithWebAppMetric(string metricName = "promitor-web-app",
string metricDescription = "Description for a metric",
- string clusterName = "promitor-aks",
- string azureMetricName = "kube_node_status_condition",
+ string webAppName = "promitor-web-app-name",
+ string slotName = "production",
+ string azureMetricName = "Total",
string resourceDiscoveryGroupName = "",
int? azureMetricLimit = null,
bool omitResource = false)
{
- var resource = new KubernetesServiceResourceV1
+ var resource = new WebAppResourceV1
{
- ClusterName = clusterName
+ WebAppName = webAppName,
+ SlotName = slotName
};
- CreateAndAddMetricDefinition(ResourceType.KubernetesService, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
+ CreateAndAddMetricDefinition(ResourceType.WebApp, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, azureMetricLimit, resource);
return this;
}
diff --git a/src/Promitor.Tests.Unit/Serialization/v1/Providers/CdnDeserializerTests.cs b/src/Promitor.Tests.Unit/Serialization/v1/Providers/CdnDeserializerTests.cs
new file mode 100644
index 000000000..ddb08d5fb
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Serialization/v1/Providers/CdnDeserializerTests.cs
@@ -0,0 +1,58 @@
+using System.ComponentModel;
+using Promitor.Core.Scraping.Configuration.Serialization;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Providers;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Serialization.v1.Providers
+{
+ [Category("Unit")]
+ public class CdnDeserializerTests : ResourceDeserializerTest
+ {
+ private readonly CdnDeserializer _deserializer;
+
+ public CdnDeserializerTests()
+ {
+ _deserializer = new CdnDeserializer(Logger);
+ }
+
+ [Fact]
+ public void Deserialize_CdnNameSupplied_SetsDbName()
+ {
+ const string cdnName = "promitor-cdn";
+ YamlAssert.PropertySet(
+ _deserializer,
+ $"cdnName: {cdnName}",
+ cdnName,
+ c => c.CdnName);
+ }
+
+ [Fact]
+ public void Deserialize_CdnNameNotSupplied_Null()
+ {
+ YamlAssert.PropertyNull(
+ _deserializer,
+ "resourceGroupName: promitor-group",
+ c => c.CdnName);
+ }
+
+ [Fact]
+ public void Deserialize_DbNameNotSupplied_ReportsError()
+ {
+ // Arrange
+ var node = YamlUtils.CreateYamlNode("resourceGroupName: promitor-resource-group");
+
+ // Act / Assert
+ YamlAssert.ReportsErrorForProperty(
+ _deserializer,
+ node,
+ "cdnName");
+ }
+
+ protected override IDeserializer CreateDeserializer()
+ {
+ return new CdnDeserializer(Logger);
+ }
+ }
+}
diff --git a/src/Promitor.Tests.Unit/Serialization/v1/Providers/LoadBalancerDeserializerTests.cs b/src/Promitor.Tests.Unit/Serialization/v1/Providers/LoadBalancerDeserializerTests.cs
new file mode 100644
index 000000000..e9cd8f82a
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Serialization/v1/Providers/LoadBalancerDeserializerTests.cs
@@ -0,0 +1,45 @@
+using Promitor.Core.Scraping.Configuration.Serialization;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Providers;
+using System.ComponentModel;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Serialization.v1.Providers
+{
+ [Category("Unit")]
+ public class LoadBalancerDeserializerTests : ResourceDeserializerTest
+ {
+ private readonly LoadBalancerDeserializer _deserializer;
+
+ public LoadBalancerDeserializerTests()
+ {
+ _deserializer = new LoadBalancerDeserializer(Logger);
+ }
+
+ [Fact]
+ public void Deserialize_LoadBalancerNameSupplied_SetsVaultName()
+ {
+ const string loadBalancerName = "promitor-load-balancer";
+ YamlAssert.PropertySet(
+ _deserializer,
+ $"loadBalancerName: {loadBalancerName}",
+ loadBalancerName,
+ r => r.LoadBalancerName);
+ }
+
+ [Fact]
+ public void Deserialize_LoadBalancerNameNotSupplied_Null()
+ {
+ YamlAssert.PropertyNull(
+ _deserializer,
+ "resourceGroupName: promitor-group",
+ r => r.LoadBalancerName);
+ }
+
+ protected override IDeserializer CreateDeserializer()
+ {
+ return new LoadBalancerDeserializer(Logger);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Serialization/v1/Providers/MariaDbDeserializerTests.cs b/src/Promitor.Tests.Unit/Serialization/v1/Providers/MariaDbDeserializerTests.cs
new file mode 100644
index 000000000..f11f2a1df
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Serialization/v1/Providers/MariaDbDeserializerTests.cs
@@ -0,0 +1,58 @@
+using System.ComponentModel;
+using Promitor.Core.Scraping.Configuration.Serialization;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Providers;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Serialization.v1.Providers
+{
+ [Category("Unit")]
+ public class MariaDbDeserializerTests : ResourceDeserializerTest
+ {
+ private readonly MariaDbDeserializer _deserializer;
+
+ public MariaDbDeserializerTests()
+ {
+ _deserializer = new MariaDbDeserializer(Logger);
+ }
+
+ [Fact]
+ public void Deserialize_ServerNameSupplied_SetsName()
+ {
+ const string serverName = "promitor-cache";
+ YamlAssert.PropertySet(
+ _deserializer,
+ $"serverName: {serverName}",
+ serverName,
+ r => r.ServerName);
+ }
+
+ [Fact]
+ public void Deserialize_ServerNameNotSupplied_Null()
+ {
+ YamlAssert.PropertyNull(
+ _deserializer,
+ "resourceGroupName: promitor-group",
+ r => r.ServerName);
+ }
+
+ [Fact]
+ public void Deserialize_MariaDbNameNotSupplied_ReportsError()
+ {
+ // Arrange
+ var node = YamlUtils.CreateYamlNode("resourceGroupName: promitor-group");
+
+ // Act / Assert
+ YamlAssert.ReportsErrorForProperty(
+ _deserializer,
+ node,
+ "serverName");
+ }
+
+ protected override IDeserializer CreateDeserializer()
+ {
+ return new MariaDbDeserializer(Logger);
+ }
+ }
+}
diff --git a/src/Promitor.Tests.Unit/Serialization/v1/Providers/RedisEnterpriseCacheDeserializerTests.cs b/src/Promitor.Tests.Unit/Serialization/v1/Providers/RedisEnterpriseCacheDeserializerTests.cs
new file mode 100644
index 000000000..4590ae9be
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Serialization/v1/Providers/RedisEnterpriseCacheDeserializerTests.cs
@@ -0,0 +1,58 @@
+using System.ComponentModel;
+using Promitor.Core.Scraping.Configuration.Serialization;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Providers;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Serialization.v1.Providers
+{
+ [Category("Unit")]
+ public class RedisEnterpriseCacheDeserializerTests : ResourceDeserializerTest
+ {
+ private readonly RedisEnterpriseCacheDeserializer _deserializer;
+
+ public RedisEnterpriseCacheDeserializerTests()
+ {
+ _deserializer = new RedisEnterpriseCacheDeserializer(Logger);
+ }
+
+ [Fact]
+ public void Deserialize_CacheNameSupplied_SetsCacheName()
+ {
+ const string cacheName = "promitor-cache";
+ YamlAssert.PropertySet(
+ _deserializer,
+ $"cacheName: {cacheName}",
+ cacheName,
+ r => r.CacheName);
+ }
+
+ [Fact]
+ public void Deserialize_CacheNameNotSupplied_Null()
+ {
+ YamlAssert.PropertyNull(
+ _deserializer,
+ "resourceGroupName: promitor-group",
+ r => r.CacheName);
+ }
+
+ [Fact]
+ public void Deserialize_CacheNameNotSupplied_ReportsError()
+ {
+ // Arrange
+ var node = YamlUtils.CreateYamlNode("resourceGroupName: promitor-resource-group");
+
+ // Act / Assert
+ YamlAssert.ReportsErrorForProperty(
+ _deserializer,
+ node,
+ "cacheName");
+ }
+
+ protected override IDeserializer CreateDeserializer()
+ {
+ return new RedisEnterpriseCacheDeserializer(Logger);
+ }
+ }
+}
diff --git a/src/Promitor.Tests.Unit/Serialization/v1/Providers/VirtualNetworkDeserializerTests.cs b/src/Promitor.Tests.Unit/Serialization/v1/Providers/VirtualNetworkDeserializerTests.cs
new file mode 100644
index 000000000..f50a622d2
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Serialization/v1/Providers/VirtualNetworkDeserializerTests.cs
@@ -0,0 +1,57 @@
+using System.ComponentModel;
+using Promitor.Core.Scraping.Configuration.Serialization;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes;
+using Promitor.Core.Scraping.Configuration.Serialization.v1.Providers;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Serialization.v1.Providers
+{
+ [Category("Unit")]
+ public class VirtualNetworkDeserializerTests : ResourceDeserializerTest
+ {
+ private readonly VirtualNetworkDeserializer _deserializer;
+
+ public VirtualNetworkDeserializerTests()
+ {
+ _deserializer = new VirtualNetworkDeserializer(Logger);
+ }
+
+ [Fact]
+ public void Deserialize_VirtualNetworkNameSupplied_SetsName()
+ {
+ YamlAssert.PropertySet(
+ _deserializer,
+ "virtualNetworkName: promitor-vnet",
+ "promitor-vnet",
+ r => r.VirtualNetworkName);
+ }
+
+ [Fact]
+ public void Deserialize_VirtualNetworkNameNotSupplied_Null()
+ {
+ YamlAssert.PropertyNull(
+ _deserializer,
+ "resourceGroupName: promitor-group",
+ r => r.VirtualNetworkName);
+ }
+
+ [Fact]
+ public void Deserialize_VirtualNetworkNameNotSupplied_ReportsError()
+ {
+ // Arrange
+ var node = YamlUtils.CreateYamlNode("resourceGroupName: promitor-group");
+
+ // Act / Assert
+ YamlAssert.ReportsErrorForProperty(
+ _deserializer,
+ node,
+ "virtualNetworkName");
+ }
+
+ protected override IDeserializer CreateDeserializer()
+ {
+ return new VirtualNetworkDeserializer(Logger);
+ }
+ }
+}
diff --git a/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/CdnMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/CdnMetricsDeclarationValidationStepsTests.cs
new file mode 100644
index 000000000..25c405d71
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/CdnMetricsDeclarationValidationStepsTests.cs
@@ -0,0 +1,152 @@
+using System.ComponentModel;
+using Microsoft.Extensions.Logging.Abstractions;
+using Promitor.Agents.Scraper.Validation.Steps;
+using Promitor.Tests.Unit.Builders.Metrics.v1;
+using Promitor.Tests.Unit.Stubs;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Validation.Scraper.Metrics.ResourceTypes
+{
+ [Category("Unit")]
+ public class CdnMetricsDeclarationValidationStepTests : MetricsDeclarationValidationStepsTests
+ {
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(azureMetricName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(10001)]
+ public void CdnMetricsDeclaration_DeclarationWithInvalidMetricLimit_Fails(int metricLimit)
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(azureMetricLimit: metricLimit)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutMetricDescription_Succeeded()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(metricDescription: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutCdnName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(cdnName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscoveryGroupInfo_Fails()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(omitResource: true)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_DeclarationWithoutResourceButWithResourceDiscoveryGroupInfo_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric(omitResource: true, resourceDiscoveryGroupName:"sample-collection")
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void CdnMetricsDeclaration_ValidDeclaration_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithCdnMetric()
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/LoadBalancerMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/LoadBalancerMetricsDeclarationValidationStepsTests.cs
new file mode 100644
index 000000000..875e13094
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/LoadBalancerMetricsDeclarationValidationStepsTests.cs
@@ -0,0 +1,152 @@
+using System.ComponentModel;
+using Microsoft.Extensions.Logging.Abstractions;
+using Promitor.Agents.Scraper.Validation.Steps;
+using Promitor.Tests.Unit.Builders.Metrics.v1;
+using Promitor.Tests.Unit.Stubs;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Validation.Scraper.Metrics.ResourceTypes
+{
+ [Category("Unit")]
+ public class LoadBalancerMetricsDeclarationValidationStepTests : MetricsDeclarationValidationStepsTests
+ {
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(azureMetricName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(10001)]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithInvalidMetricLimit_Fails(int metricLimit)
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(azureMetricLimit: metricLimit)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutMetricDescription_Succeeded()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(metricDescription: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutLoadBalancerName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(loadBalancerName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscoveryGroupInfo_Fails()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(omitResource: true)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_DeclarationWithoutResourceButWithResourceDiscoveryGroupInfo_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric(omitResource: true, resourceDiscoveryGroupName:"sample-collection")
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void LoadBalancerMetricsDeclaration_ValidDeclaration_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithLoadBalancerMetric()
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/MariaDbMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/MariaDbMetricsDeclarationValidationStepsTests.cs
new file mode 100644
index 000000000..9e080cfc0
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/MariaDbMetricsDeclarationValidationStepsTests.cs
@@ -0,0 +1,152 @@
+using System.ComponentModel;
+using Microsoft.Extensions.Logging.Abstractions;
+using Promitor.Agents.Scraper.Validation.Steps;
+using Promitor.Tests.Unit.Builders.Metrics.v1;
+using Promitor.Tests.Unit.Stubs;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Validation.Scraper.Metrics.ResourceTypes
+{
+ [Category("Unit")]
+ public class MariaDbMetricsDeclarationValidationStepTests : MetricsDeclarationValidationStepsTests
+ {
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(azureMetricName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(10001)]
+ public void MariaDbMetricsDeclaration_DeclarationWithInvalidMetricLimit_Fails(int metricLimit)
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(azureMetricLimit: metricLimit)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutMetricDescription_Succeeded()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(metricDescription: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutMariaDbName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(serverName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscoveryGroupInfo_Fails()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(omitResource: true)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_DeclarationWithoutResourceButWithResourceDiscoveryGroupInfo_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric(omitResource: true, resourceDiscoveryGroupName:"sample-collection")
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void MariaDbMetricsDeclaration_ValidDeclaration_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithMariaDbMetric()
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/RedisEnterpriseCacheMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/RedisEnterpriseCacheMetricsDeclarationValidationStepsTests.cs
new file mode 100644
index 000000000..3e2f72e28
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/RedisEnterpriseCacheMetricsDeclarationValidationStepsTests.cs
@@ -0,0 +1,152 @@
+using System.ComponentModel;
+using Microsoft.Extensions.Logging.Abstractions;
+using Promitor.Agents.Scraper.Validation.Steps;
+using Promitor.Tests.Unit.Builders.Metrics.v1;
+using Promitor.Tests.Unit.Stubs;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Validation.Scraper.Metrics.ResourceTypes
+{
+ [Category("Unit")]
+ public class RedisEnterpriseCacheMetricsDeclarationValidationStepTests : MetricsDeclarationValidationStepsTests
+ {
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(azureMetricName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(10001)]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithInvalidMetricLimit_Fails(int metricLimit)
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(azureMetricLimit: metricLimit)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutMetricDescription_Succeeded()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(metricDescription: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutRedisEnterpriseCacheName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(cacheName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscoveryGroupInfo_Fails()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(omitResource: true)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_DeclarationWithoutResourceButWithResourceDiscoveryGroupInfo_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric(omitResource: true, resourceDiscoveryGroupName:"sample-collection")
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void RedisEnterpriseCacheMetricsDeclaration_ValidDeclaration_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithRedisEnterpriseCacheMetric()
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/VirtualNetworkMetricsDeclarationValidationStepsTests.cs b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/VirtualNetworkMetricsDeclarationValidationStepsTests.cs
new file mode 100644
index 000000000..cd5c3243d
--- /dev/null
+++ b/src/Promitor.Tests.Unit/Validation/Scraper/Metrics/ResourceTypes/VirtualNetworkMetricsDeclarationValidationStepsTests.cs
@@ -0,0 +1,152 @@
+using System.ComponentModel;
+using Microsoft.Extensions.Logging.Abstractions;
+using Promitor.Agents.Scraper.Validation.Steps;
+using Promitor.Tests.Unit.Builders.Metrics.v1;
+using Promitor.Tests.Unit.Stubs;
+using Xunit;
+
+namespace Promitor.Tests.Unit.Validation.Scraper.Metrics.ResourceTypes
+{
+ [Category("Unit")]
+ public class VirtualNetworkMetricsDeclarationValidationStepTests : MetricsDeclarationValidationStepsTests
+ {
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutAzureMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(azureMetricName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Theory]
+ [InlineData(-1)]
+ [InlineData(0)]
+ [InlineData(10001)]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithInvalidMetricLimit_Fails(int metricLimit)
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(azureMetricLimit: metricLimit)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutMetricDescription_Succeeded()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(metricDescription: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutMetricName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutVirtualNetworkName_Fails()
+ {
+ // Arrange
+ var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(virtualNetworkName: string.Empty)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutResourceAndResourceDiscoveryGroupInfo_Fails()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(omitResource: true)
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationFailed(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_DeclarationWithoutResourceButWithResourceDiscoveryGroupInfo_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric(omitResource: true, resourceDiscoveryGroupName:"sample-collection")
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+
+ [Fact]
+ public void VirtualNetworkMetricsDeclaration_ValidDeclaration_Succeeds()
+ {
+ // Arrange
+ var rawMetricsDeclaration = MetricsDeclarationBuilder.WithMetadata()
+ .WithVirtualNetworkMetric()
+ .Build(Mapper);
+ var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawMetricsDeclaration, Mapper);
+
+ // Act
+ var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger.Instance);
+ var validationResult = scrapingScheduleValidationStep.Run();
+
+ // Assert
+ PromitorAssert.ValidationIsSuccessful(validationResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/docker-compose.yml b/src/docker-compose.yml
index 1a0817226..8aee5ba29 100644
--- a/src/docker-compose.yml
+++ b/src/docker-compose.yml
@@ -21,39 +21,39 @@ services:
volumes:
- ./../config/promitor/scraper/metrics.yaml:/config/metrics-declaration.yaml
- ./../config/promitor/scraper/runtime.yaml:/config/runtime.yaml
- #prometheus:
- # image: prom/prometheus:latest
- # container_name: prometheus
- # ports:
- # - 9090:9090
- # command:
- # - --config.file=/etc/prometheus/prometheus.yml
- # volumes:
- # - ./../config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- # depends_on:
- # - promitor.agents.scraper
- #graphite:
- # image: graphiteapp/graphite-statsd
- # container_name: graphite
- # restart: always
- # ports:
- # - 2000:80
- # - 2003:2003
- # - 2004:2004
- # - 2023:2023
- # - 2024:2024
- # - 8125:8125/udp
- # - 8126:8126
- #grafana:
- # image: grafana/grafana
- # container_name: grafana
- # links:
- # - prometheus
- # - graphite
- # ports:
- # - 3000:3000
- # volumes:
- # - ./../config/grafana/datasources.yml:/etc/grafana/provisioning/datasources/promitor.yml
- # - ./../config/grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/promitor.yml
- # - ./../config/grafana/dashboard-config.json:/var/lib/grafana/dashboards/promitor.json
- # - ./../config/grafana/grafana.ini:/etc/grafana/grafana.ini
\ No newline at end of file
+ prometheus:
+ image: prom/prometheus:latest
+ container_name: prometheus
+ ports:
+ - 9090:9090
+ command:
+ - --config.file=/etc/prometheus/prometheus.yml
+ volumes:
+ - ./../config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
+ depends_on:
+ - promitor.agents.scraper
+ graphite:
+ image: graphiteapp/graphite-statsd
+ container_name: graphite
+ restart: always
+ ports:
+ - 2000:80
+ - 2003:2003
+ - 2004:2004
+ - 2023:2023
+ - 2024:2024
+ - 8125:8125/udp
+ - 8126:8126
+ grafana:
+ image: grafana/grafana
+ container_name: grafana
+ links:
+ - prometheus
+ - graphite
+ ports:
+ - 3000:3000
+ volumes:
+ - ./../config/grafana/datasources.yml:/etc/grafana/provisioning/datasources/promitor.yml
+ - ./../config/grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/promitor.yml
+ - ./../config/grafana/dashboard-config.json:/var/lib/grafana/dashboards/promitor.json
+ - ./../config/grafana/grafana.ini:/etc/grafana/grafana.ini
\ No newline at end of file