Exécuter une requête NRQL, convertir les résultats en CSV et les publier sur Slack.
Exigences:
- Requête NRQL
- Jeton Slack dans les secrets.
Ce que fait ce workflow :
- Exécuter une requête NRQL sur le compte New Relic
- Générer un CSV à partir des résultats de la requête
- Publier un CSV sur un canal Slack avec un message
Actions clés: 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 }}Et ensuite ?
- AWS SQS: Envoyer des messages aux files d'attente SQS
- Interrogation de l'API REST: Interroger les API externes