How to use the @google-cloud/monitoring.UptimeCheckServiceClient function in @google-cloud/monitoring

To help you get started, we’ve selected a few @google-cloud/monitoring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function deleteUptimeCheckConfig(projectId, uptimeCheckConfigId) {
  // [START monitoring_uptime_check_delete]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  /**
   * TODO(developer): Uncomment and edit the following lines of code.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  // const uptimeCheckConfigId = 'YOUR_UPTIME_CHECK_CONFIG_ID';

  const request = {
    // i.e. name: 'projects/my-project-id/uptimeCheckConfigs/My-Uptime-Check
    name: client.uptimeCheckConfigPath(projectId, uptimeCheckConfigId),
  };

  console.log(`Deleting ${request.name}`);

  // Delete an uptime check config
  await client.deleteUptimeCheckConfig(request);
github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function updateUptimeCheckConfigDisplayName(
  projectId,
  uptimeCheckConfigId,
  displayName,
  path
) {
  // [START monitoring_uptime_check_update]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  /**
   * TODO(developer): Uncomment and edit the following lines of code.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  // const uptimeCheckConfigId = 'YOUR_UPTIME_CHECK_CONFIG_ID';
  // const displayName = 'A New Display Name';
  // const path = '/some/path';

  const request = {
    // i.e. name: 'projects/my-project-id/uptimeCheckConfigs/My-Uptime-Check
    name: client.uptimeCheckConfigPath(projectId, uptimeCheckConfigId),
  };

  console.log(`Updating ${request.name} to ${displayName}`);
github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function listUptimeCheckIps() {
  // [START monitoring_uptime_check_list_ips]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  // List uptime check IPs
  const [uptimeCheckIps] = await client.listUptimeCheckIps();
  uptimeCheckIps.forEach(uptimeCheckIp => {
    console.log(
      uptimeCheckIp.region,
      uptimeCheckIp.location,
      uptimeCheckIp.ipAddress
    );
  });

  // [END monitoring_uptime_check_list_ips]
}
github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function getUptimeCheckConfig(projectId, uptimeCheckConfigId) {
  // [START monitoring_uptime_check_get]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  /**
   * TODO(developer): Uncomment and edit the following lines of code.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  // const uptimeCheckConfigId = 'YOUR_UPTIME_CHECK_CONFIG_ID';

  const request = {
    // i.e. name: 'projects/my-project-id/uptimeCheckConfigs/My-Uptime-Check
    name: client.uptimeCheckConfigPath(projectId, uptimeCheckConfigId),
  };

  console.log(`Retrieving ${request.name}`);

  // Retrieves an uptime check config
  const [uptimeCheckConfig] = await client.getUptimeCheckConfig(request);
github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function listUptimeCheckConfigs(projectId) {
  // [START monitoring_uptime_check_list_configs]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  /**
   * TODO(developer): Uncomment and edit the following lines of code.
   */
  // const projectId = 'YOUR_PROJECT_ID';

  const request = {
    parent: client.projectPath(projectId),
  };

  // Retrieves an uptime check config
  const [uptimeCheckConfigs] = await client.listUptimeCheckConfigs(request);

  uptimeCheckConfigs.forEach(uptimeCheckConfig => {
    console.log(`ID: ${uptimeCheckConfig.name}`);
    console.log(`  Display Name: ${uptimeCheckConfig.displayName}`);
github googleapis / nodejs-monitoring / samples / uptime.js View on Github external
async function createUptimeCheckConfig(projectId, hostname) {
  // [START monitoring_uptime_check_create]
  // Imports the Google Cloud client library
  const monitoring = require('@google-cloud/monitoring');

  // Creates a client
  const client = new monitoring.UptimeCheckServiceClient();

  /**
   * TODO(developer): Uncomment and edit the following lines of code.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  // const hostname = 'mydomain.com';

  const request = {
    // i.e. parent: 'projects/my-project-id'
    parent: client.projectPath(projectId),
    uptimeCheckConfig: {
      displayName: 'My Uptime Check',
      monitoredResource: {
        // See the Uptime Check docs for supported MonitoredResource types
        type: 'uptime_url',
        labels: {host: hostname},

@google-cloud/monitoring

Stackdriver Monitoring API client for Node.js

Apache-2.0
Latest version published 9 months ago

Package Health Score

87 / 100
Full package analysis