Hi,
I am developing a proxy where email needs to be sent out to customers when they exceed requests over a certain number. I am trying to find out the best way to handle this functionality.
I have confusion over SMTP host,username and password.
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText smtpserver.connect() host = flow.getVariable("emailhost"); port = flow.getVariable("emailport"); username = flow.getVariable("emailusername"); password = flow.getVariable("emailpassword"); mailTo = flow.getVariable("email"); bodyMessage = "Quota Exceeded"; subject = flow.getVariable("emailsubject"); mailFrom = flow.getVariable("emailfrom"); ssl = 'true'; auth = 'true'; msg = MIMEMultipart() msg['Subject'] = subject msg['From'] = mailFrom msg['To'] = mailTo msg.attach( MIMEText(bodyMessage, 'html')) smtpserver = smtplib.SMTP(host,port) if ssl=='true': smtpserver.ehlo() smtpserver.starttls() smtpserver.ehlo if auth=='true': smtpserver.login(username, password) smtpserver.sendmail(mailFrom, mailTo, msg.as_string()) smtpserver.quit()
I have come across this scenario earlier. We didn't have any notification in apigee. We had used two ways. one was with monitoring through nagios and notifying when there is a quota excess limit error. Another way is setting notification in KIBANA logger when there is a quota error.
But third-party tools like Kibana can get called in proxy when there is quota policy failure?
As the tools I have are within network and Apigee will be in google cloud right
I used API monitoring Alerts. I found a solution for my problem over there. I did setup with faultcode of 429 and it shows alerts via email
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |