Amazon Web Services are very powerful and some things are harder than you might expect. Getting an email notification that something is wrong is one of those things. I originally wrote this up so that I would remember next time I needed it and then decided it might be helpful to others.
You need to set up several things to get this to work. You need a metric, which is some value that indicates if the system is ok or not. You need an alarm that fires when that metric indicates failure. You need an SNS topic to get notified when an alarm fires. And lastly you need a subscription to that topic which a where you specify a phone number or email to receive the alarm notification.
You need to set up several things to get this to work. You need a metric, which is some value that indicates if the system is ok or not. You need an alarm that fires when that metric indicates failure. You need an SNS topic to get notified when an alarm fires. And lastly you need a subscription to that topic which a where you specify a phone number or email to receive the alarm notification.
create a subscription…some place to send the
notification
HTTP, HTTPS, email, sms, SQS
and protocol specific “endpoint”
You will receive a confirmation email, text, etc. depending on the protocol you
specified asking if you really want to create this subscription.
Create a Cloud Watch metric named
ZkServerCount
"mon-put-data" is used both to put the data and to create the metric itself if it doesn’t
already exist.
We use the command line to create
the metric because CloudWatch seems to have a problem if you have defined a lot
of metrics…and its easy to create a lot of metrics. Each instance you create automatically gets half a dozen
standard metrics and those metrics live for 14 days regardless of how long your
instance lives. If you create thousands
of worker instances you seem to
overwhelm the CloudWatch gui.
We’ve reported this as a bug and are working with Amazon about it but in
the meantime we use the command line to create metrics.
Setting up to use the command
line
setup
environment vars as described in README.TXT. You must in particular setup the AWS_CLOUDWATCH_HOME
variable
set up
credentials as per the readme.
Run this command which will both create the metric and give it its first
value of three: mon-put-data –metric-name
ZkServerCount –namespace MyNameSpace –timestamp 2013-08-25T00:00:00Z – value 3
Create a Cloud Watch metric alarm
based on that metric; this alarm will fire when the
metric’s value is less than 3:
bin/mon-put-metric-alarm –alarm-name zk-mon
–alarm-description “Alarm upon zookeeper server failure” –metric-name
ZkServerCount –namespace MyNameSpace –statistic Average –period 300 –threshold
3 –comparison-operator LessThanThreshold –evaluation-periods 1 –alarm-actions
arn:aws:sns:us-east-1:abc123:ZooKeeper_failure<
Create some code that will
periodically run the mon-put-data command from step 2 above. This looks like a lot of code to put a single value into the system but
bear in mind that this includes some one-time setup, and that you can add multiple
values at a time.
public void putMetric() {
BasicAWSCredentials
credentials =
BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);
AmazonCloudWatchClient acwc
= new AmazonCloudWatchClient(credentials);
Double metricValue = 3.0;
MetricDatum datum2
= new MetricDatum().
withMetricName(INSTANCE_COUNT_METRIC_NAME).
withTimestamp(new
Date()).
withValue(metricValue).
withUnit(StandardUnit.Count);
PutMetricDataRequest putMetricDataRequest = new PutMetricDataRequest().
withNamespace(FRAGMENT_NAMESPACE).
withMetricData(datum1, datum2, datum3);
acwc.putMetricData(putMetricDataRequest);
}
}
When you are all done its of course a good idea to trigger the condition manually just to make sure you actually do get that text or email that you really don't want to get for real!
Very interesting
ReplyDeleteAmazon Web Services are very powerful and some things are harder than you might expect. Getting an email notification that something is wrong is one of those things. Web based Time Tracking Software
ReplyDeleteI keep getting "float object has no attribute Strip" error while trying to put in an alarm. What am I doing wrong?
ReplyDeleteotr214427
ReplyDeleteINTERNATIONAL CONCEPT OF WORK FROM HOME
Work from home theory is fast gaining popularity because of the freedom and flexibility that comes with it. Since one is not bound by fixed working hours, they can schedule their work at the time when they feel most productive and convenient to them. Women & Men benefit a lot from this concept of work since they can balance their home and work perfectly. People mostly find that in this situation, their productivity is higher and stress levels lower. Those who like isolation and a tranquil work environment also tend to prefer this way of working. Today, with the kind of communication networks available, millions of people worldwide are considering this option.
Women & Men who want to be independent but cannot afford to leave their responsibilities at home aside will benefit a lot from this concept of work. It makes it easier to maintain a healthy balance between home and work. The family doesn't get neglected and you can get your work done too. You can thus effectively juggle home responsibilities with your career. Working from home is definitely a viable option but it also needs a lot of hard work and discipline. You have to make a time schedule for yourself and stick to it. There will be a time frame of course for any job you take up and you have to fulfill that project within that time frame.
There are many things that can be done working from home. A few of them is listed below that will give you a general idea about the benefits of this concept.
Baby-sitting
This is the most common and highly preferred job that Women & Men like doing. Since in today's competitive world both the parents have to work they need a secure place to leave behind their children who will take care of them and parents can also relax without being worried all the time. In this job you don't require any degree or qualifications. You only have to know how to take care of children. Parents are happy to pay handsome salary and you can also earn a lot without putting too much of an effort.
Nursery
For those who have a garden or an open space at your disposal and are also interested in gardening can go for this method of earning money. If given proper time and efforts nursery business can flourish very well and you will earn handsomely. But just as all jobs establishing it will be a bit difficult but the end results are outstanding.
Freelance
Freelance can be in different wings. Either you can be a freelance reporter or a freelance photographer. You can also do designing or be in the advertising field doing project on your own. Being independent and working independently will depend on your field of work and the availability of its worth in the market. If you like doing jewellery designing you can do that at home totally independently. You can also work on freelancing as a marketing executive working from home. Wanna know more, email us on workfromhome.otr214427@gmail.com and we will send you information on how you can actually work as a marketing freelancer.
Internet related work
This is a very vast field and here sky is the limit. All you need is a computer and Internet facility. Whatever field you are into work at home is perfect match in the software field. You can match your time according to your convenience and complete whatever projects you get. To learn more about how to work from home, contact us today on workfromhome.otr214427@gmail.comand our team will get you started on some excellent work from home projects.
Diet food
Since now a days Women & Men are more conscious of the food that they eat hence they prefer to have homemade low cal food and if you can start supplying low cal food to various offices then it will be a very good source of income and not too much of efforts. You can hire a few ladies who will help you out and this can be a good business.
Thus think over this concept and go ahead.
Do you guess have any idea about best sms alarm notification software. I found this SMS Alarm notification software . I think I have to check with it in detail.
ReplyDeleteHey can somebody provide information
ReplyDeleteAlarm notification software?
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. bulk sms at ahmedabad
ReplyDeleteI have used Win Alarm Notification Software. It is good.
ReplyDelete