뉴렐릭 상태 API 에서 JSON을 가져오고, 구성 요소 상태를 구문 분석하고, 로그인 문제를 처리합니다.
요구 사항:
- API 접근 상태.
- 로그 수집 권한.
이 흐름이 하는 일은:
- 뉴렐릭 상태 API에서 JSON 데이터를 가져옵니다.
- 구성 요소를 작동 상태에 따라 추출하고 분류합니다.
- 조건부로 운영 구성 요소를 테스트합니다(활성화된 경우)
- 비작동 구성 요소를 조건부로 로그합니다(활성화된 경우)
- HTTP 오류를 처리하고 로그인을 했습니다.
주요 작업: http.get, newrelic.ingest.sendLogs
name: parse_status_api
steps: - name: fetchStatus type: action action: http.get version: 1 inputs: url: 'https://status.newrelic.com/api/v2/summary.json' selectors: - name: operational expression: '.components[] | select(.status == "operational") | .name' - name: degraded expression: '.components[] | select(.status != "operational") | .name'
- name: logNonOperational type: action action: newrelic.ingest.sendLogs version: 1 inputs: logs: - message: 'Services with issues: ${{ .steps.fetchStatus.outputs.degraded | tostring }}' attributes: operationalServices: ${{ .steps.fetchStatus.outputs.operational }}