Minimal functionality implemented
Minimal functionality implemented
This commit is contained in:
9
scripts/cai-watchdog.cfg.template
Normal file
9
scripts/cai-watchdog.cfg.template
Normal file
@@ -0,0 +1,9 @@
|
||||
[main]
|
||||
check_interval = 10000
|
||||
rules_count = 2
|
||||
[rule1]
|
||||
address = http://127.0.0.1:3000/api/v1/
|
||||
email = admin@server.local
|
||||
[rule2]
|
||||
address = http://127.0.0.1:3300/api/v1/
|
||||
email = admin@server.local
|
||||
16
scripts/unix/cai-watchdog.service.template
Normal file
16
scripts/unix/cai-watchdog.service.template
Normal file
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Watchdog service
|
||||
|
||||
[Service]
|
||||
User=wwwrun
|
||||
Group=www
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/cai-watchdog
|
||||
|
||||
KillMode=control-group
|
||||
NotifyAccess=all
|
||||
SuccessExitStatus=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=cai_watchdog
|
||||
23
scripts/unix/send-telegram.template
Normal file
23
scripts/unix/send-telegram.template
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
GROUP_ID=<group_id>
|
||||
BOT_TOKEN=<bot_token>
|
||||
|
||||
# this 3 checks (if) are not necessary but should be convenient
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo "Usage: `basename $0` \"text message\""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Add message text as second arguments"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "You can pass only one argument. For string with spaces put it on quotes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
curl -s --data "text=$1" --data "chat_id=$GROUP_ID" 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage' > /dev/null
|
||||
11
scripts/windowss/send-mail.ps1.template
Normal file
11
scripts/windowss/send-mail.ps1.template
Normal file
@@ -0,0 +1,11 @@
|
||||
Function Send-Mail {
|
||||
$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/windowss/send-telegram.ps1.template
Normal file
10
scripts/windowss/send-telegram.ps1.template
Normal file
@@ -0,0 +1,10 @@
|
||||
Function Send-Telegram {
|
||||
Param([Parameter(Mandatory=$true)][String]$Message)
|
||||
|
||||
$Telegramtoken = "Your_Telegram_Token"
|
||||
$Telegramchatid = "Your_Telegram_Chat_ID"
|
||||
|
||||
[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