We shut down our azure vm's every day at 11pm and start them at 7am, except for weekends.
Is there a way we can check the heartbeat on weekdays only between 7.30am and 10.30pm to see if the server is alive and working?
If so, how can I send a mail for the servers that miss the heartbeat during that time?
There doesn't seem to be any support from any Azure service for creating monitoring or alerts that fire only between certain hours.
It seems Azure monitoring, Log Analytics or specific service alerts (like specific a VM) all assume the alerts should be active at all times.
Some possible solutions that might work that I came up with:
If you need to use Azure services, you could create an Azure Automation PowerShell runbook
Set it to trigger regularly (every hour?) and in code handle the time interval you are interested in
Also, in code do the testing if the service is up
In my opinion, feels a bit hackish..
Use some external tool for monitoring your services, like e.g. Nagios
See e.g. this link for how it could work
Related
I have an Application Insight resource on which I activated an Alert rule.
I created this rule around 12:00 so i receive the emails on that time. It is possible to set the hour of reception of this mail in an arbitrary hour?
If you're using azure alerts, it is impossible.
You can take a look at Automate Application Insights processes by using Logic Apps which can help you for this issue.
I need to create a background job. There is NO trigger point for this.
It should run at FIXED time every day. It need to fetch data from some external API and update our application database. I need to setup it in Azure. What managed service I should use?
Azure Functions or Azure Webjobs. Both support schedule:
https://learn.microsoft.com/en-us/azure/app-service/webjobs-create#CreateScheduledCRON
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer
Azure Automation might be the answer also, depending on your language preference:
https://learn.microsoft.com/en-us/azure/automation/automation-schedules
When Azure shuts down a VM for planned maintenance, what messages do running services see, if any?
For example, do they get a ServiceBase.OnShutdown() message and, if so, how long does the service / server get to complete shutdown processing?
Does MS give any extra leeway to its own apps? E.g. if a VM is running SQL Server, will Azure wait for SQL Server to stop cleanly before shutting down the VM?
[I can't find this in the documentation and, unfortunately, I don't have the access or the programming skills to try it out for myself.]
what messages do running services see, if any?
Based on my knowledge, for now, Azure does not support this. Please refer to this feedback.
Typically maintenance is performed at weekends for VMs not in an availability set to minimize impact on services. Normally notification is given 7 days in advance with the minimum being 3 business days. A start time for the maintenance is given with the expected duration. More information please refer to this link.
According to your description, I suggest you could provision another IaaS VM with your SQL server and put in the same Availability set. By doing this, Azure will ensure that both your VMs do not go down simultaneously.
In our app (Azure hosted) we produce invoices, these have to be injected into an on premise accounting software. It is not possible to host an API that would be reachable from the Azure to post the invoices to.
Is it possible to create an exe that runs on-premise an that get's triggered by Azure Q-messages like WebJobs can ? Once triggered retrieve the invoice from a blob-storage-object.
Other suggestions are also welcome.
One important thing I want to mention is that even WebJobs poll the queue at predetermined interval (I believe the default is 30 seconds). Azure Queues don't support triggering mechanism like you think.
What you want to do is entirely possible though. What you could do is write a Windows Service, that essentially wakes up at a predetermined interval and checks for messages in the queue. If it finds messages, then it processes those messages otherwise go back to sleep again.
Can anybody explain the difference between Azure Web Jobs and Azure Scheduler
Azure Web Jobs
Only available on Azure Websites
It is used to run code at particular intervals. E.g. a console application every day
Used to trigger and run workloads.
Mainly recommended for workloads that either scale with the website or are relatively small.
Can be persistently running if "Always On" selected, otherwise you will get the 20 min timeout.
The code that needs to be run and schedule are defined together.
Azure Scheduler
Is not tied to Websites or Cloud Services
It allows you to call a website or add a message to a storage queue
Used for triggering events or triggering small workloads (e.g. add to queue), usually to trigger larger workloads
Mainly recommended for triggering more complex workloads.
This is only a trigger, and a separate function listening to trigger events (e.g. queue's) needs to be coded separately.
For many instances I prefer to use the scheduler to push to a storage queue and a worker role on each instance takes off the queue. This keeps tasks controlled granularly and can also move up or down in scale outside of your website.
With WebJobs they scale up and down with your site and hence your background tasks can become over taxed if your website is experiencing low traffic and scaled down.
Azure Scheduler - Provides a way to easily schedule http calls in a well-defined schedule, like every hour, every Friday at 9:00 am, Once a day, ...
Azure WebJobs - Provides a way to run small to medium work load (in the form of a script: .exe, .cmd, .sh, .js, ...) at the same context of an Azure Website (but can be hosted even with an empty website).
While a WebJob can run continuously (with a process that has a while loop) and Azure will make sure this WebJob is always running (with "Always On" set).
There is also an integration between Azure scheduler and Azure WebJobs where you have a WebJob that is running some finite work and the schduler is responsible for scheduling this work (invoking the WebJob).
So in summary, the scheduler is about scheduling work and WebJobs is about running work load.