Monitor Newrelic Update Job #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update monitor newrelic job | |
| run-name: Monitor Newrelic Update Job | |
| on: | |
| schedule: | |
| - cron: '0 10 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| csv_file: | |
| description: 'CSV file to run' | |
| required: true | |
| default: https://raw.githubusercontent.com/CBIIT/datacommons-devops/main/monitoring/FNL-Monitoring-List.csv | |
| jobs: | |
| run-monitor: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.9 | |
| id: python-setup | |
| uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0 | |
| with: | |
| python-version: "3.9" | |
| - name: Install Dependencies | |
| id: install-dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r monitoring/scripts/requirements.txt | |
| - name: Run the monitor update script | |
| id: monitor-update | |
| env: | |
| NR_ACCT_ID: ${{ secrets.NR_ACCT_ID }} | |
| EMAIL: ${{ secrets.EMAIL }} | |
| KEY: ${{ secrets.KEY }} | |
| LOCATION: ${{ secrets.LOCATION }} | |
| LOCATION_KEY: ${{ secrets.LOCATION_KEY }} | |
| run: | | |
| CSV_FILE="https://raw.githubusercontent.com/CBIIT/datacommons-devops/main/monitoring/FNL-Monitoring-List.csv" | |
| if [ -n "${{ github.event.inputs.csv_file }}" ]; then | |
| CSV_FILE="${{ github.event.inputs.csv_file }}" | |
| fi | |
| python3 monitoring/scripts/monitor_update_csv.py -f "$CSV_FILE" | |
| - name: Slack Notification | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| uses: act10ns/slack@87c73aef9f8838eb6feae81589a6b1487a4a9e08 # v1.6.0 | |
| with: | |
| status: ${{ job.status }} | |
| steps: ${{ toJson(steps) }} | |
| message: "Newrelic Monitors Updated" | |
| if: always() |