Notifications on program startup. Minor changes in scripts.
Notifications on program startup. Minor changes in scripts.
This commit is contained in:
20
scripts/windows/cai-watchdog.ini.template
Normal file
20
scripts/windows/cai-watchdog.ini.template
Normal file
@@ -0,0 +1,20 @@
|
||||
[main]
|
||||
check_interval = 10000
|
||||
rules_count = 2
|
||||
|
||||
[notifications]
|
||||
email = admin@server.local
|
||||
command = ./send-telegram.ps1 <message>
|
||||
service_start = true
|
||||
|
||||
[rule1]
|
||||
service = Test1
|
||||
address = http://127.0.0.1:3000/api/v1/
|
||||
email = admin@server.local
|
||||
command = ./send-telegram.ps1 <message>
|
||||
|
||||
[rule2]
|
||||
service = Test2
|
||||
address = http://127.0.0.1:3300/api/v1/
|
||||
email = admin@server.local
|
||||
command = ./send-telegram.ps1 <message>
|
||||
9
scripts/windows/send-mail.ps1.template
Normal file
9
scripts/windows/send-mail.ps1.template
Normal file
@@ -0,0 +1,9 @@
|
||||
$EmailFrom = "yourmailadress@somedomain.com"
|
||||
$EmailTo = $args[0]
|
||||
$Subject = $args[1]
|
||||
$Body = $args[0]
|
||||
$SMTPServer = "smtp.somedomain.com"
|
||||
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
|
||||
$SMTPClient.EnableSsl = $true
|
||||
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");
|
||||
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
|
||||
10
scripts/windows/send-telegram.ps1.template
Normal file
10
scripts/windows/send-telegram.ps1.template
Normal file
@@ -0,0 +1,10 @@
|
||||
Param([Parameter(Mandatory=$true)][String]$Message)
|
||||
|
||||
$Telegramtoken = "Your_Telegram_Token"
|
||||
$Telegramchatid = "Your_Telegram_Chat_ID"
|
||||
|
||||
$Message = $args[0]
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$Response = Invoke-RestMethod -Uri "https://api.telegram.org/bot$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($Message)"
|
||||
Reference in New Issue
Block a user