Rocket.chat + NewRelic

class Script {
    process_incoming_request({ request }) {
      var webhookPayload = request.content;
      var webhookIncidentId = webhookPayload.incident_id;
      var webhookSeverity = webhookPayload.severity;
      var webhookCurrentState = webhookPayload.current_state;
      var webhookPolicyName = webhookPayload.policy_name;
      var webhookConditionName = webhookPayload.condition_name;
      var alertColor = "warning";
      var channels = ["#cloud-team"];
  
      if(webhookCurrentState === "open") { alertColor = "danger";}
      
      if(webhookPolicyName === "Project A") { channels.push("#ProjectA"); }
      else if(webhookPolicyName === "Project B") { channels.push("#ProjectB"); }
      
      //console.log(request.content);
      //console.log("Channels: " + channels.join(", "));
            
      return {
          content:{
            channel: channels,
            attachments: [{

              title: webhookSeverity + ' - ' + webhookPolicyName,
              text: "Condition: " + webhookConditionName + "\nIncident Id: " + webhookIncidentId,
              color: alertColor,
              fields: [
                {
                  title: "Status",
                  value: webhookCurrentState
                }
              ]
            }]
           }
        };
      };
  };

Akamai – API e Cli

  • httpie-edgegrid – Dockerfile
FROM alpine:latest
RUN apk --no-cache update
RUN apk add --no-cache build-base python3 python3-dev py3-pip git libffi libffi-dev openssl openssl-dev bash
RUN pip install httpie-edgegrid
RUN rm -rf /var/cache/apk/*