# CAI-Watchdog Watchdog for monitoring web-services ## Requirements **On \*nix:** OpenSSL 1.0.1, 1.0.2, 1.1.0, or 1.1.1 with headers (see https://github.com/sfackler/rust-openssl) **On Windows:** Nothing ## Configuration file Default configuration file location: **On \*nix:** /etc/cai-watchdog.conf **On Windows:** current directory You can specify config file as parameter: ```cai-watchdog /path/to/config/config_file.conf``` (*nix) or ```cai-watchdog.exe drive:\path\to\config\config_file.ini``` (Windows) ### Configuration file parameters ``` [main] check_interval - Interval between checks in seconds rules_count - Rules count to be loaded from config. Rules sections must be enumerated continuously [rule1], [rule2] ... etc [notifications] email - E-mail address for system notifications. Can be empty command - Command to send notification service_start - Send program start notification [true | false] [rule1] service = Service name uri = URI to be checked email = E-mail address for notifications command = Command to send notification ``` In commands You can use fields ``````, `````` and `````` - `````` - E-mail address for notifications - `````` - E-mail subject - `````` - Message text ### Scripts configurations #### *nix ##### send-telegram Next lines needs to be configured: - ```GROUP_ID=``` - Set Telegram group ID here - ```BOT_TOKEN=``` - Set Telegram token here #### Windows ##### send-mail.ps1 Next lines needs to be configured: - ```$EmailFrom = "yourmailadress@somedomain.com"``` - Set sender e-mail address here - ```$SMTPServer = "smtp.somedomain.com"``` - Set SMTP-server address here - ```$SMTPClient.EnableSsl = $true``` - Set SSL flag here - ```$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");``` - Set user ("usr") and password ("pass") here ##### send-telegram.ps1 - ```$Telegramtoken = "Your_Telegram_Token"``` - Set Telegram token here - ```$Telegramchatid = "Your_Telegram_Chat_ID"``` - Set Telegram chat ID here ### How to get Telegram token and chat ID 1. Open ```@BotFather``` bot 1. Run ```/newbot``` command and give name to your new bot 1. Enter a username for the bot 1. Take note of the API token. We will need this later. **Note:** it is case sensitive 1. Click the link to open a chat with the newly created bot Next you need to find your Telegram Chat ID. 1. From the Telegram home screen, search for ```chatid_echo_bot```. Click Chat ID Echo to open a chat 1. Enter ```/start``` to get the bot to send you your Telegram Chat ID 1. Take note of the Telegram Chat ID returned