slack giving alternate notification of jenkins, like 1,3,5,7,9. Not giving successive notification. Not getting the solution on it.Image Attached ( Click on the link )
Tried searching on google, but not getting any concrete solution. I launched jenkins container by creating aws instance.
Related
I am trying to process kinesis messages from aws lambda and pushing to power bi.
In lambda have logged application specific messages.
What is the problem now?
I am able to see my messages in cloud watch logs but not all. When I apply filter I am getting specific period messages which is good but not all messages of that period. Within the mentioned range Every time I scroll my mouse to get more messages and download till that point.
For Ex: In UI for specified time range if I get 100 messages I am able to download till this point. There is something I can see as "load more" When I click on it I get around 150 messages. **This is very tedious ** to scroll each time and get more messages and download .
Is there any automated way where I could download in single shot for mentioned period on all messages ?
Any help will reduce lots of effort
You can export the logs to an S3 Bucket using the CloudWatch Logs Console or using the AWS CLI. Specifying the begin time, end time and optionally Stream prefix.
First you need to set appropriate permissions.
Export logs using AWS Console
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasksConsole.html
Export logs using AWS CLI
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasks.html
I'm trying to setup notifications to be sent from our AWS Lambda instance to a Slack channel. I'm following along in this guide:
https://medium.com/analytics-vidhya/generate-slack-notifications-for-aws-cloudwatch-alarms-e46b68540133
I get stuck on step 4 however because the type of alarm I want to setup does not involve thresholds or anomalies. It involves a specific error in our code. We want to be notified when users encounter errors when attempting to login in or sign up. We have try/catch blocks in our Node.js backend to log errors to CloudWatch at various points in the login/signup flow where we think the errors are most likely happening. We would like to identify when those SPECIFIC errors are occurring and send a notification to a Slack channel built for this purpose.
So in step 4 of the article, what would I have to do to set this up? Or is the approach in this article simply the wrong one for my purposes?
Thanks.
The step 4 titled "Create a CloudWatch Alarm" uses CPUUtlization metric to trigger an alarm.
In your case, since you want to use CloudWatch Logs, you would create CloudWatch Metric Filters based on the logs entries of interest. This would produce custom metrics based on your error string. Subsequently, you would create CloudWatch Alarm of this metric as shown in the linked tutorial for CPUUtlization.
I would like to receive a notification on my Notification Channel every time in Cloud Build a Build on master fails.
Now there were mentions of using Log Viewer but it seems like there is no immediate way of accessing the branch.
Is there another way where I can create a Monitoring Alert/a Metric which is specific to master?
A easy solution might be to define a logging metric and link an alerting trigger to this.
Configure Slack alerting in Notification channels of GCP.
Define your logging metric trigger in Logs-based Metrics. Make a Counter with Units 1 and filter using the logging query language:
resource.type="build"
severity=ERROR
or
resource.type="build"
textPayload=~"^ERROR:"
Create an Alerting Policy with that metric you've just defined and link the trigger to your Slack notification channel you've configured in step 1.
you can create Cloud Build notifications sending you updates to desired channels, such as Slack or your SMTP server HTTP channel. Also create a PubSub topic when your build's state changes, such as when your build is created, when your build transitions to a working state.
I just went through the pain of trying to get the official GCP slack integration via Cloud Run working. It was too cumbersome and didn't let me customize what I wanted.
Best solution I see is to get Cloud Build setup to send Pub/Sub messages to the cloud-builds topic. With that, you can use the below repo I just made public to filter on the specific branch you want but looking at the data_json['substitutions']['BRANCH_NAME'] field.
https://github.com/Ucnt/gcp-cloud-build-slack-notifier
So we spent almost 6 months in moving our current app stack from AWS to GCP and now we got stuck at the AWS-SNS part.
Apparently there seems to be no service in GCP stack that can simply provide a drop in replacement for SNS or did I miss something?
Right now everything is running perfectly fine on GCP and every call to SNS in the app is still using the old AWS account.
SNS is being used primarily to notify events occurring in the app like "batch completed successfully" or "export failed with xyz error".
What are our options here?
The closest SNS replacement in GCP is probably Cloud Pub/Sub, which provides a similar publish-subscribe messaging pattern.
This document shows how the topics and subscriptions work.
At present, GCP does not have a native / proprietary email or text message service. Instead, the recommendation is to use sendgrid for emails and twilio for messages. See the following articles that describe the usage of these services:
https://cloud.google.com/appengine/docs/standard/php/sms/twilio
https://cloud.google.com/appengine/docs/standard/php/mail/sendgrid
I am using AWS Lambda to check the health status and then send out an email. If the health is down I want it to send an email only once.
This Lambda function runs every 20minutes or so and I would like to prevent it from sending out multiple emails in interval if things have broken. Is there a way store environment variables or something in the AWS eco system so that it knows the state between each lambda function runs. (that way it doesnt send out an email and knows it has sent an email already).
I have looked into creating an alarm and sending out notifications but the email sent out through alarm wont do and I would like to have a custom email sent out, so I am using AWS SES through lambda. There is a cloud watch alarm that turns on when there is an error but I cant seem to fetch the state of alarm through the aws-sdk (its apparently not there).
I have written the function in NodeJS
Any suggestions ?
I've implemented something like this a little differently. I too do not care for getting an email for each error, since the errors I receive from my AWS Lambdas do not require immediate attention. I prefer to get them once an hour.
So I write all the errors I receive to an SQS queue. I configure the AWS Lambdas, which are throwing the errors, to send certain errors (configurable via environment variables) to certain SQS queues. Cloudwatch rules (running whenever), configured to pull from specific SQS queues in the Cloudwatch rule definition, then execute an AWS Lambda passing in the rule definition containing the SQS queue to pull from. The Lambda called by the CloudWatch rule handles reading from the SQS queue then emailing the results.
For your case you could modify that process to read all the errors from SQS, then filter that data down to the results you want to send. I use SQS because the "errors" I get don't need to be persisted.
I could see two quick ways to store something like a "last_email_sent" value. The first would be in DynamoDB. This is part of the AWS "serverless" environment that doesn't require you to do much more than interact with it. You didn't indicate your development environment but there are multiple development environments that are supported.
The second would be with the SSM Parameter Store. You can store any number of parameters there too.
There are likely other ways to do this too. Both of these are a bit of overkill but they would work to store what you need.
Alright, I found a better way that is simpler without dealing with other constraints. The NodeJS sdk is limited as it is. When the service is down create an alarm through the sdk and the next time the lambda gets triggered check if the alarm exists and send an email. That way if you want to do some notification through alarm it is possible too.
I think in my question I said this was not possible (last part), which I will retract.
Here is the link for the sdk reference: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatch.html