SCOM to Slack Integration - slack

I want to integrate slack with SCOM. SO i have a powershell script which will post notifications to slack and i have found where to place it so that it will get executed when some error occurs. But I am unable to find a way to create a Custom rule for error generation (eg. I want to create a rule which will trigger when any machine configured in SCOM, goes down or when its CPU utilization goes down). So that when this rule breaks, my Powershell script for slack notification will get triggered. IS this possible in SCOM?

Create a new command channel in SCOM
Attach the script that will process the alert's output ( the logic to both transform the data and send it to slack )
Create a subscription to the monitors and rules that you want passed to slack
Subscribe the command channel to the subscription
Reference: https://blogs.technet.microsoft.com/fesiro/2012/11/26/how-to-configure-command-notification-in-scom-2012-with-powershell-script/
If you have Orchestrator in your System Center infrastructure you can make a runbook that is initialized by a SCOM alert. You will need to setup the SCOM connector if you haven't but this is a great way to make the process more easily managed. Then you can call your script inside the runbook.

Related

Queue Clean After Power Automate Queue triggers finished

I have a Power automate Flow which triggers when there is a message in azure queue and process the message. Power automate triggers perfectly when there is a item in queue. But after successful process , Message is returning back to the queue. And again getting trigger by power automate. Is there any settings I have to change ?
Can someone help ?
After reproducing from my end, I faced the same issue. To resolve this, one way you can do is to add another action called Delete message (V2) specifying the required properties in the end. Below is the flow of my logic app.

How to design notification system that sends real-time alerts created by users

I've been thinking about how to design a system that supports user created scheduled alerts. My problem is once the alerts are created and inserted into a database, I don't know what the best way to go about scheduling those alerts. Polling the database to see which alerts need to go out next doesn't seem entirely right to me.
What are some ways this could be handled on a scale where say a million users could create their own custom alerts like change baby diaper at 3pm everyday?
This problem is very suitable for cloud platforms. For example, you could use GCP Cloud Scheduler to invoke a cloud function when the alert is supposed to be sent out. The cloud function then calls some API to alert the user.
If cloud platforms are not an option, you could have your application spawn a new thread when an alert is created, and sleep that thread for a certain duration. When it wakes up, it sends the alert. Less elegant and less scalable than the first solution, but it would still work.

can rundeck accept input from slack to run a specific job with a parameter provided by the slack user?

I am trying to find a way to make rundeck interactive with a slack channel such that someone could send a note to the channel and it would go to Rundeck and run a job with a parameter supplied by the user.
I have a plugin already which goes in the reverse direction giving status from the rundesk jobs to the slack channel, but I'd also like the reverse.
Does anyone know of a feature/integration like the above?
A good way to do that is to create a Rundeck webhook and call it from Slack creating a slash command. Take a look at how Rundeck Webooks works and how to enable interactivity with Slack.
Also, you have a legacy way to call custom curl commands (to call Rundeck API, here some examples).

Best way to schedule one-time events in serverless environments

Example use case
Send the user a notification 2 hours after signup.
Options considered
setTimeout(() => { /* send notification */ }, 2*60*60*1000); is not an option in serverless environments since the function terminates after execution (so it has to be stateless).
CloudWatch events can schedule lambda invocations using cron expressions - but this was designed for repetitive invocations (there's a limit of 100 rules/region).
I have not seen scheduling options in AWS SNS/SQS or GCP Pub/Sub. Are there alternatives with scheduling?
I want to avoid (if possible) setting up a dedicated message broker (overkill) or stateful/non-serverless instance - is there a serverless way to do this?
I can queue the events in a database and invoke a lambda function every minute to poll the database for events to execute in that minute... is there a more elegant solution?
Use AWS Step functions, they are like serverless functions that don't have the 15 minute limit like AWS Lambda does. You can design a workflow in AWS step that integrates with API Gateway, Lambda and SNS to send email and text notifications as follows:
Create a REST API via API gateway that will invoke a Lambda function passing in for example, the destination address (email, phone #) of the SNS notification, when it should be sent, notification method (e.g. email, text, etc.).
The Lambda function on invocation will invoke the Step function passing in the data (Lambda is needed because API Gateway currently can't invoke Step functions directly).
The Step function is basically a workflow, you can define states for waiting (like waiting for the specified time to send the notification e.g. 30 seconds), and states for invoking other Lambda functions that can use SNS to send out an email and/or text notifications.
A rudimentary example is provided by AWS w/ their Task Timer example.
Things are coming on GCP for doing this, but not very soon. Thereby, today, the solution is to poll a database.
You can to that with Datastore/firestore with the execution datetime indexed (to prevent to read all the documents each minute). But be careful of traffic spike, you could create hotspot.
You can use Cloud Scheduler on Google Cloud Platform. As is is stated in the official documentation :
Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention. Cloud Scheduler even acts as a single pane of glass, allowing you to manage all your automation tasks from one place.
Here you can check a quickstart for using it with Pub/Sub and Cloud Functions.

multiple workflow instances of Workflows with Windows Workflow Foundation

I'm new to WF. what I'm trying to do is to create a simple Workflow Service and Call them in various clients. So what i have done, I have created a Workflow service. It has a xamlx file and that has a sequence with Receive and Send Reply activity. I also have Correlations. So the first ReceiveandSendReply activity has CanCreateInstance True. In addition to this I
wrote some of my own code activities.
Now I have hosted this service is IIS and trying to call this service using a console app. I have added the web Reference and created a service client and passed the values to the service. It gives me expected results.
But when I'm trying to run another client at the same time it gives me Instance error. I think the Workflow is not initiating a new Instance for the second client.
So I did a search and found multiple instancing can be achieved by using workflowservicehost. But could not find a way to do it.
I think the way Im calling the service is not correct. I'm just creating a new object from the service reference and calling the operation.
Can anyone help me with this?
Please have a look at correlation rules you've set up for your workflow. If several clients passes parameters which correlate with the same instance - a new instance won't be created.
So, if you need a new instance you either need to set different correlation rules, so that different client's calls would correlate with different workflow instances.

Resources