Last active
November 17, 2015 21:24
-
-
Save DamianStanger/a7b15c961f98f086bea8 to your computer and use it in GitHub Desktop.
For details see my blog post http://foldingair.blogspot.co.uk/2015/11/splunk-alerts-to-slack-using-powershell.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
powershell "C:\Program` Files\Splunk\bin\scripts\SplunkSlackAlert.ps1 -ScriptName '%SPLUNK_ARG_0%' -NEvents '%SPLUNK_ARG_1%' -TriggerReason '%SPLUNK_ARG_5%' -BrowserUrl '%SPLUNK_ARG_6%' -ReportName '%SPLUNK_ARG_4%'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$ScriptName = "No script specified", | |
[string]$NEvents = 0, | |
[string]$TriggerReason = "No reason specified", | |
[string]$BrowserUrl = "https://localhost:8000/", | |
[string]$ReportName = "No name of report specified" | |
) | |
$body = @{ | |
text = "Test for a parameterized script `"$ScriptName`" `r`n This script retuned $NEvents and was triggered because $TriggerReason `r`n The Url to Splunk is $BrowserUrl `r`n The Report Name is $ReportName" | |
} | |
#Invoke-RestMethod -Uri https://hooks.slack.com/services/AAAAAAAAA/BBBBBBBBB/CCCCCCCCC -Method Post -Body (ConvertTo-Json $body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment