{"_id":"@alerthq/provider-gcp-monitoring","_rev":"2-bd035410efc608e2f492151b09722679","name":"@alerthq/provider-gcp-monitoring","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@alerthq/provider-gcp-monitoring","version":"0.0.1","keywords":["alerthq","provider","gcp","google-cloud","monitoring","alerts"],"license":"MIT","_id":"@alerthq/provider-gcp-monitoring@0.0.1","maintainers":[{"name":"rsafaya","email":"rsafaya@edrv.io"}],"homepage":"https://github.com/ai-software-agency/alerthq#readme","bugs":{"url":"https://github.com/ai-software-agency/alerthq/issues"},"dist":{"shasum":"1194330eeb9f2c2f6005b5997f645a6188f2b74e","tarball":"https://registry.npmjs.org/@alerthq/provider-gcp-monitoring/-/provider-gcp-monitoring-0.0.1.tgz","fileCount":5,"integrity":"sha512-nhSxgaZS/u4VpHWAlYO+5KnyjhEAOGGUTuaJG0v/mUFi/alITLLhtAKItrpNS84HX6pqUy3SgRKC1IMPM0RqBw==","signatures":[{"sig":"MEQCIFKyhbfDapFYubhDuLQ9hlhKAF8koVhNwJ83NHNvGhwIAiAWGXx66Zjjmi83mFm1lHbi+a4BXgxzZn6/vpBWQ8uMqw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16701},"main":"./dist/index.js","type":"module","_from":"file:alerthq-provider-gcp-monitoring-0.0.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"lint":"eslint src/","test":"vitest run --passWithNoTests","build":"tsup src/index.ts --format esm --dts","typecheck":"tsc --noEmit"},"_npmUser":{"name":"rsafaya","email":"rsafaya@edrv.io"},"_resolved":"/private/var/folders/y_/sbbsfnm54k310t77b7c43cdm0000gn/T/24b76964f1f0061e767169a87bacbecd/alerthq-provider-gcp-monitoring-0.0.1.tgz","_integrity":"sha512-nhSxgaZS/u4VpHWAlYO+5KnyjhEAOGGUTuaJG0v/mUFi/alITLLhtAKItrpNS84HX6pqUy3SgRKC1IMPM0RqBw==","repository":{"url":"git+https://github.com/ai-software-agency/alerthq.git","type":"git","directory":"packages/provider-gcp-monitoring"},"_npmVersion":"11.7.0","description":"GCP Cloud Monitoring alert provider for alerthq","directories":{},"_nodeVersion":"25.4.0","dependencies":{"zod":"^3.24.0","@google-cloud/monitoring":"^5.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@alerthq/core":"0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/provider-gcp-monitoring_0.0.1_1775722591131_0.15971875784294176","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-04-09T08:16:30.967Z","modified":"2026-04-09T09:10:04.652Z","0.0.1":"2026-04-09T08:16:31.266Z"},"bugs":{"url":"https://github.com/ai-software-agency/alerthq/issues"},"license":"MIT","homepage":"https://github.com/ai-software-agency/alerthq#readme","keywords":["alerthq","provider","gcp","google-cloud","monitoring","alerts"],"repository":{"url":"git+https://github.com/ai-software-agency/alerthq.git","type":"git","directory":"packages/provider-gcp-monitoring"},"description":"GCP Cloud Monitoring alert provider for alerthq","maintainers":[{"email":"dpipalia@edrv.io","name":"dhruvin-edrv"},{"email":"rsafaya@edrv.io","name":"rsafaya"}],"readme":"# @alerthq/provider-gcp-monitoring\n\nGCP Cloud Monitoring alert provider for [alerthq](https://github.com/edrv/alerthq).\n\n## Supported Alert Types\n\n| Alert Type | API Source | Notes |\n|------------|-----------|-------|\n| Metric threshold alerts | `AlertPolicyServiceClient.listAlertPolicies()` via `@google-cloud/monitoring` | Conditions based on metric thresholds (e.g. CPU > 80%) |\n| Metric absence alerts | Same API | Conditions that fire when a metric stops reporting |\n| Log-based alerts | Same API | Conditions that match log entries (`conditionMatchedLog`) |\n\n## Authentication\n\nUses Google Application Default Credentials (ADC). Credentials are resolved in this order:\n\n1. Inline `credentials` in config (`client_email` + `private_key`)\n2. `keyFilename` pointing to a service account JSON key file\n3. `GOOGLE_APPLICATION_CREDENTIALS` environment variable\n4. Metadata server (on GCE, Cloud Run, GKE, etc.)\n5. `gcloud auth application-default login`\n\nSee: [Application Default Credentials documentation](https://cloud.google.com/docs/authentication/application-default-credentials)\n\n## Configuration\n\nAdd to your `alerthq.yaml`:\n\n```yaml\nproviders:\n  gcp-monitoring:\n    enabled: true\n    projectId: my-gcp-project-id\n```\n\nWith explicit service account key file:\n\n```yaml\nproviders:\n  gcp-monitoring:\n    enabled: true\n    projectId: my-gcp-project-id\n    keyFilename: /path/to/service-account.json\n```\n\n| Field | Type | Required | Default | Description |\n|-------|------|----------|---------|-------------|\n| `projectId` | `string` | Yes | — | GCP project ID to scan for alert policies |\n| `keyFilename` | `string` | No | — | Path to a service account JSON key file |\n| `credentials` | `object` | No | — | Inline credentials with `client_email` and `private_key` |\n\n## Required Permissions\n\nThe authenticated identity needs the **Monitoring Viewer** role (`roles/monitoring.viewer`) on the project. Specifically:\n\n- `monitoring.alertPolicies.list`\n- `monitoring.notificationChannelDescriptors.list`\n\n## Field Mapping\n\n| AlertDefinition Field | Source |\n|-----------------------|--------|\n| `id` | `generateAlertId('gcp-monitoring', policy.name)` |\n| `source` | `'gcp-monitoring'` |\n| `sourceId` | `policy.name` (full resource name, e.g. `projects/{project}/alertPolicies/{id}`) |\n| `name` | `policy.displayName` |\n| `description` | `policy.documentation.content` |\n| `enabled` | `policy.enabled.value` (BoolValue wrapper, defaults to `true`) |\n| `severity` | `policy.severity` mapped: CRITICAL = critical, ERROR = warning, WARNING = info, unset = unknown |\n| `conditionSummary` | Built from `policy.conditions` (filter, comparison, threshold) joined by combiner |\n| `notificationTargets` | `policy.notificationChannels` resolved to display names via channel lookup |\n| `tags` | `policy.userLabels` |\n| `owner` | `policy.mutationRecord.mutatedBy` (falls back to `creationRecord.mutatedBy`) |\n| `lastModifiedAt` | `policy.mutationRecord.mutateTime` converted to ISO 8601 |\n\n## Limitations\n\n- Only fetches alert policies — uptime check configs use a separate API (`UptimeCheckServiceClient`) and are not included.\n- The `severity` field was introduced later in the API; older alert policies may not have it set (mapped to `'unknown'`).\n- Notification channel resolution requires the `monitoring.notificationChannelDescriptors.list` permission; if unavailable, raw channel resource names are used as targets.\n- The `owner` field uses the last mutator from `mutationRecord`, which may be a service account rather than a human user.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}