gcp-slo-management
🐉 Manage Service Level Objectives (SLOs) on Google Cloud. Use when you need to discover Monitoring Services, list existing SLOs, or create new SLOs (Availability/Latency) via the REST API when gcloud commands are unavailable.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-12
- Stars
- ★ 131
- Forks
- 9
01 前言 Front Matter
- name
- gcp-slo-management
- metadata
- { "author": "Google", "status": "published", "version": "0.1.0" }
- description
- 🐉 Manage Service Level Objectives (SLOs) on Google Cloud. Use when you need to discover Monitoring Services, list existing SLOs, or create new SLOs (Availability/Latency) via the REST API when gcloud commands are unavailable.
02 资源文件 1
- 脚本scripts/discovery.py3.1 KB
03 SKILL.md 正文
GCP SLO Management
Overview
This skill enables the discovery and management of SLOs in Google Cloud Monitoring. Since gcloud lacks native SLO creation commands, this skill leverages the Monitoring REST API and a bundled discovery script.
Core Pattern
1. Discover Services
Every SLO must be attached to a Service. Use the discovery script to find the correct Service ID.
- Command:
python3 skills/gcp-slo-management/scripts/discovery.py <PROJECT_ID> - Output: A table showing
Display NameandService ID.
2. Create an SLO
Use curl to POST a JSON definition to the service.
Example: 99% Availability (7-day rolling)
# Set variables
PROJECT_ID="your-project"
SERVICE_ID="wl:..." # From step 1
TOKEN=$(gcloud auth application-default print-access-token)
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"https://monitoring.googleapis.com/v3/projects/$PROJECT_ID/services/$SERVICE_ID/serviceLevelObjectives" \
-d '{
"displayName": "99% Availability - Last 7 Days",
"goal": 0.99,
"rollingPeriod": "604800s",
"serviceLevelIndicator": {
"basicSli": {
"availability": {}
}
}
}'
Advanced Patterns
- Custom Services: For services not automatically discovered (e.g., frontend logs), you must use
requestBasedorwindowBasedSLIs with specific metric filters. - Latency SLOs: Requires defining a
latencythreshold withinbasicSli.
Troubleshooting
- 403 Forbidden: Ensure you have run
gcloud auth application-default loginand that your account hasroles/monitoring.editor. - Service Not Found: Use the discovery script to verify the
Service IDexists in the target project.
04 同仓库更多 Skills
safe-sre-investigator
🐉 Sets up and uses read-only Service Accounts for GCP and Kubernetes investigations using the principle of least privilege, and provides risk assessments for suggested commands. Use when asked to investigate GCP/GKE resources or suggest gcloud/kubectl commands.
pre-publish-checker
🐉 Thoroughly checks files for profanity, internal links, sensitive paths, and professionalism before publication. Use when preparing a codebase or extension for public release.
postmortem-generator
🐉 Creates a PostMortem given enough context about an incident/outage. Will guide user to timeline, action items/bugs, and finally draft a Google Doc with the results.
postmortem-aggregator
🐉 To be used when you have a folder containing N Post Mortem files. This will help crunch data and maintain/update a POMO_AGGREGATED.md file.
monitoring-graphs
🐉 Skill for generating high-quality, annotated incident graphs for post-mortems using Python. Use this when the user needs to visualize an outage, show error rates, or correlate metrics with incident milestones.
investigation-entrypoint
🐉 The primary entrypoint for investigating production outages, orchestrating SRE response, and mitigating incidents on Google Cloud Platform (GKE, Cloud Run, etc.). Start here when an incident occurs.