Execute NRQL query, convert results to CSV, and post to Slack.
Requirements:
- NRQL query
- Slack token in secrets.
What this workflow does:
- Execute NRQL query against New Relic account
- Generate CSV from query results
- Post CSV to Slack channel with message
Key actions: 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 }}What's next
- AWS SQS: Send messages to SQS queues
- REST API polling: Poll external APIs