And let’s first show you my Lambda function code. So, this is the main function code which will be making the changes that Datadog monitors. So this is the basic library I am using. And this first function is filtering the payload. According to my requirement, I am fetching the command sent by the user and also the service name. And the next section provides me with the current status. If the user wants to know which servers are currently active, then the user can send the command Switch server status, then this function will give him the current life rate service name. And then this section of the code will make the main changes in the Datadog Monitor. And also, I made a few conditions so that if a user accidentally enters some long service name, it will not change the Datadog monitor. It will only change the monitor when the user enters the correct server from the list. And also, if the server should be different from the current live servers. If someone entered the same server name that is already active, then it won’t change the monitor. So this is the Lambda function I’m working on. So for demo purposes, I have these other three monitors. We generally perform the changes manually, when the client tells us to switch the servers. So I have now cloned this monitor and mute it so that I can show you the changes I am making through slash commands. So, let me move to this my Slack channel. In this channel I have configured the Slack slash command. So I will first check if this is the Switch server command. And if I need to check the status of current servers being active, I will just go with it. So it will tell the current server that the bingo monitors are bingo GMS8 and bingo GMS 10 that we can check it from here. So current live servers you can see are bingo GMS 8 and bingo GMS 10. As soon as the client tells us to change the monitor from 8 and 10 to 7 and 9. Then we generally used to update it manually but now we can just place the command along with a new service name bingo GMS 7, 9. Now it says the Datadog monitor has been switched. So we can check it from here also.
Now you can see that the servers being monitored are now changed to 7 and 9. And this also the conditions are for not host equal to 8. So using slash command, within seconds, we have switched the servers and reduced the Enter. That reduces toil for our on call teams. So it was a short demo from my side. Thank you so much.