- defaultTab: nodes
  description: '自動診断(Linux Node''s CPU, Memory & Disk)を行い、結果をPagerDuty IncidentのNoteに出力'
  executionEnabled: true
  group: Imported Jobs
  id: 4317c7b8-5f2f-4707-a913-6c17d0f4b9be
  loglevel: INFO
  name: Automated Diagnostics
  nodeFilterEditable: true
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: false
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: 'name: mars.*'
  nodesSelectedByDefault: true
  notification:
    onfailure:
      plugin:
        configuration:
          incident_id: ${option.pd_incident_id}
          note: 'Automated Diagnostics job "${job.project}/${job.group}/${job.name}"
            Failed for incident "${option.pd_incident_id}".   See the full Process
            Automation log at: ${job.url}#output'
        type: pd-note-incident-notification
    onstart:
      plugin:
        configuration:
          incident_id: ${option.pd_incident_id}
          note: 'Automated Diagnostics job "${job.project}/${job.group}/${job.name}"
            Started for incident "${option.pd_incident_id}".   See the full Process
            Automation log at: ${job.url}#output'
        type: pd-note-incident-notification
    onsuccess:
      plugin:
        configuration:
          incident_id: ${option.pd_incident_id}
          note: 'Automated Diagnostics job "${job.project}/${job.group}/${job.name}"
            Succeeded for incident "${option.pd_incident_id}".   See the full Process
            Automation log at: ${job.url}#output'
        type: pd-note-incident-notification
  notifyAvgDurationThreshold: null
  options:
  - description: Incident ID where Runbook Automation will send the diagnostic data
      to on the Incident Timeline.
    label: PagerDuty Incident ID
    name: pd_incident_id
  - hidden: true
    label: API Key for PD REST API
    name: pd_api_token
    required: true
    secure: true
    storagePath: keys/workshop_api
    valueExposed: true
  plugins:
    ExecutionLifecycle: {}
  runnerSelector:
    filter: WORKSHOP
    runnerFilterMode: TAGS
    runnerFilterType: TAG_FILTER_AND
  scheduleEnabled: true
  schedules: []
  sequence:
    commands:
    - description: Top 5 CPU Consuming Processes
      exec: 'ps -eo pcpu,pid,cmd | sort -k 1 -nr | head -5'
      plugins:
        LogFilter:
        - config:
            hideOutput: 'true'
            logData: 'true'
            name: top_cpu
            regex: (.*)
          type: key-value-data-multilines
    - description: Top 5 Memory Consuming Processes
      exec: 'ps -eo pmem,pid,cmd | sort -k 1 -nr | head -5'
      plugins:
        LogFilter:
        - config:
            hideOutput: 'true'
            logData: 'true'
            name: top_memory
            regex: (.*)
          type: key-value-data-multilines
    - description: Top 10 Disk Consuming Files
      exec: sudo du -Shx / | sort -rh | head -10
      plugins:
        LogFilter:
        - config:
            captureMultipleKeysValues: 'false'
            hideOutput: 'true'
            logData: 'true'
            name: top_disk
            regex: (.*)
          type: key-value-data-multilines
    - configuration:
        api_token: ${option.pd_api_token}
        email: automation@pagerduty.com
        incident_id: ${option.pd_incident_id}
        note: 'Top CPU Processes:\n${data.top_cpu*}\n Top Memory Processes:\n${data.top_memory*}\n
          Top Disk Consuming Files:\n${data.top_disk*}\n\nClick here for detailed
          diagnostics: ${job.url}#output'
      description: Send Diagnostics to PagerDuty
      errorhandler:
        configuration:
          text: Please provide PagerDuty information to send diagnostics to PagerDuty
            incident.
        keepgoingOnSuccess: true
        nodeStep: false
        type: progress-badge
      nodeStep: false
      type: pd-note-step
    keepgoing: true
    strategy: node-first
  tags: linux
  uuid: 4317c7b8-5f2f-4707-a913-6c17d0f4b9be
