import ApiClient from "https://deno.land/x/datadog_api/client.ts";
import V1MonitorsApi from "https://deno.land/x/datadog_api/v1/monitors.ts";
type Datadog = {
apiKey: string;
appKey: string;
apiBase: string;
};
export async function main(dd_auth: Datadog) {
let count = 0;
// Set up a Monitors API client
const datadog = new ApiClient(dd_auth);
const monitorsApi = new V1MonitorsApi(datadog);
let monitor_urls = [];
// Search for relevant monitors via a metric filter
for await (const monitor of monitorsApi.searchToEnd(`metric:trace*`)) {
// Skip monitors that have a scoped environment set
if (!monitor.query.includes("env:production")) continue;
if (!monitor.query.includes("env:sandbox")) continue;
// return the monitor URL for further manual inspection
monitor_urls.push(`https://app.datadoghq.eu/monitors/${monitor.id}`);
count++;
}
// Return number of matched monitors as a summary
return { count: count, monitor_urls: monitor_urls };
}
Submitted by admin 497 days ago
import ApiClient from "https://deno.land/x/datadog_api/client.ts";
import V1MonitorsApi from "https://deno.land/x/datadog_api/v1/monitors.ts";
type Datadog = {
apiKey: string;
appKey: string;
apiBase: string;
};
export async function main(
dd_auth: Datadog,
) {
let count = 0;
// Set up a Monitors API client
const datadog = new ApiClient(dd_auth);
const monitorsApi = new V1MonitorsApi(datadog);
let monitor_urls = [];
// Search for relevant monitors via a metric filter
for await (const monitor of monitorsApi.searchToEnd(`metric:trace*`)) {
// Skip monitors that have a scoped environment set
if (!monitor.query.includes('env:production')) continue;
if (!monitor.query.includes('env:sandbox')) continue;
// return the monitor URL for further manual inspection
monitor_urls.push(`https://app.datadoghq.eu/monitors/${monitor.id}`);
count++;
}
// Return number of matched monitors as a summary
return { count: count, monitor_urls: monitor_urls };
}
Submitted by admin 500 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
import ApiClient from "https://deno.land/x/datadog_api/client.ts";
import V1MonitorsApi from "https://deno.land/x/datadog_api/v1/monitors.ts";
export async function main(
dd_auth: wmill.Resource<"datadog">,
) {
let count = 0;
// Set up a Monitors API client
const datadog = new ApiClient(dd_auth);
const monitorsApi = new V1MonitorsApi(datadog);
let monitor_urls = [];
// Search for relevant monitors via a metric filter
for await (const monitor of monitorsApi.searchToEnd(`metric:trace*`)) {
// Skip monitors that have a scoped environment set
if (!monitor.query.includes('env:production')) continue;
if (!monitor.query.includes('env:sandbox')) continue;
// return the monitor URL for further manual inspection
monitor_urls.push(`https://app.datadoghq.eu/monitors/${monitor.id}`);
count++;
}
// Return number of matched monitors as a summary
return { count: count, monitor_urls: monitor_urls };
}
Submitted by adam186 628 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
import ApiClient from "https://deno.land/x/datadog_api/client.ts";
import V1MonitorsApi from "https://deno.land/x/datadog_api/v1/monitors.ts";
export async function main(
dd_auth: wmill.Resource<"datadog">,
) {
let count = 0;
// Set up a Monitors API client
const datadog = new ApiClient(dd_auth);
const monitorsApi = new V1MonitorsApi(datadog);
let monitor_urls = [];
// Search for relevant monitors via a metric filter
for await (const monitor of monitorsApi.searchToEnd(`metric:trace*`)) {
// Skip monitors that have a scoped environment set
if (!monitor.query.includes('env:production')) continue;
if (!monitor.query.includes('env:sandbox')) continue;
// return the monitor URL for further manual inspection
monitor_urls.push(`https://app.datadoghq.eu/monitors/${monitor.id}`);
count++;
}
// Return number of matched monitors as a summary
return { count: count, monitor_urls: monitor_urls };
}
Submitted by adam186 663 days ago
import * as wmill from "https://deno.land/x/windmill@v1.19.2/mod.ts";
import ApiClient from "https://deno.land/x/datadog_api/client.ts";
import V1MonitorsApi from "https://deno.land/x/datadog_api/v1/monitors.ts";
export async function main(
dd_auth: wmill.Resource<"datadog">,
) {
let count = 0;
// Set up a Monitors API client
const datadog = new ApiClient(dd_auth);
const monitorsApi = new V1MonitorsApi(datadog);
let monitor_urls = [];
// Search for relevant monitors via a metric filter
for await (const monitor of monitorsApi.searchToEnd(`metric:trace*`)) {
// Skip monitors that have a scoped environment set
if (!monitor.query.includes('env:production')) continue;
if (!monitor.query.includes('env:sandbox')) continue;
// return the monitor URL for further manual inspection
monitor_urls.push(`https://app.datadoghq.eu/monitors/${monitor.id}`);
count++;
}
// Return number of matched monitors as a summary
return { count: count, monitor_urls: monitor_urls };
}
Submitted by rossmccrann 888 days ago