Thank you for the explanation. Anyone did the above things in python. Create an runbook in python and take two parameters as input. create another python script to POST HTTP the above webhook url and the parameters
Hi thanks for your comments and nice idea to try them on Python as well. Basically you can create a webhook ,Trigger the Runbook via Webhook make an HTTP POST request to the webhook URL You can try something like below import requests import json webhook_url = 'your_webhook_url_here' payload = { 'param1': 'value1', 'param2': 'value2' } response = requests.post(webhook_url, data=json.dumps(payload), headers={'Content-Type': 'application/json'}) if response.status_code == 200: print("Runbook triggered successfully!") else: print(f"Error triggering the Runbook. Status code: {response.status_code}")
Hi, Thanks for the video, I have one question regards to azure automation account runbook, I have scenario, were I need to start the runbook job from monitoring alerts. can you help me how can i configure? example if someone delete VM instance from VMSS, the alert should trigger if virtual machine delete.
Very Good Question This one you can achieve this via log analytics workspace - th-cam.com/video/OxZGz-jxkv8/w-d-xo.htmlsi=9yVJk6uCqMfFJLb2 If you want this via automation accounts then you can try something like below Create a Runbook - add the necessary code to handle the alert (e.g., stopping a VM). Create an Alert Rule - Condition, select the signal type (e.g., Activity Log) and configure the alert logic to trigger when a VM is deleted. Under Action group, create or select an action group that includes a webhook pointing to your runbook.
@@devopsinfo391 Thanks for reply, I am working 2nd point with Alert rule, but i failed to grab the exact data(webhook) from alert payload to runbook. basically, I need VMSS instance name and instance computer name also datadisk information if we want to detach and attach to newly created instance
Thank you for the explanation. Anyone did the above things in python. Create an runbook in python and take two parameters as input. create another python script to POST HTTP the above webhook url and the parameters
Hi thanks for your comments and nice idea to try them on Python as well.
Basically you can create a webhook ,Trigger the Runbook via Webhook
make an HTTP POST request to the webhook URL
You can try something like below
import requests
import json
webhook_url = 'your_webhook_url_here'
payload = {
'param1': 'value1',
'param2': 'value2'
}
response = requests.post(webhook_url, data=json.dumps(payload), headers={'Content-Type': 'application/json'})
if response.status_code == 200:
print("Runbook triggered successfully!")
else:
print(f"Error triggering the Runbook. Status code: {response.status_code}")
Hi, Thanks for the video, I have one question regards to azure automation account runbook, I have scenario, were I need to start the runbook job from monitoring alerts. can you help me how can i configure? example if someone delete VM instance from VMSS, the alert should trigger if virtual machine delete.
Very Good Question This one you can achieve this via log analytics workspace - th-cam.com/video/OxZGz-jxkv8/w-d-xo.htmlsi=9yVJk6uCqMfFJLb2
If you want this via automation accounts then you can try something like below
Create a Runbook - add the necessary code to handle the alert (e.g., stopping a VM).
Create an Alert Rule - Condition, select the signal type (e.g., Activity Log) and configure the alert logic to trigger when a VM is deleted.
Under Action group, create or select an action group that includes a webhook pointing to your runbook.
@@devopsinfo391 Thanks for reply, I am working 2nd point with Alert rule, but i failed to grab the exact data(webhook) from alert payload to runbook. basically, I need VMSS instance name and instance computer name also datadisk information if we want to detach and attach to newly created instance