harness.platform.MonitoredService
Explore with Pulumi AI
Resource for creating a monitored service.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
//Sample template for Elastic Search Log Health Source
const example = new harness.platform.MonitoredService("example", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "name",
identifier: "identifier",
type: "ElasticSearch",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "error_4xx",
identifier: "error_4xx_id",
query: "Bad Request",
index: "index",
groupName: "Logs_Group",
queryParams: {
index: "index",
serviceInstanceField: "serviceInstanceIdentifier",
timeStampIdentifier: "timeStampIdentifier",
timeStampFormat: "timeStampFormat",
messageIdentifier: "messageIdentifier",
},
},
{
name: "error_5xx",
identifier: "error_5xx_id",
query: "Internal Server Error",
index: "index2",
groupName: "Logs_Group",
queryParams: {
index: "index",
serviceInstanceField: "serviceInstanceIdentifier",
timeStampIdentifier: "timeStampIdentifier",
timeStampFormat: "timeStampFormat",
messageIdentifier: "messageIdentifier",
},
},
],
}),
}],
changeSources: [
{
name: "BAC",
identifier: "BAC",
type: "PagerDuty",
enabled: true,
spec: JSON.stringify({
connectorRef: "account.pd",
pagerDutyServiceId: "P0N21OB",
}),
category: "Alert",
},
{
name: "FH",
identifier: "FH",
type: "CustomIncident",
enabled: true,
spec: JSON.stringify({
name: "FH",
webhookUrl: "https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH",
webhookCurlCommand: "curl -X POST -H 'content-type: application/json' -H 'X-Api-Key: sample_api_key' --url 'https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH' -d '{ \"eventIdentifier\": \"<string>\" (optional), \"user\": \"user@harness.io\", \"startTime\": timeInMs, \"endTime\": timeInMs, \"eventDetail\": { \"description\": \"<String>\", \"changeEventDetailsLink\": \"urlString\" (optional), \"externalLinkToEntity\": \"urlString\" (optional), \"name\": \"changeEventName\" } }'",
type: "Alert",
}),
category: "Alert",
},
{
name: "customff",
identifier: "customff",
type: "CustomFF",
enabled: true,
category: "FeatureFlag",
spec: JSON.stringify({
type: "FeatureFlag",
}),
},
{
name: "customdeploy",
identifier: "customdeploy",
type: "CustomDeploy",
enabled: true,
category: "Deployment",
spec: JSON.stringify({
type: "Deployment",
}),
},
{
name: "customincident",
identifier: "customincident",
type: "CustomIncident",
enabled: true,
category: "Alert",
spec: JSON.stringify({
type: "Alert",
authorizationToken: "abc",
}),
},
],
notificationRuleRefs: [
{
notificationRuleRef: "notification_rule_ref",
enabled: true,
},
{
notificationRuleRef: "notification_rule_ref1",
enabled: false,
},
],
},
});
//Sample template for Sumologic Metrics Health Source
const example1 = new harness.platform.MonitoredService("example1", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "sumologicmetrics",
identifier: "sumo_metric_identifier",
type: "SumologicMetrics",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "metric_cpu",
identifier: "metric_cpu",
query: "metric=cpu",
groupName: "g1",
queryParams: {
serviceInstanceField: "_sourcehost",
},
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
liveMonitoringEnabled: "true",
continuousVerificationEnabled: "true",
sliEnabled: "false",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "metric_cpu",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "metric_cpu",
},
],
},
{
name: "name2",
identifier: "identifier2",
groupName: "g2",
query: "metric=memory",
queryParams: {
serviceInstanceField: "_sourcehost",
},
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
liveMonitoringEnabled: "false",
continuousVerificationEnabled: "false",
sliEnabled: "false",
},
],
}),
}],
},
});
//Sample template for Sumologic Log Health Source
const example2 = new harness.platform.MonitoredService("example2", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "sumologic",
identifier: "sumo_metric_identifier",
type: "SumologicLogs",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "log1",
identifier: "log1",
query: "*",
groupName: "Logs Group",
queryParams: {
serviceInstanceField: "_sourcehost",
},
},
{
name: "log2",
identifier: "identifier2",
groupName: "g2",
query: "error",
queryParams: {
serviceInstanceField: "_sourcehost",
},
},
],
}),
}],
},
});
//Sample template for Splunk Signal FX Health Source
const example3 = new harness.platform.MonitoredService("example3", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "signalfxmetrics",
identifier: "signalfxmetrics",
type: "SplunkSignalFXMetrics",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "metric_infra_cpu",
identifier: "metric_infra_cpu",
query: "***",
groupName: "g",
riskProfile: {
riskCategory: "Errors",
thresholdTypes: [
"ACT_WHEN_HIGHER",
"ACT_WHEN_LOWER",
],
},
liveMonitoringEnabled: "true",
continuousVerificationEnabled: "true",
sliEnabled: "false",
},
{
name: "name2",
identifier: "identifier2",
groupName: "g2",
query: "*",
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
liveMonitoringEnabled: "true",
continuousVerificationEnabled: "false",
sliEnabled: "false",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metrictype: "Custom",
metricName: "identifier2",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "identifier2",
},
],
},
],
}),
}],
},
});
//Sample template for Grafana Loki Log Health Source
const example4 = new harness.platform.MonitoredService("example4", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "Test",
identifier: "Test",
type: "GrafanaLokiLogs",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "Demo",
identifier: "Demo",
query: "{job=~\".+\"}",
groupName: "Log_Group",
queryParams: {
serviceInstanceField: "job",
},
},
{
name: "log2",
identifier: "identifier2",
groupName: "g2",
query: "error",
queryParams: {
serviceInstanceField: "_sourcehost",
},
liveMonitoringEnabled: "false",
continuousVerificationEnabled: "false",
sliEnabled: "false",
},
],
}),
}],
},
});
//Sample template for Azure Metrics Health Source
const example5 = new harness.platform.MonitoredService("example5", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "azure metrics verify step",
identifier: "azure_metrics_verify_step",
type: "AzureMetrics",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [
{
name: "metric",
identifier: "metric",
query: "default",
groupName: "g1",
queryParams: {
serviceInstanceField: "host",
index: "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
healthSourceMetricName: "cpuUsagePercentage",
healthSourceMetricNamespace: "insights.container/nodes",
aggregationType: "average",
},
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
liveMonitoringEnabled: "true",
continuousVerificationEnabled: "true",
sliEnabled: "false",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metrictype: "Custom",
metricName: "metric",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "metric",
},
],
},
{
name: "name2",
identifier: "identifier2",
groupName: "g2",
queryParams: {
serviceInstanceField: "host",
index: "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
healthSourceMetricName: "cpuUsagePercentage",
healthSourceMetricNamespace: "insights.container/nodes",
aggregationType: "average",
},
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
liveMonitoringEnabled: "false",
continuousVerificationEnabled: "false",
sliEnabled: "false",
},
],
}),
}],
},
});
//Sample template for Azure Log Health Source
const example6 = new harness.platform.MonitoredService("example6", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "Demo azure",
identifier: "Demo_azure",
type: "AzureLogs",
version: "v2",
spec: JSON.stringify({
connectorRef: "connectorRef",
queryDefinitions: [{
name: "name2",
identifier: "identifier2",
groupName: "g2",
query: "*",
queryParams: {
serviceInstanceField: "Name",
timeStampIdentifier: "StartedTime",
messageIdentifier: "Image",
index: "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
},
liveMonitoringEnabled: "false",
continuousVerificationEnabled: "false",
}],
}),
}],
},
});
//Sample template for Prometheus Metrics Health Source
const example7 = new harness.platform.MonitoredService("example7", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "prometheus metrics verify step",
identifier: "prometheus_metrics",
type: "Prometheus",
spec: JSON.stringify({
connectorRef: "connectorRef",
metricDefinitions: [{
identifier: "Prometheus_Metric",
metricName: "Prometheus Metric",
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
analysis: {
liveMonitoring: {
enabled: true,
},
deploymentVerification: {
enabled: true,
serviceInstanceFieldName: "pod_name",
},
},
query: "count(up{group=\"cv\",group=\"cv\"})",
groupName: "met",
isManualQuery: true,
}],
metricPacks: [{
identifier: "Custom",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metrictype: "Custom",
metricName: "Prometheus Metric",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "Prometheus Metric",
},
],
}],
}),
}],
},
});
//Sample template for Datadog Metrics Health Source
const example8 = new harness.platform.MonitoredService("example8", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "ddm",
identifier: "ddm",
type: "DatadogMetrics",
spec: JSON.stringify({
connectorRef: "connectorRef",
feature: "Datadog Cloud Metrics",
metricDefinitions: [
{
metricName: "metric",
metricPath: "M1",
identifier: "metric",
query: `avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10`,
isManualQuery: true,
isCustomCreatedMetric: true,
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
analysis: {
liveMonitoring: {
enabled: true,
},
deploymentVerification: {
enabled: true,
serviceInstanceFieldName: "pod",
},
},
},
{
metricName: "dashboard_metric_cpu",
identifier: "metric_cpu",
query: `avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10`,
isManualQuery: false,
dashboardName: "dashboard",
metricPath: "M1",
groupingQuery: "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)",
metric: "kubernetes.cpu.limits",
aggregation: "avg",
isCustomCreatedMetric: true,
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
analysis: {
liveMonitoring: {
enabled: true,
},
deploymentVerification: {
enabled: true,
serviceInstanceFieldName: "pod",
},
},
},
],
metricPacks: [{
identifier: "Custom",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metrictype: "Custom",
metricName: "metric",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "metric",
},
],
}],
}),
}],
},
});
//Sample template for New Relic Metrics Health Source
const example9 = new harness.platform.MonitoredService("example9", {
orgId: "org_id",
projectId: "project_id",
identifier: "identifier",
request: {
name: "name",
type: "Application",
description: "description",
serviceRef: "service_ref",
environmentRef: "environment_ref",
tags: [
"foo:bar",
"bar:foo",
],
healthSources: [{
name: "name",
identifier: "identifier",
type: "NewRelic",
spec: JSON.stringify({
connectorRef: "account.Newrelicautomation_do_not_delete",
feature: "apm",
applicationId: "107019083",
applicationName: "My Application",
metricData: {
Performance: true,
},
metricPacks: [{
identifier: "Performance",
}],
newRelicMetricDefinitions: [{
identifier: "New_Relic_Metric",
metricName: "New Relic Metric",
riskProfile: {
riskCategory: "Performance_Other",
thresholdTypes: ["ACT_WHEN_HIGHER"],
},
analysis: {
deploymentVerification: {
enabled: true,
},
},
groupName: "group1",
nrql: "SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES",
responseMapping: {
metricValueJsonPath: "$.['timeSeries'].[*].['results'].[*].['count']",
timestampJsonPath: "$.['timeSeries'].[*].['beginTimeSeconds']",
},
}],
metricPacks: [{
identifier: "Custom",
metricThresholds: [
{
type: "IgnoreThreshold",
spec: {
action: "Ignore",
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "New Relic Metric",
},
{
type: "FailImmediately",
spec: {
action: "FailAfterOccurrence",
spec: {
count: 2,
},
},
criteria: {
type: "Absolute",
spec: {
greaterThan: 100,
},
},
metricType: "Custom",
metricName: "New Relic Metric",
},
],
}],
}),
}],
},
});
import pulumi
import json
import pulumi_harness as harness
#Sample template for Elastic Search Log Health Source
example = harness.platform.MonitoredService("example",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "name",
"identifier": "identifier",
"type": "ElasticSearch",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "error_4xx",
"identifier": "error_4xx_id",
"query": "Bad Request",
"index": "index",
"groupName": "Logs_Group",
"queryParams": {
"index": "index",
"serviceInstanceField": "serviceInstanceIdentifier",
"timeStampIdentifier": "timeStampIdentifier",
"timeStampFormat": "timeStampFormat",
"messageIdentifier": "messageIdentifier",
},
},
{
"name": "error_5xx",
"identifier": "error_5xx_id",
"query": "Internal Server Error",
"index": "index2",
"groupName": "Logs_Group",
"queryParams": {
"index": "index",
"serviceInstanceField": "serviceInstanceIdentifier",
"timeStampIdentifier": "timeStampIdentifier",
"timeStampFormat": "timeStampFormat",
"messageIdentifier": "messageIdentifier",
},
},
],
}),
}],
"change_sources": [
{
"name": "BAC",
"identifier": "BAC",
"type": "PagerDuty",
"enabled": True,
"spec": json.dumps({
"connectorRef": "account.pd",
"pagerDutyServiceId": "P0N21OB",
}),
"category": "Alert",
},
{
"name": "FH",
"identifier": "FH",
"type": "CustomIncident",
"enabled": True,
"spec": json.dumps({
"name": "FH",
"webhookUrl": "https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH",
"webhookCurlCommand": "curl -X POST -H 'content-type: application/json' -H 'X-Api-Key: sample_api_key' --url 'https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH' -d '{ \"eventIdentifier\": \"<string>\" (optional), \"user\": \"user@harness.io\", \"startTime\": timeInMs, \"endTime\": timeInMs, \"eventDetail\": { \"description\": \"<String>\", \"changeEventDetailsLink\": \"urlString\" (optional), \"externalLinkToEntity\": \"urlString\" (optional), \"name\": \"changeEventName\" } }'",
"type": "Alert",
}),
"category": "Alert",
},
{
"name": "customff",
"identifier": "customff",
"type": "CustomFF",
"enabled": True,
"category": "FeatureFlag",
"spec": json.dumps({
"type": "FeatureFlag",
}),
},
{
"name": "customdeploy",
"identifier": "customdeploy",
"type": "CustomDeploy",
"enabled": True,
"category": "Deployment",
"spec": json.dumps({
"type": "Deployment",
}),
},
{
"name": "customincident",
"identifier": "customincident",
"type": "CustomIncident",
"enabled": True,
"category": "Alert",
"spec": json.dumps({
"type": "Alert",
"authorizationToken": "abc",
}),
},
],
"notification_rule_refs": [
{
"notification_rule_ref": "notification_rule_ref",
"enabled": True,
},
{
"notification_rule_ref": "notification_rule_ref1",
"enabled": False,
},
],
})
#Sample template for Sumologic Metrics Health Source
example1 = harness.platform.MonitoredService("example1",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "sumologicmetrics",
"identifier": "sumo_metric_identifier",
"type": "SumologicMetrics",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "metric_cpu",
"identifier": "metric_cpu",
"query": "metric=cpu",
"groupName": "g1",
"queryParams": {
"serviceInstanceField": "_sourcehost",
},
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric_cpu",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric_cpu",
},
],
},
{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "metric=memory",
"queryParams": {
"serviceInstanceField": "_sourcehost",
},
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
],
}),
}],
})
#Sample template for Sumologic Log Health Source
example2 = harness.platform.MonitoredService("example2",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "sumologic",
"identifier": "sumo_metric_identifier",
"type": "SumologicLogs",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "log1",
"identifier": "log1",
"query": "*",
"groupName": "Logs Group",
"queryParams": {
"serviceInstanceField": "_sourcehost",
},
},
{
"name": "log2",
"identifier": "identifier2",
"groupName": "g2",
"query": "error",
"queryParams": {
"serviceInstanceField": "_sourcehost",
},
},
],
}),
}],
})
#Sample template for Splunk Signal FX Health Source
example3 = harness.platform.MonitoredService("example3",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "signalfxmetrics",
"identifier": "signalfxmetrics",
"type": "SplunkSignalFXMetrics",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "metric_infra_cpu",
"identifier": "metric_infra_cpu",
"query": "***",
"groupName": "g",
"riskProfile": {
"riskCategory": "Errors",
"thresholdTypes": [
"ACT_WHEN_HIGHER",
"ACT_WHEN_LOWER",
],
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
},
{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "*",
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "identifier2",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "identifier2",
},
],
},
],
}),
}],
})
#Sample template for Grafana Loki Log Health Source
example4 = harness.platform.MonitoredService("example4",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "Test",
"identifier": "Test",
"type": "GrafanaLokiLogs",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "Demo",
"identifier": "Demo",
"query": "{job=~\".+\"}",
"groupName": "Log_Group",
"queryParams": {
"serviceInstanceField": "job",
},
},
{
"name": "log2",
"identifier": "identifier2",
"groupName": "g2",
"query": "error",
"queryParams": {
"serviceInstanceField": "_sourcehost",
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
],
}),
}],
})
#Sample template for Azure Metrics Health Source
example5 = harness.platform.MonitoredService("example5",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "azure metrics verify step",
"identifier": "azure_metrics_verify_step",
"type": "AzureMetrics",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [
{
"name": "metric",
"identifier": "metric",
"query": "default",
"groupName": "g1",
"queryParams": {
"serviceInstanceField": "host",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
"healthSourceMetricName": "cpuUsagePercentage",
"healthSourceMetricNamespace": "insights.container/nodes",
"aggregationType": "average",
},
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "metric",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric",
},
],
},
{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"queryParams": {
"serviceInstanceField": "host",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
"healthSourceMetricName": "cpuUsagePercentage",
"healthSourceMetricNamespace": "insights.container/nodes",
"aggregationType": "average",
},
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
],
}),
}],
})
#Sample template for Azure Log Health Source
example6 = harness.platform.MonitoredService("example6",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "Demo azure",
"identifier": "Demo_azure",
"type": "AzureLogs",
"version": "v2",
"spec": json.dumps({
"connectorRef": "connectorRef",
"queryDefinitions": [{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "*",
"queryParams": {
"serviceInstanceField": "Name",
"timeStampIdentifier": "StartedTime",
"messageIdentifier": "Image",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
}],
}),
}],
})
#Sample template for Prometheus Metrics Health Source
example7 = harness.platform.MonitoredService("example7",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "prometheus metrics verify step",
"identifier": "prometheus_metrics",
"type": "Prometheus",
"spec": json.dumps({
"connectorRef": "connectorRef",
"metricDefinitions": [{
"identifier": "Prometheus_Metric",
"metricName": "Prometheus Metric",
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"analysis": {
"liveMonitoring": {
"enabled": True,
},
"deploymentVerification": {
"enabled": True,
"serviceInstanceFieldName": "pod_name",
},
},
"query": "count(up{group=\"cv\",group=\"cv\"})",
"groupName": "met",
"isManualQuery": True,
}],
"metricPacks": [{
"identifier": "Custom",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "Prometheus Metric",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "Prometheus Metric",
},
],
}],
}),
}],
})
#Sample template for Datadog Metrics Health Source
example8 = harness.platform.MonitoredService("example8",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "ddm",
"identifier": "ddm",
"type": "DatadogMetrics",
"spec": json.dumps({
"connectorRef": "connectorRef",
"feature": "Datadog Cloud Metrics",
"metricDefinitions": [
{
"metricName": "metric",
"metricPath": "M1",
"identifier": "metric",
"query": """avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10""",
"isManualQuery": True,
"isCustomCreatedMetric": True,
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"analysis": {
"liveMonitoring": {
"enabled": True,
},
"deploymentVerification": {
"enabled": True,
"serviceInstanceFieldName": "pod",
},
},
},
{
"metricName": "dashboard_metric_cpu",
"identifier": "metric_cpu",
"query": """avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10""",
"isManualQuery": False,
"dashboardName": "dashboard",
"metricPath": "M1",
"groupingQuery": "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)",
"metric": "kubernetes.cpu.limits",
"aggregation": "avg",
"isCustomCreatedMetric": True,
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"analysis": {
"liveMonitoring": {
"enabled": True,
},
"deploymentVerification": {
"enabled": True,
"serviceInstanceFieldName": "pod",
},
},
},
],
"metricPacks": [{
"identifier": "Custom",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "metric",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric",
},
],
}],
}),
}],
})
#Sample template for New Relic Metrics Health Source
example9 = harness.platform.MonitoredService("example9",
org_id="org_id",
project_id="project_id",
identifier="identifier",
request={
"name": "name",
"type": "Application",
"description": "description",
"service_ref": "service_ref",
"environment_ref": "environment_ref",
"tags": [
"foo:bar",
"bar:foo",
],
"health_sources": [{
"name": "name",
"identifier": "identifier",
"type": "NewRelic",
"spec": json.dumps({
"connectorRef": "account.Newrelicautomation_do_not_delete",
"feature": "apm",
"applicationId": "107019083",
"applicationName": "My Application",
"metricData": {
"Performance": True,
},
"metricPacks": [{
"identifier": "Performance",
}],
"newRelicMetricDefinitions": [{
"identifier": "New_Relic_Metric",
"metricName": "New Relic Metric",
"riskProfile": {
"riskCategory": "Performance_Other",
"thresholdTypes": ["ACT_WHEN_HIGHER"],
},
"analysis": {
"deploymentVerification": {
"enabled": True,
},
},
"groupName": "group1",
"nrql": "SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES",
"responseMapping": {
"metricValueJsonPath": "$.['timeSeries'].[*].['results'].[*].['count']",
"timestampJsonPath": "$.['timeSeries'].[*].['beginTimeSeconds']",
},
}],
"metricPacks": [{
"identifier": "Custom",
"metricThresholds": [
{
"type": "IgnoreThreshold",
"spec": {
"action": "Ignore",
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "New Relic Metric",
},
{
"type": "FailImmediately",
"spec": {
"action": "FailAfterOccurrence",
"spec": {
"count": 2,
},
},
"criteria": {
"type": "Absolute",
"spec": {
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "New Relic Metric",
},
],
}],
}),
}],
})
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-harness/sdk/go/harness/platform"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []map[string]interface{}{
map[string]interface{}{
"name": "error_4xx",
"identifier": "error_4xx_id",
"query": "Bad Request",
"index": "index",
"groupName": "Logs_Group",
"queryParams": map[string]interface{}{
"index": "index",
"serviceInstanceField": "serviceInstanceIdentifier",
"timeStampIdentifier": "timeStampIdentifier",
"timeStampFormat": "timeStampFormat",
"messageIdentifier": "messageIdentifier",
},
},
map[string]interface{}{
"name": "error_5xx",
"identifier": "error_5xx_id",
"query": "Internal Server Error",
"index": "index2",
"groupName": "Logs_Group",
"queryParams": map[string]interface{}{
"index": "index",
"serviceInstanceField": "serviceInstanceIdentifier",
"timeStampIdentifier": "timeStampIdentifier",
"timeStampFormat": "timeStampFormat",
"messageIdentifier": "messageIdentifier",
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]interface{}{
"connectorRef": "account.pd",
"pagerDutyServiceId": "P0N21OB",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
tmpJSON2, err := json.Marshal(map[string]interface{}{
"name": "FH",
"webhookUrl": "https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH",
"webhookCurlCommand": "curl -X POST -H 'content-type: application/json' -H 'X-Api-Key: sample_api_key' --url 'https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH' -d '{ \"eventIdentifier\": \"<string>\" (optional), \"user\": \"user@harness.io\", \"startTime\": timeInMs, \"endTime\": timeInMs, \"eventDetail\": { \"description\": \"<String>\", \"changeEventDetailsLink\": \"urlString\" (optional), \"externalLinkToEntity\": \"urlString\" (optional), \"name\": \"changeEventName\" } }'",
"type": "Alert",
})
if err != nil {
return err
}
json2 := string(tmpJSON2)
tmpJSON3, err := json.Marshal(map[string]interface{}{
"type": "FeatureFlag",
})
if err != nil {
return err
}
json3 := string(tmpJSON3)
tmpJSON4, err := json.Marshal(map[string]interface{}{
"type": "Deployment",
})
if err != nil {
return err
}
json4 := string(tmpJSON4)
tmpJSON5, err := json.Marshal(map[string]interface{}{
"type": "Alert",
"authorizationToken": "abc",
})
if err != nil {
return err
}
json5 := string(tmpJSON5)
// Sample template for Elastic Search Log Health Source
_, err = platform.NewMonitoredService(ctx, "example", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("name"),
Identifier: pulumi.String("identifier"),
Type: pulumi.String("ElasticSearch"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json0),
},
},
ChangeSources: platform.MonitoredServiceRequestChangeSourceArray{
&platform.MonitoredServiceRequestChangeSourceArgs{
Name: pulumi.String("BAC"),
Identifier: pulumi.String("BAC"),
Type: pulumi.String("PagerDuty"),
Enabled: pulumi.Bool(true),
Spec: pulumi.String(json1),
Category: pulumi.String("Alert"),
},
&platform.MonitoredServiceRequestChangeSourceArgs{
Name: pulumi.String("FH"),
Identifier: pulumi.String("FH"),
Type: pulumi.String("CustomIncident"),
Enabled: pulumi.Bool(true),
Spec: pulumi.String(json2),
Category: pulumi.String("Alert"),
},
&platform.MonitoredServiceRequestChangeSourceArgs{
Name: pulumi.String("customff"),
Identifier: pulumi.String("customff"),
Type: pulumi.String("CustomFF"),
Enabled: pulumi.Bool(true),
Category: pulumi.String("FeatureFlag"),
Spec: pulumi.String(json3),
},
&platform.MonitoredServiceRequestChangeSourceArgs{
Name: pulumi.String("customdeploy"),
Identifier: pulumi.String("customdeploy"),
Type: pulumi.String("CustomDeploy"),
Enabled: pulumi.Bool(true),
Category: pulumi.String("Deployment"),
Spec: pulumi.String(json4),
},
&platform.MonitoredServiceRequestChangeSourceArgs{
Name: pulumi.String("customincident"),
Identifier: pulumi.String("customincident"),
Type: pulumi.String("CustomIncident"),
Enabled: pulumi.Bool(true),
Category: pulumi.String("Alert"),
Spec: pulumi.String(json5),
},
},
NotificationRuleRefs: platform.MonitoredServiceRequestNotificationRuleRefArray{
&platform.MonitoredServiceRequestNotificationRuleRefArgs{
NotificationRuleRef: pulumi.String("notification_rule_ref"),
Enabled: pulumi.Bool(true),
},
&platform.MonitoredServiceRequestNotificationRuleRefArgs{
NotificationRuleRef: pulumi.String("notification_rule_ref1"),
Enabled: pulumi.Bool(false),
},
},
},
})
if err != nil {
return err
}
tmpJSON6, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []interface{}{
map[string]interface{}{
"name": "metric_cpu",
"identifier": "metric_cpu",
"query": "metric=cpu",
"groupName": "g1",
"queryParams": map[string]interface{}{
"serviceInstanceField": "_sourcehost",
},
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
"metricThresholds": []map[string]interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric_cpu",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric_cpu",
},
},
},
map[string]interface{}{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "metric=memory",
"queryParams": map[string]interface{}{
"serviceInstanceField": "_sourcehost",
},
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
},
})
if err != nil {
return err
}
json6 := string(tmpJSON6)
// Sample template for Sumologic Metrics Health Source
_, err = platform.NewMonitoredService(ctx, "example1", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("sumologicmetrics"),
Identifier: pulumi.String("sumo_metric_identifier"),
Type: pulumi.String("SumologicMetrics"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json6),
},
},
},
})
if err != nil {
return err
}
tmpJSON7, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []map[string]interface{}{
map[string]interface{}{
"name": "log1",
"identifier": "log1",
"query": "*",
"groupName": "Logs Group",
"queryParams": map[string]interface{}{
"serviceInstanceField": "_sourcehost",
},
},
map[string]interface{}{
"name": "log2",
"identifier": "identifier2",
"groupName": "g2",
"query": "error",
"queryParams": map[string]interface{}{
"serviceInstanceField": "_sourcehost",
},
},
},
})
if err != nil {
return err
}
json7 := string(tmpJSON7)
// Sample template for Sumologic Log Health Source
_, err = platform.NewMonitoredService(ctx, "example2", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("sumologic"),
Identifier: pulumi.String("sumo_metric_identifier"),
Type: pulumi.String("SumologicLogs"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json7),
},
},
},
})
if err != nil {
return err
}
tmpJSON8, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []interface{}{
map[string]interface{}{
"name": "metric_infra_cpu",
"identifier": "metric_infra_cpu",
"query": "***",
"groupName": "g",
"riskProfile": map[string]interface{}{
"riskCategory": "Errors",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
"ACT_WHEN_LOWER",
},
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
},
map[string]interface{}{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "*",
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
"metricThresholds": []interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "identifier2",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "identifier2",
},
},
},
},
})
if err != nil {
return err
}
json8 := string(tmpJSON8)
// Sample template for Splunk Signal FX Health Source
_, err = platform.NewMonitoredService(ctx, "example3", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("signalfxmetrics"),
Identifier: pulumi.String("signalfxmetrics"),
Type: pulumi.String("SplunkSignalFXMetrics"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json8),
},
},
},
})
if err != nil {
return err
}
tmpJSON9, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []map[string]interface{}{
map[string]interface{}{
"name": "Demo",
"identifier": "Demo",
"query": "{job=~\".+\"}",
"groupName": "Log_Group",
"queryParams": map[string]interface{}{
"serviceInstanceField": "job",
},
},
map[string]interface{}{
"name": "log2",
"identifier": "identifier2",
"groupName": "g2",
"query": "error",
"queryParams": map[string]interface{}{
"serviceInstanceField": "_sourcehost",
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
},
})
if err != nil {
return err
}
json9 := string(tmpJSON9)
// Sample template for Grafana Loki Log Health Source
_, err = platform.NewMonitoredService(ctx, "example4", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("Test"),
Identifier: pulumi.String("Test"),
Type: pulumi.String("GrafanaLokiLogs"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json9),
},
},
},
})
if err != nil {
return err
}
tmpJSON10, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []interface{}{
map[string]interface{}{
"name": "metric",
"identifier": "metric",
"query": "default",
"groupName": "g1",
"queryParams": map[string]interface{}{
"serviceInstanceField": "host",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
"healthSourceMetricName": "cpuUsagePercentage",
"healthSourceMetricNamespace": "insights.container/nodes",
"aggregationType": "average",
},
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"liveMonitoringEnabled": "true",
"continuousVerificationEnabled": "true",
"sliEnabled": "false",
"metricThresholds": []interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "metric",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric",
},
},
},
map[string]interface{}{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"queryParams": map[string]interface{}{
"serviceInstanceField": "host",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
"healthSourceMetricName": "cpuUsagePercentage",
"healthSourceMetricNamespace": "insights.container/nodes",
"aggregationType": "average",
},
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
"sliEnabled": "false",
},
},
})
if err != nil {
return err
}
json10 := string(tmpJSON10)
// Sample template for Azure Metrics Health Source
_, err = platform.NewMonitoredService(ctx, "example5", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("azure metrics verify step"),
Identifier: pulumi.String("azure_metrics_verify_step"),
Type: pulumi.String("AzureMetrics"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json10),
},
},
},
})
if err != nil {
return err
}
tmpJSON11, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"queryDefinitions": []map[string]interface{}{
map[string]interface{}{
"name": "name2",
"identifier": "identifier2",
"groupName": "g2",
"query": "*",
"queryParams": map[string]interface{}{
"serviceInstanceField": "Name",
"timeStampIdentifier": "StartedTime",
"messageIdentifier": "Image",
"index": "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
},
"liveMonitoringEnabled": "false",
"continuousVerificationEnabled": "false",
},
},
})
if err != nil {
return err
}
json11 := string(tmpJSON11)
// Sample template for Azure Log Health Source
_, err = platform.NewMonitoredService(ctx, "example6", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("Demo azure"),
Identifier: pulumi.String("Demo_azure"),
Type: pulumi.String("AzureLogs"),
Version: pulumi.String("v2"),
Spec: pulumi.String(json11),
},
},
},
})
if err != nil {
return err
}
tmpJSON12, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"metricDefinitions": []map[string]interface{}{
map[string]interface{}{
"identifier": "Prometheus_Metric",
"metricName": "Prometheus Metric",
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"analysis": map[string]interface{}{
"liveMonitoring": map[string]interface{}{
"enabled": true,
},
"deploymentVerification": map[string]interface{}{
"enabled": true,
"serviceInstanceFieldName": "pod_name",
},
},
"query": "count(up{group=\"cv\",group=\"cv\"})",
"groupName": "met",
"isManualQuery": true,
},
},
"metricPacks": []map[string]interface{}{
map[string]interface{}{
"identifier": "Custom",
"metricThresholds": []interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "Prometheus Metric",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "Prometheus Metric",
},
},
},
},
})
if err != nil {
return err
}
json12 := string(tmpJSON12)
// Sample template for Prometheus Metrics Health Source
_, err = platform.NewMonitoredService(ctx, "example7", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("prometheus metrics verify step"),
Identifier: pulumi.String("prometheus_metrics"),
Type: pulumi.String("Prometheus"),
Spec: pulumi.String(json12),
},
},
},
})
if err != nil {
return err
}
tmpJSON13, err := json.Marshal(map[string]interface{}{
"connectorRef": "connectorRef",
"feature": "Datadog Cloud Metrics",
"metricDefinitions": []interface{}{
map[string]interface{}{
"metricName": "metric",
"metricPath": "M1",
"identifier": "metric",
"query": "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10",
"isManualQuery": true,
"isCustomCreatedMetric": true,
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"analysis": map[string]interface{}{
"liveMonitoring": map[string]interface{}{
"enabled": true,
},
"deploymentVerification": map[string]interface{}{
"enabled": true,
"serviceInstanceFieldName": "pod",
},
},
},
map[string]interface{}{
"metricName": "dashboard_metric_cpu",
"identifier": "metric_cpu",
"query": "avg:kubernetes.cpu.limits{*}.rollup(avg, 60);\navg:kubernetes.cpu.limits{*}.rollup(avg, 30);\n(a+b)/10",
"isManualQuery": false,
"dashboardName": "dashboard",
"metricPath": "M1",
"groupingQuery": "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)",
"metric": "kubernetes.cpu.limits",
"aggregation": "avg",
"isCustomCreatedMetric": true,
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"analysis": map[string]interface{}{
"liveMonitoring": map[string]interface{}{
"enabled": true,
},
"deploymentVerification": map[string]interface{}{
"enabled": true,
"serviceInstanceFieldName": "pod",
},
},
},
},
"metricPacks": []map[string]interface{}{
map[string]interface{}{
"identifier": "Custom",
"metricThresholds": []interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metrictype": "Custom",
"metricName": "metric",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "metric",
},
},
},
},
})
if err != nil {
return err
}
json13 := string(tmpJSON13)
// Sample template for Datadog Metrics Health Source
_, err = platform.NewMonitoredService(ctx, "example8", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("ddm"),
Identifier: pulumi.String("ddm"),
Type: pulumi.String("DatadogMetrics"),
Spec: pulumi.String(json13),
},
},
},
})
if err != nil {
return err
}
tmpJSON14, err := json.Marshal(map[string]interface{}{
"connectorRef": "account.Newrelicautomation_do_not_delete",
"feature": "apm",
"applicationId": "107019083",
"applicationName": "My Application",
"metricData": map[string]interface{}{
"Performance": true,
},
"metricPacks": []map[string]interface{}{
map[string]interface{}{
"identifier": "Performance",
},
},
"newRelicMetricDefinitions": []map[string]interface{}{
map[string]interface{}{
"identifier": "New_Relic_Metric",
"metricName": "New Relic Metric",
"riskProfile": map[string]interface{}{
"riskCategory": "Performance_Other",
"thresholdTypes": []string{
"ACT_WHEN_HIGHER",
},
},
"analysis": map[string]interface{}{
"deploymentVerification": map[string]interface{}{
"enabled": true,
},
},
"groupName": "group1",
"nrql": "SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES",
"responseMapping": map[string]interface{}{
"metricValueJsonPath": "$.['timeSeries'].[*].['results'].[*].['count']",
"timestampJsonPath": "$.['timeSeries'].[*].['beginTimeSeconds']",
},
},
},
"metricPacks": []map[string]interface{}{
map[string]interface{}{
"identifier": "Custom",
"metricThresholds": []map[string]interface{}{
map[string]interface{}{
"type": "IgnoreThreshold",
"spec": map[string]interface{}{
"action": "Ignore",
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "New Relic Metric",
},
map[string]interface{}{
"type": "FailImmediately",
"spec": map[string]interface{}{
"action": "FailAfterOccurrence",
"spec": map[string]interface{}{
"count": 2,
},
},
"criteria": map[string]interface{}{
"type": "Absolute",
"spec": map[string]interface{}{
"greaterThan": 100,
},
},
"metricType": "Custom",
"metricName": "New Relic Metric",
},
},
},
},
})
if err != nil {
return err
}
json14 := string(tmpJSON14)
// Sample template for New Relic Metrics Health Source
_, err = platform.NewMonitoredService(ctx, "example9", &platform.MonitoredServiceArgs{
OrgId: pulumi.String("org_id"),
ProjectId: pulumi.String("project_id"),
Identifier: pulumi.String("identifier"),
Request: &platform.MonitoredServiceRequestArgs{
Name: pulumi.String("name"),
Type: pulumi.String("Application"),
Description: pulumi.String("description"),
ServiceRef: pulumi.String("service_ref"),
EnvironmentRef: pulumi.String("environment_ref"),
Tags: pulumi.StringArray{
pulumi.String("foo:bar"),
pulumi.String("bar:foo"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Name: pulumi.String("name"),
Identifier: pulumi.String("identifier"),
Type: pulumi.String("NewRelic"),
Spec: pulumi.String(json14),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
//Sample template for Elastic Search Log Health Source
var example = new Harness.Platform.MonitoredService("example", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "name",
Identifier = "identifier",
Type = "ElasticSearch",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "error_4xx",
["identifier"] = "error_4xx_id",
["query"] = "Bad Request",
["index"] = "index",
["groupName"] = "Logs_Group",
["queryParams"] = new Dictionary<string, object?>
{
["index"] = "index",
["serviceInstanceField"] = "serviceInstanceIdentifier",
["timeStampIdentifier"] = "timeStampIdentifier",
["timeStampFormat"] = "timeStampFormat",
["messageIdentifier"] = "messageIdentifier",
},
},
new Dictionary<string, object?>
{
["name"] = "error_5xx",
["identifier"] = "error_5xx_id",
["query"] = "Internal Server Error",
["index"] = "index2",
["groupName"] = "Logs_Group",
["queryParams"] = new Dictionary<string, object?>
{
["index"] = "index",
["serviceInstanceField"] = "serviceInstanceIdentifier",
["timeStampIdentifier"] = "timeStampIdentifier",
["timeStampFormat"] = "timeStampFormat",
["messageIdentifier"] = "messageIdentifier",
},
},
},
}),
},
},
ChangeSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Name = "BAC",
Identifier = "BAC",
Type = "PagerDuty",
Enabled = true,
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "account.pd",
["pagerDutyServiceId"] = "P0N21OB",
}),
Category = "Alert",
},
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Name = "FH",
Identifier = "FH",
Type = "CustomIncident",
Enabled = true,
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["name"] = "FH",
["webhookUrl"] = "https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH",
["webhookCurlCommand"] = "curl -X POST -H 'content-type: application/json' -H 'X-Api-Key: sample_api_key' --url 'https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH' -d '{ \"eventIdentifier\": \"<string>\" (optional), \"user\": \"user@harness.io\", \"startTime\": timeInMs, \"endTime\": timeInMs, \"eventDetail\": { \"description\": \"<String>\", \"changeEventDetailsLink\": \"urlString\" (optional), \"externalLinkToEntity\": \"urlString\" (optional), \"name\": \"changeEventName\" } }'",
["type"] = "Alert",
}),
Category = "Alert",
},
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Name = "customff",
Identifier = "customff",
Type = "CustomFF",
Enabled = true,
Category = "FeatureFlag",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["type"] = "FeatureFlag",
}),
},
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Name = "customdeploy",
Identifier = "customdeploy",
Type = "CustomDeploy",
Enabled = true,
Category = "Deployment",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["type"] = "Deployment",
}),
},
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Name = "customincident",
Identifier = "customincident",
Type = "CustomIncident",
Enabled = true,
Category = "Alert",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["type"] = "Alert",
["authorizationToken"] = "abc",
}),
},
},
NotificationRuleRefs = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestNotificationRuleRefArgs
{
NotificationRuleRef = "notification_rule_ref",
Enabled = true,
},
new Harness.Platform.Inputs.MonitoredServiceRequestNotificationRuleRefArgs
{
NotificationRuleRef = "notification_rule_ref1",
Enabled = false,
},
},
},
});
//Sample template for Sumologic Metrics Health Source
var example1 = new Harness.Platform.MonitoredService("example1", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "sumologicmetrics",
Identifier = "sumo_metric_identifier",
Type = "SumologicMetrics",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "metric_cpu",
["identifier"] = "metric_cpu",
["query"] = "metric=cpu",
["groupName"] = "g1",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "_sourcehost",
},
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["liveMonitoringEnabled"] = "true",
["continuousVerificationEnabled"] = "true",
["sliEnabled"] = "false",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "metric_cpu",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "metric_cpu",
},
},
},
new Dictionary<string, object?>
{
["name"] = "name2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["query"] = "metric=memory",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "_sourcehost",
},
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["liveMonitoringEnabled"] = "false",
["continuousVerificationEnabled"] = "false",
["sliEnabled"] = "false",
},
},
}),
},
},
},
});
//Sample template for Sumologic Log Health Source
var example2 = new Harness.Platform.MonitoredService("example2", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "sumologic",
Identifier = "sumo_metric_identifier",
Type = "SumologicLogs",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "log1",
["identifier"] = "log1",
["query"] = "*",
["groupName"] = "Logs Group",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "_sourcehost",
},
},
new Dictionary<string, object?>
{
["name"] = "log2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["query"] = "error",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "_sourcehost",
},
},
},
}),
},
},
},
});
//Sample template for Splunk Signal FX Health Source
var example3 = new Harness.Platform.MonitoredService("example3", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "signalfxmetrics",
Identifier = "signalfxmetrics",
Type = "SplunkSignalFXMetrics",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "metric_infra_cpu",
["identifier"] = "metric_infra_cpu",
["query"] = "***",
["groupName"] = "g",
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Errors",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
"ACT_WHEN_LOWER",
},
},
["liveMonitoringEnabled"] = "true",
["continuousVerificationEnabled"] = "true",
["sliEnabled"] = "false",
},
new Dictionary<string, object?>
{
["name"] = "name2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["query"] = "*",
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["liveMonitoringEnabled"] = "true",
["continuousVerificationEnabled"] = "false",
["sliEnabled"] = "false",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metrictype"] = "Custom",
["metricName"] = "identifier2",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "identifier2",
},
},
},
},
}),
},
},
},
});
//Sample template for Grafana Loki Log Health Source
var example4 = new Harness.Platform.MonitoredService("example4", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "Test",
Identifier = "Test",
Type = "GrafanaLokiLogs",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "Demo",
["identifier"] = "Demo",
["query"] = "{job=~\".+\"}",
["groupName"] = "Log_Group",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "job",
},
},
new Dictionary<string, object?>
{
["name"] = "log2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["query"] = "error",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "_sourcehost",
},
["liveMonitoringEnabled"] = "false",
["continuousVerificationEnabled"] = "false",
["sliEnabled"] = "false",
},
},
}),
},
},
},
});
//Sample template for Azure Metrics Health Source
var example5 = new Harness.Platform.MonitoredService("example5", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "azure metrics verify step",
Identifier = "azure_metrics_verify_step",
Type = "AzureMetrics",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "metric",
["identifier"] = "metric",
["query"] = "default",
["groupName"] = "g1",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "host",
["index"] = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
["healthSourceMetricName"] = "cpuUsagePercentage",
["healthSourceMetricNamespace"] = "insights.container/nodes",
["aggregationType"] = "average",
},
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["liveMonitoringEnabled"] = "true",
["continuousVerificationEnabled"] = "true",
["sliEnabled"] = "false",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metrictype"] = "Custom",
["metricName"] = "metric",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "metric",
},
},
},
new Dictionary<string, object?>
{
["name"] = "name2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "host",
["index"] = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
["healthSourceMetricName"] = "cpuUsagePercentage",
["healthSourceMetricNamespace"] = "insights.container/nodes",
["aggregationType"] = "average",
},
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["liveMonitoringEnabled"] = "false",
["continuousVerificationEnabled"] = "false",
["sliEnabled"] = "false",
},
},
}),
},
},
},
});
//Sample template for Azure Log Health Source
var example6 = new Harness.Platform.MonitoredService("example6", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "Demo azure",
Identifier = "Demo_azure",
Type = "AzureLogs",
Version = "v2",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["queryDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "name2",
["identifier"] = "identifier2",
["groupName"] = "g2",
["query"] = "*",
["queryParams"] = new Dictionary<string, object?>
{
["serviceInstanceField"] = "Name",
["timeStampIdentifier"] = "StartedTime",
["messageIdentifier"] = "Image",
["index"] = "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test",
},
["liveMonitoringEnabled"] = "false",
["continuousVerificationEnabled"] = "false",
},
},
}),
},
},
},
});
//Sample template for Prometheus Metrics Health Source
var example7 = new Harness.Platform.MonitoredService("example7", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "prometheus metrics verify step",
Identifier = "prometheus_metrics",
Type = "Prometheus",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["metricDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "Prometheus_Metric",
["metricName"] = "Prometheus Metric",
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["analysis"] = new Dictionary<string, object?>
{
["liveMonitoring"] = new Dictionary<string, object?>
{
["enabled"] = true,
},
["deploymentVerification"] = new Dictionary<string, object?>
{
["enabled"] = true,
["serviceInstanceFieldName"] = "pod_name",
},
},
["query"] = "count(up{group=\"cv\",group=\"cv\"})",
["groupName"] = "met",
["isManualQuery"] = true,
},
},
["metricPacks"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "Custom",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metrictype"] = "Custom",
["metricName"] = "Prometheus Metric",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "Prometheus Metric",
},
},
},
},
}),
},
},
},
});
//Sample template for Datadog Metrics Health Source
var example8 = new Harness.Platform.MonitoredService("example8", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "ddm",
Identifier = "ddm",
Type = "DatadogMetrics",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "connectorRef",
["feature"] = "Datadog Cloud Metrics",
["metricDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["metricName"] = "metric",
["metricPath"] = "M1",
["identifier"] = "metric",
["query"] = @"avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10",
["isManualQuery"] = true,
["isCustomCreatedMetric"] = true,
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["analysis"] = new Dictionary<string, object?>
{
["liveMonitoring"] = new Dictionary<string, object?>
{
["enabled"] = true,
},
["deploymentVerification"] = new Dictionary<string, object?>
{
["enabled"] = true,
["serviceInstanceFieldName"] = "pod",
},
},
},
new Dictionary<string, object?>
{
["metricName"] = "dashboard_metric_cpu",
["identifier"] = "metric_cpu",
["query"] = @"avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10",
["isManualQuery"] = false,
["dashboardName"] = "dashboard",
["metricPath"] = "M1",
["groupingQuery"] = "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)",
["metric"] = "kubernetes.cpu.limits",
["aggregation"] = "avg",
["isCustomCreatedMetric"] = true,
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["analysis"] = new Dictionary<string, object?>
{
["liveMonitoring"] = new Dictionary<string, object?>
{
["enabled"] = true,
},
["deploymentVerification"] = new Dictionary<string, object?>
{
["enabled"] = true,
["serviceInstanceFieldName"] = "pod",
},
},
},
},
["metricPacks"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "Custom",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metrictype"] = "Custom",
["metricName"] = "metric",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "metric",
},
},
},
},
}),
},
},
},
});
//Sample template for New Relic Metrics Health Source
var example9 = new Harness.Platform.MonitoredService("example9", new()
{
OrgId = "org_id",
ProjectId = "project_id",
Identifier = "identifier",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
Name = "name",
Type = "Application",
Description = "description",
ServiceRef = "service_ref",
EnvironmentRef = "environment_ref",
Tags = new[]
{
"foo:bar",
"bar:foo",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Name = "name",
Identifier = "identifier",
Type = "NewRelic",
Spec = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["connectorRef"] = "account.Newrelicautomation_do_not_delete",
["feature"] = "apm",
["applicationId"] = "107019083",
["applicationName"] = "My Application",
["metricData"] = new Dictionary<string, object?>
{
["Performance"] = true,
},
["metricPacks"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "Performance",
},
},
["newRelicMetricDefinitions"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "New_Relic_Metric",
["metricName"] = "New Relic Metric",
["riskProfile"] = new Dictionary<string, object?>
{
["riskCategory"] = "Performance_Other",
["thresholdTypes"] = new[]
{
"ACT_WHEN_HIGHER",
},
},
["analysis"] = new Dictionary<string, object?>
{
["deploymentVerification"] = new Dictionary<string, object?>
{
["enabled"] = true,
},
},
["groupName"] = "group1",
["nrql"] = "SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES",
["responseMapping"] = new Dictionary<string, object?>
{
["metricValueJsonPath"] = "$.['timeSeries'].[*].['results'].[*].['count']",
["timestampJsonPath"] = "$.['timeSeries'].[*].['beginTimeSeconds']",
},
},
},
["metricPacks"] = new[]
{
new Dictionary<string, object?>
{
["identifier"] = "Custom",
["metricThresholds"] = new[]
{
new Dictionary<string, object?>
{
["type"] = "IgnoreThreshold",
["spec"] = new Dictionary<string, object?>
{
["action"] = "Ignore",
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "New Relic Metric",
},
new Dictionary<string, object?>
{
["type"] = "FailImmediately",
["spec"] = new Dictionary<string, object?>
{
["action"] = "FailAfterOccurrence",
["spec"] = new Dictionary<string, object?>
{
["count"] = 2,
},
},
["criteria"] = new Dictionary<string, object?>
{
["type"] = "Absolute",
["spec"] = new Dictionary<string, object?>
{
["greaterThan"] = 100,
},
},
["metricType"] = "Custom",
["metricName"] = "New Relic Metric",
},
},
},
},
}),
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.MonitoredService;
import com.pulumi.harness.platform.MonitoredServiceArgs;
import com.pulumi.harness.platform.inputs.MonitoredServiceRequestArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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) {
//Sample template for Elastic Search Log Health Source
var example = new MonitoredService("example", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("name")
.identifier("identifier")
.type("ElasticSearch")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "error_4xx"),
jsonProperty("identifier", "error_4xx_id"),
jsonProperty("query", "Bad Request"),
jsonProperty("index", "index"),
jsonProperty("groupName", "Logs_Group"),
jsonProperty("queryParams", jsonObject(
jsonProperty("index", "index"),
jsonProperty("serviceInstanceField", "serviceInstanceIdentifier"),
jsonProperty("timeStampIdentifier", "timeStampIdentifier"),
jsonProperty("timeStampFormat", "timeStampFormat"),
jsonProperty("messageIdentifier", "messageIdentifier")
))
),
jsonObject(
jsonProperty("name", "error_5xx"),
jsonProperty("identifier", "error_5xx_id"),
jsonProperty("query", "Internal Server Error"),
jsonProperty("index", "index2"),
jsonProperty("groupName", "Logs_Group"),
jsonProperty("queryParams", jsonObject(
jsonProperty("index", "index"),
jsonProperty("serviceInstanceField", "serviceInstanceIdentifier"),
jsonProperty("timeStampIdentifier", "timeStampIdentifier"),
jsonProperty("timeStampFormat", "timeStampFormat"),
jsonProperty("messageIdentifier", "messageIdentifier")
))
)
))
)))
.build())
.changeSources(
MonitoredServiceRequestChangeSourceArgs.builder()
.name("BAC")
.identifier("BAC")
.type("PagerDuty")
.enabled(true)
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "account.pd"),
jsonProperty("pagerDutyServiceId", "P0N21OB")
)))
.category("Alert")
.build(),
MonitoredServiceRequestChangeSourceArgs.builder()
.name("FH")
.identifier("FH")
.type("CustomIncident")
.enabled(true)
.spec(serializeJson(
jsonObject(
jsonProperty("name", "FH"),
jsonProperty("webhookUrl", "https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH"),
jsonProperty("webhookCurlCommand", "curl -X POST -H 'content-type: application/json' -H 'X-Api-Key: sample_api_key' --url 'https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH' -d '{ \"eventIdentifier\": \"<string>\" (optional), \"user\": \"user@harness.io\", \"startTime\": timeInMs, \"endTime\": timeInMs, \"eventDetail\": { \"description\": \"<String>\", \"changeEventDetailsLink\": \"urlString\" (optional), \"externalLinkToEntity\": \"urlString\" (optional), \"name\": \"changeEventName\" } }'"),
jsonProperty("type", "Alert")
)))
.category("Alert")
.build(),
MonitoredServiceRequestChangeSourceArgs.builder()
.name("customff")
.identifier("customff")
.type("CustomFF")
.enabled(true)
.category("FeatureFlag")
.spec(serializeJson(
jsonObject(
jsonProperty("type", "FeatureFlag")
)))
.build(),
MonitoredServiceRequestChangeSourceArgs.builder()
.name("customdeploy")
.identifier("customdeploy")
.type("CustomDeploy")
.enabled(true)
.category("Deployment")
.spec(serializeJson(
jsonObject(
jsonProperty("type", "Deployment")
)))
.build(),
MonitoredServiceRequestChangeSourceArgs.builder()
.name("customincident")
.identifier("customincident")
.type("CustomIncident")
.enabled(true)
.category("Alert")
.spec(serializeJson(
jsonObject(
jsonProperty("type", "Alert"),
jsonProperty("authorizationToken", "abc")
)))
.build())
.notificationRuleRefs(
MonitoredServiceRequestNotificationRuleRefArgs.builder()
.notificationRuleRef("notification_rule_ref")
.enabled(true)
.build(),
MonitoredServiceRequestNotificationRuleRefArgs.builder()
.notificationRuleRef("notification_rule_ref1")
.enabled(false)
.build())
.build())
.build());
//Sample template for Sumologic Metrics Health Source
var example1 = new MonitoredService("example1", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("sumologicmetrics")
.identifier("sumo_metric_identifier")
.type("SumologicMetrics")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "metric_cpu"),
jsonProperty("identifier", "metric_cpu"),
jsonProperty("query", "metric=cpu"),
jsonProperty("groupName", "g1"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "_sourcehost")
)),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("liveMonitoringEnabled", "true"),
jsonProperty("continuousVerificationEnabled", "true"),
jsonProperty("sliEnabled", "false"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "metric_cpu")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "metric_cpu")
)
))
),
jsonObject(
jsonProperty("name", "name2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("query", "metric=memory"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "_sourcehost")
)),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("liveMonitoringEnabled", "false"),
jsonProperty("continuousVerificationEnabled", "false"),
jsonProperty("sliEnabled", "false")
)
))
)))
.build())
.build())
.build());
//Sample template for Sumologic Log Health Source
var example2 = new MonitoredService("example2", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("sumologic")
.identifier("sumo_metric_identifier")
.type("SumologicLogs")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "log1"),
jsonProperty("identifier", "log1"),
jsonProperty("query", "*"),
jsonProperty("groupName", "Logs Group"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "_sourcehost")
))
),
jsonObject(
jsonProperty("name", "log2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("query", "error"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "_sourcehost")
))
)
))
)))
.build())
.build())
.build());
//Sample template for Splunk Signal FX Health Source
var example3 = new MonitoredService("example3", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("signalfxmetrics")
.identifier("signalfxmetrics")
.type("SplunkSignalFXMetrics")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "metric_infra_cpu"),
jsonProperty("identifier", "metric_infra_cpu"),
jsonProperty("query", "***"),
jsonProperty("groupName", "g"),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Errors"),
jsonProperty("thresholdTypes", jsonArray(
"ACT_WHEN_HIGHER",
"ACT_WHEN_LOWER"
))
)),
jsonProperty("liveMonitoringEnabled", "true"),
jsonProperty("continuousVerificationEnabled", "true"),
jsonProperty("sliEnabled", "false")
),
jsonObject(
jsonProperty("name", "name2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("query", "*"),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("liveMonitoringEnabled", "true"),
jsonProperty("continuousVerificationEnabled", "false"),
jsonProperty("sliEnabled", "false"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metrictype", "Custom"),
jsonProperty("metricName", "identifier2")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "identifier2")
)
))
)
))
)))
.build())
.build())
.build());
//Sample template for Grafana Loki Log Health Source
var example4 = new MonitoredService("example4", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("Test")
.identifier("Test")
.type("GrafanaLokiLogs")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "Demo"),
jsonProperty("identifier", "Demo"),
jsonProperty("query", "{job=~\".+\"}"),
jsonProperty("groupName", "Log_Group"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "job")
))
),
jsonObject(
jsonProperty("name", "log2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("query", "error"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "_sourcehost")
)),
jsonProperty("liveMonitoringEnabled", "false"),
jsonProperty("continuousVerificationEnabled", "false"),
jsonProperty("sliEnabled", "false")
)
))
)))
.build())
.build())
.build());
//Sample template for Azure Metrics Health Source
var example5 = new MonitoredService("example5", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("azure metrics verify step")
.identifier("azure_metrics_verify_step")
.type("AzureMetrics")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(
jsonObject(
jsonProperty("name", "metric"),
jsonProperty("identifier", "metric"),
jsonProperty("query", "default"),
jsonProperty("groupName", "g1"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "host"),
jsonProperty("index", "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test"),
jsonProperty("healthSourceMetricName", "cpuUsagePercentage"),
jsonProperty("healthSourceMetricNamespace", "insights.container/nodes"),
jsonProperty("aggregationType", "average")
)),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("liveMonitoringEnabled", "true"),
jsonProperty("continuousVerificationEnabled", "true"),
jsonProperty("sliEnabled", "false"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metrictype", "Custom"),
jsonProperty("metricName", "metric")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "metric")
)
))
),
jsonObject(
jsonProperty("name", "name2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "host"),
jsonProperty("index", "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test"),
jsonProperty("healthSourceMetricName", "cpuUsagePercentage"),
jsonProperty("healthSourceMetricNamespace", "insights.container/nodes"),
jsonProperty("aggregationType", "average")
)),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("liveMonitoringEnabled", "false"),
jsonProperty("continuousVerificationEnabled", "false"),
jsonProperty("sliEnabled", "false")
)
))
)))
.build())
.build())
.build());
//Sample template for Azure Log Health Source
var example6 = new MonitoredService("example6", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("Demo azure")
.identifier("Demo_azure")
.type("AzureLogs")
.version("v2")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("queryDefinitions", jsonArray(jsonObject(
jsonProperty("name", "name2"),
jsonProperty("identifier", "identifier2"),
jsonProperty("groupName", "g2"),
jsonProperty("query", "*"),
jsonProperty("queryParams", jsonObject(
jsonProperty("serviceInstanceField", "Name"),
jsonProperty("timeStampIdentifier", "StartedTime"),
jsonProperty("messageIdentifier", "Image"),
jsonProperty("index", "/subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test")
)),
jsonProperty("liveMonitoringEnabled", "false"),
jsonProperty("continuousVerificationEnabled", "false")
)))
)))
.build())
.build())
.build());
//Sample template for Prometheus Metrics Health Source
var example7 = new MonitoredService("example7", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("prometheus metrics verify step")
.identifier("prometheus_metrics")
.type("Prometheus")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("metricDefinitions", jsonArray(jsonObject(
jsonProperty("identifier", "Prometheus_Metric"),
jsonProperty("metricName", "Prometheus Metric"),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("analysis", jsonObject(
jsonProperty("liveMonitoring", jsonObject(
jsonProperty("enabled", true)
)),
jsonProperty("deploymentVerification", jsonObject(
jsonProperty("enabled", true),
jsonProperty("serviceInstanceFieldName", "pod_name")
))
)),
jsonProperty("query", "count(up{group=\"cv\",group=\"cv\"})"),
jsonProperty("groupName", "met"),
jsonProperty("isManualQuery", true)
))),
jsonProperty("metricPacks", jsonArray(jsonObject(
jsonProperty("identifier", "Custom"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metrictype", "Custom"),
jsonProperty("metricName", "Prometheus Metric")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "Prometheus Metric")
)
))
)))
)))
.build())
.build())
.build());
//Sample template for Datadog Metrics Health Source
var example8 = new MonitoredService("example8", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("ddm")
.identifier("ddm")
.type("DatadogMetrics")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "connectorRef"),
jsonProperty("feature", "Datadog Cloud Metrics"),
jsonProperty("metricDefinitions", jsonArray(
jsonObject(
jsonProperty("metricName", "metric"),
jsonProperty("metricPath", "M1"),
jsonProperty("identifier", "metric"),
jsonProperty("query", """
avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10 """),
jsonProperty("isManualQuery", true),
jsonProperty("isCustomCreatedMetric", true),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("analysis", jsonObject(
jsonProperty("liveMonitoring", jsonObject(
jsonProperty("enabled", true)
)),
jsonProperty("deploymentVerification", jsonObject(
jsonProperty("enabled", true),
jsonProperty("serviceInstanceFieldName", "pod")
))
))
),
jsonObject(
jsonProperty("metricName", "dashboard_metric_cpu"),
jsonProperty("identifier", "metric_cpu"),
jsonProperty("query", """
avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10 """),
jsonProperty("isManualQuery", false),
jsonProperty("dashboardName", "dashboard"),
jsonProperty("metricPath", "M1"),
jsonProperty("groupingQuery", "avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)"),
jsonProperty("metric", "kubernetes.cpu.limits"),
jsonProperty("aggregation", "avg"),
jsonProperty("isCustomCreatedMetric", true),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("analysis", jsonObject(
jsonProperty("liveMonitoring", jsonObject(
jsonProperty("enabled", true)
)),
jsonProperty("deploymentVerification", jsonObject(
jsonProperty("enabled", true),
jsonProperty("serviceInstanceFieldName", "pod")
))
))
)
)),
jsonProperty("metricPacks", jsonArray(jsonObject(
jsonProperty("identifier", "Custom"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metrictype", "Custom"),
jsonProperty("metricName", "metric")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "metric")
)
))
)))
)))
.build())
.build())
.build());
//Sample template for New Relic Metrics Health Source
var example9 = new MonitoredService("example9", MonitoredServiceArgs.builder()
.orgId("org_id")
.projectId("project_id")
.identifier("identifier")
.request(MonitoredServiceRequestArgs.builder()
.name("name")
.type("Application")
.description("description")
.serviceRef("service_ref")
.environmentRef("environment_ref")
.tags(
"foo:bar",
"bar:foo")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.name("name")
.identifier("identifier")
.type("NewRelic")
.spec(serializeJson(
jsonObject(
jsonProperty("connectorRef", "account.Newrelicautomation_do_not_delete"),
jsonProperty("feature", "apm"),
jsonProperty("applicationId", "107019083"),
jsonProperty("applicationName", "My Application"),
jsonProperty("metricData", jsonObject(
jsonProperty("Performance", true)
)),
jsonProperty("metricPacks", jsonArray(jsonObject(
jsonProperty("identifier", "Performance")
))),
jsonProperty("newRelicMetricDefinitions", jsonArray(jsonObject(
jsonProperty("identifier", "New_Relic_Metric"),
jsonProperty("metricName", "New Relic Metric"),
jsonProperty("riskProfile", jsonObject(
jsonProperty("riskCategory", "Performance_Other"),
jsonProperty("thresholdTypes", jsonArray("ACT_WHEN_HIGHER"))
)),
jsonProperty("analysis", jsonObject(
jsonProperty("deploymentVerification", jsonObject(
jsonProperty("enabled", true)
))
)),
jsonProperty("groupName", "group1"),
jsonProperty("nrql", "SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES"),
jsonProperty("responseMapping", jsonObject(
jsonProperty("metricValueJsonPath", "$.['timeSeries'].[*].['results'].[*].['count']"),
jsonProperty("timestampJsonPath", "$.['timeSeries'].[*].['beginTimeSeconds']")
))
))),
jsonProperty("metricPacks", jsonArray(jsonObject(
jsonProperty("identifier", "Custom"),
jsonProperty("metricThresholds", jsonArray(
jsonObject(
jsonProperty("type", "IgnoreThreshold"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "Ignore")
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "New Relic Metric")
),
jsonObject(
jsonProperty("type", "FailImmediately"),
jsonProperty("spec", jsonObject(
jsonProperty("action", "FailAfterOccurrence"),
jsonProperty("spec", jsonObject(
jsonProperty("count", 2)
))
)),
jsonProperty("criteria", jsonObject(
jsonProperty("type", "Absolute"),
jsonProperty("spec", jsonObject(
jsonProperty("greaterThan", 100)
))
)),
jsonProperty("metricType", "Custom"),
jsonProperty("metricName", "New Relic Metric")
)
))
)))
)))
.build())
.build())
.build());
}
}
resources:
#Sample template for Elastic Search Log Health Source
example:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: name
identifier: identifier
type: ElasticSearch
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: error_4xx
identifier: error_4xx_id
query: Bad Request
index: index
groupName: Logs_Group
queryParams:
index: index
serviceInstanceField: serviceInstanceIdentifier
timeStampIdentifier: timeStampIdentifier
timeStampFormat: timeStampFormat
messageIdentifier: messageIdentifier
- name: error_5xx
identifier: error_5xx_id
query: Internal Server Error
index: index2
groupName: Logs_Group
queryParams:
index: index
serviceInstanceField: serviceInstanceIdentifier
timeStampIdentifier: timeStampIdentifier
timeStampFormat: timeStampFormat
messageIdentifier: messageIdentifier
changeSources:
- name: BAC
identifier: BAC
type: PagerDuty
enabled: true
spec:
fn::toJSON:
connectorRef: account.pd
pagerDutyServiceId: P0N21OB
category: Alert
- name: FH
identifier: FH
type: CustomIncident
enabled: true
spec:
fn::toJSON:
name: FH
webhookUrl: https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH
webhookCurlCommand: 'curl -X POST -H ''content-type: application/json'' -H ''X-Api-Key: sample_api_key'' --url ''https://harness.io/cv/api/account/sampleAcc/org/sampleOrg/project/sampleProj/webhook/custom-change?monitoredServiceIdentifier=checkout_prod&changeSourceIdentifier=FH'' -d ''{ "eventIdentifier": "<string>" (optional), "user": "user@harness.io", "startTime": timeInMs, "endTime": timeInMs, "eventDetail": { "description": "<String>", "changeEventDetailsLink": "urlString" (optional), "externalLinkToEntity": "urlString" (optional), "name": "changeEventName" } }'''
type: Alert
category: Alert
- name: customff
identifier: customff
type: CustomFF
enabled: true
category: FeatureFlag
spec:
fn::toJSON:
type: FeatureFlag
- name: customdeploy
identifier: customdeploy
type: CustomDeploy
enabled: true
category: Deployment
spec:
fn::toJSON:
type: Deployment
- name: customincident
identifier: customincident
type: CustomIncident
enabled: true
category: Alert
spec:
fn::toJSON:
type: Alert
authorizationToken: abc
notificationRuleRefs:
- notificationRuleRef: notification_rule_ref
enabled: true
- notificationRuleRef: notification_rule_ref1
enabled: false
#Sample template for Sumologic Metrics Health Source
example1:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: sumologicmetrics
identifier: sumo_metric_identifier
type: SumologicMetrics
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: metric_cpu
identifier: metric_cpu
query: metric=cpu
groupName: g1
queryParams:
serviceInstanceField: _sourcehost
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
liveMonitoringEnabled: 'true'
continuousVerificationEnabled: 'true'
sliEnabled: 'false'
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: metric_cpu
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: metric_cpu
- name: name2
identifier: identifier2
groupName: g2
query: metric=memory
queryParams:
serviceInstanceField: _sourcehost
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
liveMonitoringEnabled: 'false'
continuousVerificationEnabled: 'false'
sliEnabled: 'false'
#Sample template for Sumologic Log Health Source
example2:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: sumologic
identifier: sumo_metric_identifier
type: SumologicLogs
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: log1
identifier: log1
query: '*'
groupName: Logs Group
queryParams:
serviceInstanceField: _sourcehost
- name: log2
identifier: identifier2
groupName: g2
query: error
queryParams:
serviceInstanceField: _sourcehost
#Sample template for Splunk Signal FX Health Source
example3:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: signalfxmetrics
identifier: signalfxmetrics
type: SplunkSignalFXMetrics
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: metric_infra_cpu
identifier: metric_infra_cpu
query: '***'
groupName: g
riskProfile:
riskCategory: Errors
thresholdTypes:
- ACT_WHEN_HIGHER
- ACT_WHEN_LOWER
liveMonitoringEnabled: 'true'
continuousVerificationEnabled: 'true'
sliEnabled: 'false'
- name: name2
identifier: identifier2
groupName: g2
query: '*'
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
liveMonitoringEnabled: 'true'
continuousVerificationEnabled: 'false'
sliEnabled: 'false'
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metrictype: Custom
metricName: identifier2
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: identifier2
#Sample template for Grafana Loki Log Health Source
example4:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: Test
identifier: Test
type: GrafanaLokiLogs
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: Demo
identifier: Demo
query: '{job=~".+"}'
groupName: Log_Group
queryParams:
serviceInstanceField: job
- name: log2
identifier: identifier2
groupName: g2
query: error
queryParams:
serviceInstanceField: _sourcehost
liveMonitoringEnabled: 'false'
continuousVerificationEnabled: 'false'
sliEnabled: 'false'
#Sample template for Azure Metrics Health Source
example5:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: azure metrics verify step
identifier: azure_metrics_verify_step
type: AzureMetrics
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: metric
identifier: metric
query: default
groupName: g1
queryParams:
serviceInstanceField: host
index: /subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test
healthSourceMetricName: cpuUsagePercentage
healthSourceMetricNamespace: insights.container/nodes
aggregationType: average
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
liveMonitoringEnabled: 'true'
continuousVerificationEnabled: 'true'
sliEnabled: 'false'
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metrictype: Custom
metricName: metric
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: metric
- name: name2
identifier: identifier2
groupName: g2
queryParams:
serviceInstanceField: host
index: /subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test
healthSourceMetricName: cpuUsagePercentage
healthSourceMetricNamespace: insights.container/nodes
aggregationType: average
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
liveMonitoringEnabled: 'false'
continuousVerificationEnabled: 'false'
sliEnabled: 'false'
#Sample template for Azure Log Health Source
example6:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: Demo azure
identifier: Demo_azure
type: AzureLogs
version: v2
spec:
fn::toJSON:
connectorRef: connectorRef
queryDefinitions:
- name: name2
identifier: identifier2
groupName: g2
query: '*'
queryParams:
serviceInstanceField: Name
timeStampIdentifier: StartedTime
messageIdentifier: Image
index: /subscriptions/12d2db62-5aa9-471d-84bb-faa489b3e319/resourceGroups/srm-test/providers/Microsoft.ContainerService/managedClusters/srm-test
liveMonitoringEnabled: 'false'
continuousVerificationEnabled: 'false'
#Sample template for Prometheus Metrics Health Source
example7:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: prometheus metrics verify step
identifier: prometheus_metrics
type: Prometheus
spec:
fn::toJSON:
connectorRef: connectorRef
metricDefinitions:
- identifier: Prometheus_Metric
metricName: Prometheus Metric
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
analysis:
liveMonitoring:
enabled: true
deploymentVerification:
enabled: true
serviceInstanceFieldName: pod_name
query: count(up{group="cv",group="cv"})
groupName: met
isManualQuery: true
metricPacks:
- identifier: Custom
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metrictype: Custom
metricName: Prometheus Metric
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: Prometheus Metric
#Sample template for Datadog Metrics Health Source
example8:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: ddm
identifier: ddm
type: DatadogMetrics
spec:
fn::toJSON:
connectorRef: connectorRef
feature: Datadog Cloud Metrics
metricDefinitions:
- metricName: metric
metricPath: M1
identifier: metric
query: |-
avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10
isManualQuery: true
isCustomCreatedMetric: true
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
analysis:
liveMonitoring:
enabled: true
deploymentVerification:
enabled: true
serviceInstanceFieldName: pod
- metricName: dashboard_metric_cpu
identifier: metric_cpu
query: |-
avg:kubernetes.cpu.limits{*}.rollup(avg, 60);
avg:kubernetes.cpu.limits{*}.rollup(avg, 30);
(a+b)/10
isManualQuery: false
dashboardName: dashboard
metricPath: M1
groupingQuery: avg:kubernetes.cpu.limits{*} by {host}.rollup(avg, 60)
metric: kubernetes.cpu.limits
aggregation: avg
isCustomCreatedMetric: true
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
analysis:
liveMonitoring:
enabled: true
deploymentVerification:
enabled: true
serviceInstanceFieldName: pod
metricPacks:
- identifier: Custom
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metrictype: Custom
metricName: metric
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: metric
#Sample template for New Relic Metrics Health Source
example9:
type: harness:platform:MonitoredService
properties:
orgId: org_id
projectId: project_id
identifier: identifier
request:
name: name
type: Application
description: description
serviceRef: service_ref
environmentRef: environment_ref
tags:
- foo:bar
- bar:foo
healthSources:
- name: name
identifier: identifier
type: NewRelic
spec:
fn::toJSON:
connectorRef: account.Newrelicautomation_do_not_delete
feature: apm
applicationId: '107019083'
applicationName: My Application
metricData:
Performance: true
metricPacks:
- identifier: Performance
newRelicMetricDefinitions:
- identifier: New_Relic_Metric
metricName: New Relic Metric
riskProfile:
riskCategory: Performance_Other
thresholdTypes:
- ACT_WHEN_HIGHER
analysis:
deploymentVerification:
enabled: true
groupName: group1
nrql: SELECT count(apm.service.instance.count) FROM Metric WHERE appName LIKE 'My Application' TIMESERIES
responseMapping:
metricValueJsonPath: $.['timeSeries'].[*].['results'].[*].['count']
timestampJsonPath: $.['timeSeries'].[*].['beginTimeSeconds']
metricPacks:
- identifier: Custom
metricThresholds:
- type: IgnoreThreshold
spec:
action: Ignore
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: New Relic Metric
- type: FailImmediately
spec:
action: FailAfterOccurrence
spec:
count: 2
criteria:
type: Absolute
spec:
greaterThan: 100
metricType: Custom
metricName: New Relic Metric
Create MonitoredService Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MonitoredService(name: string, args: MonitoredServiceArgs, opts?: CustomResourceOptions);
@overload
def MonitoredService(resource_name: str,
args: MonitoredServiceArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MonitoredService(resource_name: str,
opts: Optional[ResourceOptions] = None,
identifier: Optional[str] = None,
org_id: Optional[str] = None,
project_id: Optional[str] = None,
request: Optional[MonitoredServiceRequestArgs] = None)
func NewMonitoredService(ctx *Context, name string, args MonitoredServiceArgs, opts ...ResourceOption) (*MonitoredService, error)
public MonitoredService(string name, MonitoredServiceArgs args, CustomResourceOptions? opts = null)
public MonitoredService(String name, MonitoredServiceArgs args)
public MonitoredService(String name, MonitoredServiceArgs args, CustomResourceOptions options)
type: harness:platform:MonitoredService
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MonitoredServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MonitoredServiceArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MonitoredServiceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MonitoredServiceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MonitoredServiceArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var monitoredServiceResource = new Harness.Platform.MonitoredService("monitoredServiceResource", new()
{
Identifier = "string",
OrgId = "string",
ProjectId = "string",
Request = new Harness.Platform.Inputs.MonitoredServiceRequestArgs
{
EnvironmentRef = "string",
Type = "string",
ServiceRef = "string",
Name = "string",
EnvironmentRefLists = new[]
{
"string",
},
HealthSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestHealthSourceArgs
{
Identifier = "string",
Name = "string",
Spec = "string",
Type = "string",
Version = "string",
},
},
ChangeSources = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestChangeSourceArgs
{
Category = "string",
Identifier = "string",
Name = "string",
Type = "string",
Enabled = false,
Spec = "string",
},
},
NotificationRuleRefs = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestNotificationRuleRefArgs
{
Enabled = false,
NotificationRuleRef = "string",
},
},
Description = "string",
Tags = new[]
{
"string",
},
TemplateRef = "string",
Dependencies = new[]
{
new Harness.Platform.Inputs.MonitoredServiceRequestDependencyArgs
{
MonitoredServiceIdentifier = "string",
Type = "string",
DependencyMetadata = "string",
},
},
VersionLabel = "string",
},
});
example, err := platform.NewMonitoredService(ctx, "monitoredServiceResource", &platform.MonitoredServiceArgs{
Identifier: pulumi.String("string"),
OrgId: pulumi.String("string"),
ProjectId: pulumi.String("string"),
Request: &platform.MonitoredServiceRequestArgs{
EnvironmentRef: pulumi.String("string"),
Type: pulumi.String("string"),
ServiceRef: pulumi.String("string"),
Name: pulumi.String("string"),
EnvironmentRefLists: pulumi.StringArray{
pulumi.String("string"),
},
HealthSources: platform.MonitoredServiceRequestHealthSourceArray{
&platform.MonitoredServiceRequestHealthSourceArgs{
Identifier: pulumi.String("string"),
Name: pulumi.String("string"),
Spec: pulumi.String("string"),
Type: pulumi.String("string"),
Version: pulumi.String("string"),
},
},
ChangeSources: platform.MonitoredServiceRequestChangeSourceArray{
&platform.MonitoredServiceRequestChangeSourceArgs{
Category: pulumi.String("string"),
Identifier: pulumi.String("string"),
Name: pulumi.String("string"),
Type: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Spec: pulumi.String("string"),
},
},
NotificationRuleRefs: platform.MonitoredServiceRequestNotificationRuleRefArray{
&platform.MonitoredServiceRequestNotificationRuleRefArgs{
Enabled: pulumi.Bool(false),
NotificationRuleRef: pulumi.String("string"),
},
},
Description: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TemplateRef: pulumi.String("string"),
Dependencies: platform.MonitoredServiceRequestDependencyArray{
&platform.MonitoredServiceRequestDependencyArgs{
MonitoredServiceIdentifier: pulumi.String("string"),
Type: pulumi.String("string"),
DependencyMetadata: pulumi.String("string"),
},
},
VersionLabel: pulumi.String("string"),
},
})
var monitoredServiceResource = new MonitoredService("monitoredServiceResource", MonitoredServiceArgs.builder()
.identifier("string")
.orgId("string")
.projectId("string")
.request(MonitoredServiceRequestArgs.builder()
.environmentRef("string")
.type("string")
.serviceRef("string")
.name("string")
.environmentRefLists("string")
.healthSources(MonitoredServiceRequestHealthSourceArgs.builder()
.identifier("string")
.name("string")
.spec("string")
.type("string")
.version("string")
.build())
.changeSources(MonitoredServiceRequestChangeSourceArgs.builder()
.category("string")
.identifier("string")
.name("string")
.type("string")
.enabled(false)
.spec("string")
.build())
.notificationRuleRefs(MonitoredServiceRequestNotificationRuleRefArgs.builder()
.enabled(false)
.notificationRuleRef("string")
.build())
.description("string")
.tags("string")
.templateRef("string")
.dependencies(MonitoredServiceRequestDependencyArgs.builder()
.monitoredServiceIdentifier("string")
.type("string")
.dependencyMetadata("string")
.build())
.versionLabel("string")
.build())
.build());
monitored_service_resource = harness.platform.MonitoredService("monitoredServiceResource",
identifier="string",
org_id="string",
project_id="string",
request={
"environment_ref": "string",
"type": "string",
"service_ref": "string",
"name": "string",
"environment_ref_lists": ["string"],
"health_sources": [{
"identifier": "string",
"name": "string",
"spec": "string",
"type": "string",
"version": "string",
}],
"change_sources": [{
"category": "string",
"identifier": "string",
"name": "string",
"type": "string",
"enabled": False,
"spec": "string",
}],
"notification_rule_refs": [{
"enabled": False,
"notification_rule_ref": "string",
}],
"description": "string",
"tags": ["string"],
"template_ref": "string",
"dependencies": [{
"monitored_service_identifier": "string",
"type": "string",
"dependency_metadata": "string",
}],
"version_label": "string",
})
const monitoredServiceResource = new harness.platform.MonitoredService("monitoredServiceResource", {
identifier: "string",
orgId: "string",
projectId: "string",
request: {
environmentRef: "string",
type: "string",
serviceRef: "string",
name: "string",
environmentRefLists: ["string"],
healthSources: [{
identifier: "string",
name: "string",
spec: "string",
type: "string",
version: "string",
}],
changeSources: [{
category: "string",
identifier: "string",
name: "string",
type: "string",
enabled: false,
spec: "string",
}],
notificationRuleRefs: [{
enabled: false,
notificationRuleRef: "string",
}],
description: "string",
tags: ["string"],
templateRef: "string",
dependencies: [{
monitoredServiceIdentifier: "string",
type: "string",
dependencyMetadata: "string",
}],
versionLabel: "string",
},
});
type: harness:platform:MonitoredService
properties:
identifier: string
orgId: string
projectId: string
request:
changeSources:
- category: string
enabled: false
identifier: string
name: string
spec: string
type: string
dependencies:
- dependencyMetadata: string
monitoredServiceIdentifier: string
type: string
description: string
environmentRef: string
environmentRefLists:
- string
healthSources:
- identifier: string
name: string
spec: string
type: string
version: string
name: string
notificationRuleRefs:
- enabled: false
notificationRuleRef: string
serviceRef: string
tags:
- string
templateRef: string
type: string
versionLabel: string
MonitoredService Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The MonitoredService resource accepts the following input properties:
- Identifier string
- Identifier of the monitored service.
- Org
Id string - Identifier of the organization in which the monitored service is configured.
- Project
Id string - Identifier of the project in which the monitored service is configured.
- Request
Monitored
Service Request - Request for creating or updating a monitored service.
- Identifier string
- Identifier of the monitored service.
- Org
Id string - Identifier of the organization in which the monitored service is configured.
- Project
Id string - Identifier of the project in which the monitored service is configured.
- Request
Monitored
Service Request Args - Request for creating or updating a monitored service.
- identifier String
- Identifier of the monitored service.
- org
Id String - Identifier of the organization in which the monitored service is configured.
- project
Id String - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request - Request for creating or updating a monitored service.
- identifier string
- Identifier of the monitored service.
- org
Id string - Identifier of the organization in which the monitored service is configured.
- project
Id string - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request - Request for creating or updating a monitored service.
- identifier str
- Identifier of the monitored service.
- org_
id str - Identifier of the organization in which the monitored service is configured.
- project_
id str - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request Args - Request for creating or updating a monitored service.
- identifier String
- Identifier of the monitored service.
- org
Id String - Identifier of the organization in which the monitored service is configured.
- project
Id String - Identifier of the project in which the monitored service is configured.
- request Property Map
- Request for creating or updating a monitored service.
Outputs
All input properties are implicitly available as output properties. Additionally, the MonitoredService resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing MonitoredService Resource
Get an existing MonitoredService resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MonitoredServiceState, opts?: CustomResourceOptions): MonitoredService
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
identifier: Optional[str] = None,
org_id: Optional[str] = None,
project_id: Optional[str] = None,
request: Optional[MonitoredServiceRequestArgs] = None) -> MonitoredService
func GetMonitoredService(ctx *Context, name string, id IDInput, state *MonitoredServiceState, opts ...ResourceOption) (*MonitoredService, error)
public static MonitoredService Get(string name, Input<string> id, MonitoredServiceState? state, CustomResourceOptions? opts = null)
public static MonitoredService get(String name, Output<String> id, MonitoredServiceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Identifier string
- Identifier of the monitored service.
- Org
Id string - Identifier of the organization in which the monitored service is configured.
- Project
Id string - Identifier of the project in which the monitored service is configured.
- Request
Monitored
Service Request - Request for creating or updating a monitored service.
- Identifier string
- Identifier of the monitored service.
- Org
Id string - Identifier of the organization in which the monitored service is configured.
- Project
Id string - Identifier of the project in which the monitored service is configured.
- Request
Monitored
Service Request Args - Request for creating or updating a monitored service.
- identifier String
- Identifier of the monitored service.
- org
Id String - Identifier of the organization in which the monitored service is configured.
- project
Id String - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request - Request for creating or updating a monitored service.
- identifier string
- Identifier of the monitored service.
- org
Id string - Identifier of the organization in which the monitored service is configured.
- project
Id string - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request - Request for creating or updating a monitored service.
- identifier str
- Identifier of the monitored service.
- org_
id str - Identifier of the organization in which the monitored service is configured.
- project_
id str - Identifier of the project in which the monitored service is configured.
- request
Monitored
Service Request Args - Request for creating or updating a monitored service.
- identifier String
- Identifier of the monitored service.
- org
Id String - Identifier of the organization in which the monitored service is configured.
- project
Id String - Identifier of the project in which the monitored service is configured.
- request Property Map
- Request for creating or updating a monitored service.
Supporting Types
MonitoredServiceRequest, MonitoredServiceRequestArgs
- Environment
Ref string - Environment in which the service is deployed.
- Name string
- Name for the monitored service.
- Service
Ref string - Service reference for the monitored service.
- Type string
- Type of the monitored service.
- Change
Sources List<MonitoredService Request Change Source> - Set of change sources for the monitored service.
- Dependencies
List<Monitored
Service Request Dependency> - Dependencies of the monitored service.
- Description string
- Description for the monitored service.
- Enabled bool
- Enable or disable the monitored service.
- Environment
Ref List<string>Lists - Environment reference list for the monitored service.
- Health
Sources List<MonitoredService Request Health Source> - Set of health sources for the monitored service.
- Notification
Rule List<MonitoredRefs Service Request Notification Rule Ref> - Notification rule references for the monitored service.
- List<string>
- Tags for the monitored service. comma-separated key value string pairs.
- Template
Ref string - Template reference for the monitored service.
- Version
Label string - Template version label for the monitored service.
- Environment
Ref string - Environment in which the service is deployed.
- Name string
- Name for the monitored service.
- Service
Ref string - Service reference for the monitored service.
- Type string
- Type of the monitored service.
- Change
Sources []MonitoredService Request Change Source - Set of change sources for the monitored service.
- Dependencies
[]Monitored
Service Request Dependency - Dependencies of the monitored service.
- Description string
- Description for the monitored service.
- Enabled bool
- Enable or disable the monitored service.
- Environment
Ref []stringLists - Environment reference list for the monitored service.
- Health
Sources []MonitoredService Request Health Source - Set of health sources for the monitored service.
- Notification
Rule []MonitoredRefs Service Request Notification Rule Ref - Notification rule references for the monitored service.
- []string
- Tags for the monitored service. comma-separated key value string pairs.
- Template
Ref string - Template reference for the monitored service.
- Version
Label string - Template version label for the monitored service.
- environment
Ref String - Environment in which the service is deployed.
- name String
- Name for the monitored service.
- service
Ref String - Service reference for the monitored service.
- type String
- Type of the monitored service.
- change
Sources List<MonitoredService Request Change Source> - Set of change sources for the monitored service.
- dependencies
List<Monitored
Service Request Dependency> - Dependencies of the monitored service.
- description String
- Description for the monitored service.
- enabled Boolean
- Enable or disable the monitored service.
- environment
Ref List<String>Lists - Environment reference list for the monitored service.
- health
Sources List<MonitoredService Request Health Source> - Set of health sources for the monitored service.
- notification
Rule List<MonitoredRefs Service Request Notification Rule Ref> - Notification rule references for the monitored service.
- List<String>
- Tags for the monitored service. comma-separated key value string pairs.
- template
Ref String - Template reference for the monitored service.
- version
Label String - Template version label for the monitored service.
- environment
Ref string - Environment in which the service is deployed.
- name string
- Name for the monitored service.
- service
Ref string - Service reference for the monitored service.
- type string
- Type of the monitored service.
- change
Sources MonitoredService Request Change Source[] - Set of change sources for the monitored service.
- dependencies
Monitored
Service Request Dependency[] - Dependencies of the monitored service.
- description string
- Description for the monitored service.
- enabled boolean
- Enable or disable the monitored service.
- environment
Ref string[]Lists - Environment reference list for the monitored service.
- health
Sources MonitoredService Request Health Source[] - Set of health sources for the monitored service.
- notification
Rule MonitoredRefs Service Request Notification Rule Ref[] - Notification rule references for the monitored service.
- string[]
- Tags for the monitored service. comma-separated key value string pairs.
- template
Ref string - Template reference for the monitored service.
- version
Label string - Template version label for the monitored service.
- environment_
ref str - Environment in which the service is deployed.
- name str
- Name for the monitored service.
- service_
ref str - Service reference for the monitored service.
- type str
- Type of the monitored service.
- change_
sources Sequence[MonitoredService Request Change Source] - Set of change sources for the monitored service.
- dependencies
Sequence[Monitored
Service Request Dependency] - Dependencies of the monitored service.
- description str
- Description for the monitored service.
- enabled bool
- Enable or disable the monitored service.
- environment_
ref_ Sequence[str]lists - Environment reference list for the monitored service.
- health_
sources Sequence[MonitoredService Request Health Source] - Set of health sources for the monitored service.
- notification_
rule_ Sequence[Monitoredrefs Service Request Notification Rule Ref] - Notification rule references for the monitored service.
- Sequence[str]
- Tags for the monitored service. comma-separated key value string pairs.
- template_
ref str - Template reference for the monitored service.
- version_
label str - Template version label for the monitored service.
- environment
Ref String - Environment in which the service is deployed.
- name String
- Name for the monitored service.
- service
Ref String - Service reference for the monitored service.
- type String
- Type of the monitored service.
- change
Sources List<Property Map> - Set of change sources for the monitored service.
- dependencies List<Property Map>
- Dependencies of the monitored service.
- description String
- Description for the monitored service.
- enabled Boolean
- Enable or disable the monitored service.
- environment
Ref List<String>Lists - Environment reference list for the monitored service.
- health
Sources List<Property Map> - Set of health sources for the monitored service.
- notification
Rule List<Property Map>Refs - Notification rule references for the monitored service.
- List<String>
- Tags for the monitored service. comma-separated key value string pairs.
- template
Ref String - Template reference for the monitored service.
- version
Label String - Template version label for the monitored service.
MonitoredServiceRequestChangeSource, MonitoredServiceRequestChangeSourceArgs
- Category string
- Category of the change source.
- Identifier string
- Identifier of the change source.
- Name string
- Name of the change source.
- Type string
- Type of the change source.
- Enabled bool
- Enable or disable the change source.
- Spec string
- Specification of the change source. Depends on the type of the change source.
- Category string
- Category of the change source.
- Identifier string
- Identifier of the change source.
- Name string
- Name of the change source.
- Type string
- Type of the change source.
- Enabled bool
- Enable or disable the change source.
- Spec string
- Specification of the change source. Depends on the type of the change source.
- category String
- Category of the change source.
- identifier String
- Identifier of the change source.
- name String
- Name of the change source.
- type String
- Type of the change source.
- enabled Boolean
- Enable or disable the change source.
- spec String
- Specification of the change source. Depends on the type of the change source.
- category string
- Category of the change source.
- identifier string
- Identifier of the change source.
- name string
- Name of the change source.
- type string
- Type of the change source.
- enabled boolean
- Enable or disable the change source.
- spec string
- Specification of the change source. Depends on the type of the change source.
- category String
- Category of the change source.
- identifier String
- Identifier of the change source.
- name String
- Name of the change source.
- type String
- Type of the change source.
- enabled Boolean
- Enable or disable the change source.
- spec String
- Specification of the change source. Depends on the type of the change source.
MonitoredServiceRequestDependency, MonitoredServiceRequestDependencyArgs
- Monitored
Service stringIdentifier - Monitored service identifier of the dependency.
- Type string
- Type of the service dependency.
- Dependency
Metadata string - Dependency metadata for the monitored service.
- Monitored
Service stringIdentifier - Monitored service identifier of the dependency.
- Type string
- Type of the service dependency.
- Dependency
Metadata string - Dependency metadata for the monitored service.
- monitored
Service StringIdentifier - Monitored service identifier of the dependency.
- type String
- Type of the service dependency.
- dependency
Metadata String - Dependency metadata for the monitored service.
- monitored
Service stringIdentifier - Monitored service identifier of the dependency.
- type string
- Type of the service dependency.
- dependency
Metadata string - Dependency metadata for the monitored service.
- monitored_
service_ stridentifier - Monitored service identifier of the dependency.
- type str
- Type of the service dependency.
- dependency_
metadata str - Dependency metadata for the monitored service.
- monitored
Service StringIdentifier - Monitored service identifier of the dependency.
- type String
- Type of the service dependency.
- dependency
Metadata String - Dependency metadata for the monitored service.
MonitoredServiceRequestHealthSource, MonitoredServiceRequestHealthSourceArgs
- Identifier string
- Identifier of the health source.
- Name string
- Name of the health source.
- Spec string
- Specification of the health source. Depends on the type of the health source.
- Type string
- Type of the health source.
- Version string
- Version of the health source.
- Identifier string
- Identifier of the health source.
- Name string
- Name of the health source.
- Spec string
- Specification of the health source. Depends on the type of the health source.
- Type string
- Type of the health source.
- Version string
- Version of the health source.
- identifier String
- Identifier of the health source.
- name String
- Name of the health source.
- spec String
- Specification of the health source. Depends on the type of the health source.
- type String
- Type of the health source.
- version String
- Version of the health source.
- identifier string
- Identifier of the health source.
- name string
- Name of the health source.
- spec string
- Specification of the health source. Depends on the type of the health source.
- type string
- Type of the health source.
- version string
- Version of the health source.
- identifier str
- Identifier of the health source.
- name str
- Name of the health source.
- spec str
- Specification of the health source. Depends on the type of the health source.
- type str
- Type of the health source.
- version str
- Version of the health source.
- identifier String
- Identifier of the health source.
- name String
- Name of the health source.
- spec String
- Specification of the health source. Depends on the type of the health source.
- type String
- Type of the health source.
- version String
- Version of the health source.
MonitoredServiceRequestNotificationRuleRef, MonitoredServiceRequestNotificationRuleRefArgs
- Enabled bool
- Enable or disable notification rule reference for the monitored service.
- Notification
Rule stringRef - Notification rule reference for the monitored service.
- Enabled bool
- Enable or disable notification rule reference for the monitored service.
- Notification
Rule stringRef - Notification rule reference for the monitored service.
- enabled Boolean
- Enable or disable notification rule reference for the monitored service.
- notification
Rule StringRef - Notification rule reference for the monitored service.
- enabled boolean
- Enable or disable notification rule reference for the monitored service.
- notification
Rule stringRef - Notification rule reference for the monitored service.
- enabled bool
- Enable or disable notification rule reference for the monitored service.
- notification_
rule_ strref - Notification rule reference for the monitored service.
- enabled Boolean
- Enable or disable notification rule reference for the monitored service.
- notification
Rule StringRef - Notification rule reference for the monitored service.
Import
Import account level monitored_service
$ pulumi import harness:platform/monitoredService:MonitoredService example <monitored_service_id>
Import organization level monitored_service
$ pulumi import harness:platform/monitoredService:MonitoredService example <org_id>/<monitored_service_id>
Import project level monitored_service
$ pulumi import harness:platform/monitoredService:MonitoredService example <org_id>/<project_id>/<monitored_service_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.