How can I get more than one Stackdriver notifications from a given metric? - google-app-engine

I defined alerts based on a log metric. (For testing, I made sure that this is a metric that occurs every minute.)
I get an email, as follows -- but only one. How can I have further emails sent when the metric is triggered again? Note that after I got that one email, I logged in and "Acknowledged" the incident but no more emails come.
From: Stackdriver Alerts <alerts#stackdriver.com>
Date: Tue, Feb 21, 2017 at 5:35 PM
Subject: [ALERT] Suggested Condition on myapp default:20161017t181616
To: a..#...s.com
Stackdriver has detected that one of your resources has entered an alert state.
Summary: logging/user/FilterMetricIContainerOnUrlAndRequestStatus for myapp default:20161017t181616 with metric labels {log=appengine.googleapis.com/request_log} is below the threshold of 100 with a value of 0.016666666666666666.
Violation Began: 2017-02-21 15:28:48 UTC (6 mins 59 secs)
Condition Name: Suggested Condition
View violation details: https://app.google.stackdriver.com/account/login/cloud-eng-dev/incidents/0.k99rt8xwbh5i

you should be receiving a notification for every incident that's open. I suggest if this isn't the case and you've verified that the conditions are met again (so the metric is in violation again), that you click on the bottom right "Send Feedback" button, and include my name so I catch it. That will help provide more info into your situation.
Thanks for using Stackdriver!

My guess is that you're getting one incident that doesn't close, which suggests that your alerting policy is defined too loosely. Is your alerting duration shorter than the interval between log messages? I'd suggest making it no more than half the interval.
Aaron Sher, Stackdriver engineer

Related

AppleScript Calendar automation

I have an AppleScript that runs on loop every two hours to modify a calendar B based on updates from another calendar A.
The script uses the on idle command below to wait 2 hours every loop. What happens if the computer stays idle for 1.5 hours then goes to sleep for 10 hours? Will there be 0.5 hours left when it wakes up? Any other scenarios?
on idle
my_code()
return (120 * minutes)
end idle
The script truly only needs to run if there is an update to calendar A, which is a shared iCloud calendar and can get updates from multiple people. The two hour loop is what I could figure out so far but I feel it is not efficient. Any more robust suggestions? Is there a way I can trigger the script to run only when it detects an update in calendar A? Or, along the same line of thought, is there a way to get the last timestamp the calendar was updated?
Thanks
I can't test following. Not sure it is the best way to solve your problem. Try yourself:
property oldStampDates : {}
on run
tell application "Calendar" to tell calendar "Test Calendar" to set oldStampDates to get stamp date of events
end run
on idle
--> Script retrieves last modified date and time of indicated calendar events.
tell application "Calendar" to tell calendar "Test Calendar" to set newStampDates to get stamp date of events
if newStampDates is not oldStampDates then display notification "The changes was detected"
set oldStampDates to newStampDates
return 30 -- seconds, default setting
end idle
NOTE: 1) you can put instead of display notification call to your handler my_code(), 2) you can put instead of 30 seconds other value, for example, return 10 (checking every 10 seconds).

Alexa simulator does not recognise number as slot value

this is my utterance - "when do the may holidays start for boarders in 2018",
which "may" and "2018" are my required slot values. However alexa is not picking up "2018" as a slot value already fulfilled but only "may" as fulfilled. i realised this is only happening because 2018 is a number. is there anyway to go around this?
See screenshot in the link
You can use AMAZON.FOUR_DIGIT_NUMBER. I think you're typing your request in the Alexa simulator, so maybe Alexa is not able to recognize that as a year. But when a user SAYS(voice) the content in the screenshot above, Alexa interprets it as:
When do the may holidays start for boarders in two thousand eighteen
Then the built-in slot AMAZON.FOUR_DIGIT_NUMBER will convert two thousand eighteen to 2018 automatically and 2018 will be available to you to use it in your code.
Alternatively, you can use AMAZON.DATE, but this didn't recognize my years properly sometimes. So, for year recognition, I had to ignore AMAZON.DATE.

piwik error while request data in a daterange

i have a problem for getting reports in piwik from a date range about 30 days on dashboard , visitors and actions tabs. when i want to do this this error occures :
Oops… there was a problem during the request. Maybe the server had a temporary issue, or maybe you requested a report with too much data. Please try again. If this error occurs repeatedly please contact your Piwik administrator for assistance.
i did archiving with below command :
/usr/bin/php /var/www/html/piwik/console core:archive --url=http://myip/piwik/
and it resolved issue just on dashboard , and it still show that error when i want to get reports for a date range about 30 days on visitors and actions tabs.
when i set the date range to smaller ranges for example about 15 days it is ok and does not shows any error.
i have installed piwik on RHEL with php 5.3.3 and mysql 5.1 .
can anyone help me how to fix this problem.
thanks
I have fixed this issue. It is related with data format. After changing the date format, i could able to load my page with out issue. I have added the error.log for the reference.
Hope this will help to someone who is seeking help.
You can change the particular table column "date format" by using the below query:
UPDATE table_name
SET field_name = replace(same_field_name, 'unwanted_text', 'wanted_text')
[Sat Sep 12 12:03:37.124105 2015] [:error] [pid 21414] [client 192.168.1.22:50006] Error in Piwik: Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information): -62169984000, referer: http://192.168.1.20/AP_Enterprise/index.php?module=MultiSites&action=index&idSite=1&period=day&date=yesterday
i increased memory_limit from 128M to 512M and max_execution_time from 30 to 120 in my php.ini and the issue resolved.
this may be useful for someone with same problem.
thanks
This error usually means, that there was a timeout. Try to adjust your configs. The reason for timeouts is the fact, that date range reports are not pre-archived.
On the other hand, it's recommended to use PHP 5.4+ and MySQL 5.5+ if the performance is important for you.

How to identify reason of OverQuotaError when sending emails?

I send emails with cron job and task queue usage. The job is executed every 15 minutes and the queue used has the following setup:
- name: send-emails
rate: 1/m
max_concurrent_requests: 1
retry_parameters:
task_retry_limit: 0
But quite often apiproxy_errors.OverQuotaError exception happens. I am checking Quota Details and see that I am still within the daily quota (Recipients Emailed, Attachment Data Sent etc.), and I believe I couldn't be over maximum per minute limit, since the the rate I use is just 1 task per minute (i.e. send no more than 1 mail per minute).
Where am I wrong and what should I check?
How many emails are you sending? You have not set a bucket-size, so it defaults to 5. Your rate sets how often the bucket is replenished. So, with your current configuration, you can send 5 emails every minute. That means if you are sending more than 75 emails to the queue every 15 minutes, the queue will fill up, and eventually go over quota.
I have not tried this myself, but when you catch the apiproxy_errors.OverQuotaError exception, does the message contain any detail as to why it is over quota/which quota has been exceeded?
try:
send_mail_here
except apiproxy_errors.OverQuotaError, message:
logging.error(message)

Nagios timeperiod and notification period

I'm having troubles getting Nagios to honor a notification_period setting for a predefined timeperiod.
My timeperiod definition is called 'sleep' as in, do not notify me between midnight and 7am. it looks like this:
define timeperiod{
timeperiod_name sleep
alias Not Middle of Night
sunday 07:00-23:59
monday 07:00-23:59
tuesday 07:00-23:59
wednesday 07:00-23:59
thursday 07:00-23:59
friday 07:00-23:59
saturday 07:00-23:59
}
I've entered the directive for the hosts as follows:
define host{
use linux-server,host-pnp
host_name server.domain.com
alias server.domain.com
address xxx.33.xxx.243
notification_period sleep
}
This morning I was expecting to see WARNING notifications but only after 7am. Instead, I saw them throughout the night between 23:59 last night and 7am this morning.
My understanding from the configuration is that I should NOT have received any emails during this time.
Have I overlooked something? I was hoping it would be this simple but it didn't work as expected.
I have solved this issue which stemmed from a lack of understanding of the way Nagios is configured. In short, custom service checks require custom notification_period directives if desired.
The question was asked and correctly answered in detail here:
Nagios Forum: notification_period not honoured on host config?
Just a hint. Please, check your time and time zone setting on the Nagios server. Your configuration looks fine for me.
Rather than adding it to all your service checks. You can add it to you contact or contact_group having the email addresses that should be notified during that time. I do basically the same for two different groups because we are 24X7. The US group gets the notifications during EST days, and the Asian group gets them at night. Saving everyone a lot of needless alert spam.

Resources