NRQL 쿼리를 실행하고, 결과를 CSV 파일로 변환한 후 Slack에 게시합니다.
요구 사항:
- NRQL 쿼리
- 비밀 정보에 슬랙 토큰이 저장되어 있습니다.
이 흐름이 하는 일은:
- 뉴렐릭 계정에 대해 NRQL 쿼리 실행
- 쿼리 결과에서 CSV 파일 생성
- CSV 파일을 메시지와 함께 슬랙 채널에 게시하세요
주요 작업: newrelic.nrdb.query, utils.transform.toCSV, slack.chat.postMessage
name: nrqlToSlackReport
workflowInputs: accountId: type: Int nrqlQuery: type: String defaultValue: 'FROM Transaction SELECT count(*) FACET appName SINCE 1 hour ago' slackChannel: type: String
steps: - name: queryData type: action action: newrelic.nrdb.query version: 1 inputs: accountIds: - ${{ .workflowInputs.accountId }} query: ${{ .workflowInputs.nrqlQuery }}
- name: convertToCSV type: action action: utils.transform.toCSV version: 1 inputs: data: ${{ .steps.queryData.outputs.results | tostring }}
- name: postToSlack type: action action: slack.chat.postMessage version: 1 inputs: token: ${{ :secrets:slack_token }} channel: ${{ .workflowInputs.slackChannel }} text: 'NRQL Query Report' attachment: filename: 'query-results.csv' content: ${{ .steps.convertToCSV.outputs.csv }}무엇 향후 계획
- AWS SQS: SQS 큐로 메시지 전송
- REST API 폴링: 외부 API를 폴링합니다.