Scheduled Query Rules Log Args
data class ScheduledQueryRulesLogArgs(val authorizedResourceIds: Output<List<String>>? = null, val criteria: Output<ScheduledQueryRulesLogCriteriaArgs>? = null, val dataSourceId: Output<String>? = null, val description: Output<String>? = null, val enabled: Output<Boolean>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<ScheduledQueryRulesLogArgs>
Manages a LogToMetricAction Scheduled Query Rules resource within Azure Monitor.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
import com.pulumi.azure.monitoring.ActionGroup;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
import com.pulumi.azure.monitoring.MetricAlert;
import com.pulumi.azure.monitoring.MetricAlertArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertCriteriaArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertActionArgs;
import com.pulumi.azure.monitoring.ScheduledQueryRulesLog;
import com.pulumi.azure.monitoring.ScheduledQueryRulesLogArgs;
import com.pulumi.azure.monitoring.inputs.ScheduledQueryRulesLogCriteriaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("monitoring-resources")
.location("West Europe")
.build());
var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
.name("loganalytics")
.location(example.location())
.resourceGroupName(example.name())
.sku("PerGB2018")
.retentionInDays(30)
.build());
var exampleActionGroup = new ActionGroup("exampleActionGroup", ActionGroupArgs.builder()
.name("example-actiongroup")
.resourceGroupName(example.name())
.shortName("exampleact")
.webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
.name("callmyapi")
.serviceUri("http://example.com/alert")
.build())
.build());
var exampleMetricAlert = new MetricAlert("exampleMetricAlert", MetricAlertArgs.builder()
.name("example-metricalert")
.resourceGroupName(example.name())
.scopes(exampleAnalyticsWorkspace.id())
.description("Action will be triggered when Average_% Idle Time metric is less than 10.")
.frequency("PT1M")
.windowSize("PT5M")
.criterias(MetricAlertCriteriaArgs.builder()
.metricNamespace("Microsoft.OperationalInsights/workspaces")
.metricName("UsedCapacity")
.aggregation("Average")
.operator("LessThan")
.threshold(10)
.build())
.actions(MetricAlertActionArgs.builder()
.actionGroupId(exampleActionGroup.id())
.build())
.build());
var exampleScheduledQueryRulesLog = new ScheduledQueryRulesLog("exampleScheduledQueryRulesLog", ScheduledQueryRulesLogArgs.builder()
.name("example")
.location(example.location())
.resourceGroupName(example.name())
.criteria(ScheduledQueryRulesLogCriteriaArgs.builder()
.metricName("Average_% Idle Time")
.dimensions(ScheduledQueryRulesLogCriteriaDimensionArgs.builder()
.name("Computer")
.operator("Include")
.values("targetVM")
.build())
.build())
.dataSourceId(exampleAnalyticsWorkspace.id())
.description("Scheduled query rule LogToMetric example")
.enabled(true)
.tags(Map.of("foo", "bar"))
.build());
}
}
Content copied to clipboard
Import
Scheduled Query Rule Log can be imported using the resource id
, e.g.
$ pulumi import azure:monitoring/scheduledQueryRulesLog:ScheduledQueryRulesLog example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/scheduledQueryRules/myrulename
Content copied to clipboard
Constructors
Link copied to clipboard
fun ScheduledQueryRulesLogArgs(authorizedResourceIds: Output<List<String>>? = null, criteria: Output<ScheduledQueryRulesLogCriteriaArgs>? = null, dataSourceId: Output<String>? = null, description: Output<String>? = null, enabled: Output<Boolean>? = null, location: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, tags: Output<Map<String, String>>? = null)