СА
Время оповещения:
Size: a a a
СА
СА
AS
СА
AS
#Какие параметры принимает скрипт
Param (
[String]$AlertName,
[String]$AlertDescription,
[String]$AlertSource,
[String]$TimeRaisedLocal
)
#Токен бота
$token = "*INSERT TOKEN*"
#ID чата, группы или лички
$сhatid = "*INSERT CHATID*"
#Замена кавычек
$AlertName = $AlertName.Replace("'",'"')
#Нормальный перенос строк
$AlertDescription = $AlertDescription.Replace("\n","`n")
#Удаление двойных процентов
$AlertDescription = $AlertDescription.Replace("%%","")
#Удаление знака &
$AlertDescription = $AlertDescription.Replace("&","")
#Собираем переменные в одну и переносим строки
$Message = $AlertName + "`n" + "`n" + "Alert Time: " + $TimeRaisedLocal + "`n" + "`n" + "Description: " + $AlertDescription + "`n" + "`n" + "Object Path:" + $AlertSource
#Тип данных Markdown
$payload = @{ "parse_mode" = "Markdown"; "disable_web_page_preview" = "True" }
#
$URL = "https://api.telegram.org/bot$token/sendMessage?chat_id=$сhatid&text=$Message"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$request = Invoke-WebRequest -Uri $URL -Method Post -ContentType "application/json; charset=utf-8" -Body (ConvertTo-Json -Compress -InputObject $payload)
СА
AS
СА
AS
СА
СА
AS
-AlertName "'$Data[Default='Not Present']/Context/DataItem/AlertName$'" -AlertDescription "'$Data[Default='Not Present']/Context/DataItem/AlertDescription$'" -AlertSource "'$Data[Default='Not Present']/Context/DataItem/ManagedEntityPath$\$Data[Default='Not Present']/Context/DataItem/ManagedEntityDisplayName$'" -TimeRaisedLocal "'$Data[Default='Not Present']/Context/DataItem/TimeRaisedLocal$'"
D
#Какие параметры принимает скрипт
Param (
[String]$AlertName,
[String]$AlertDescription,
[String]$AlertSource,
[String]$TimeRaisedLocal
)
#Токен бота
$token = "*INSERT TOKEN*"
#ID чата, группы или лички
$сhatid = "*INSERT CHATID*"
#Замена кавычек
$AlertName = $AlertName.Replace("'",'"')
#Нормальный перенос строк
$AlertDescription = $AlertDescription.Replace("\n","`n")
#Удаление двойных процентов
$AlertDescription = $AlertDescription.Replace("%%","")
#Удаление знака &
$AlertDescription = $AlertDescription.Replace("&","")
#Собираем переменные в одну и переносим строки
$Message = $AlertName + "`n" + "`n" + "Alert Time: " + $TimeRaisedLocal + "`n" + "`n" + "Description: " + $AlertDescription + "`n" + "`n" + "Object Path:" + $AlertSource
#Тип данных Markdown
$payload = @{ "parse_mode" = "Markdown"; "disable_web_page_preview" = "True" }
#
$URL = "https://api.telegram.org/bot$token/sendMessage?chat_id=$сhatid&text=$Message"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$request = Invoke-WebRequest -Uri $URL -Method Post -ContentType "application/json; charset=utf-8" -Body (ConvertTo-Json -Compress -InputObject $payload)
AS
D
AS
D
AS
AS
D