It is possible to send Telegram messages from PRTG:
This is how we connected Telegram to our PRTG instance.
Install Cygwin64 (https://cygwin.com/)
Select the Dev part
Search for: libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev and select packages you can select
install
- execute the following commands:
mkdir /home/install cd /home/install git clone https://github.com/vysheng/tg.git && cd tg ./configure —disable-libconfig make
- add these paths to the windows paths: C:\CYGWIN64\BIN;C:\CYGWIN64\USR\BIN - create the following scripts in /home/install/tg:
File send.expect
#!/usr/bin/expect
cd /home/install/tg
spawn ./telegram -B
expect "User"
send "msg $argv\r"
expect "Sent:"
send "quit\r"
expect eof
puts "Message has been sent”
File message.sh
#!/bin/bash
cd /home/install/tg
mkdir -p ~/.telegram
cp binlog ~/.telegram/binlog
./send.expect $@
File sendmessage.bat
@echo off
"c:\cygwin64\bin\sh.exe" "/home/install/tg/message.sh" %*
exit 0
- Install PSTools Suite (http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx)
- Execute CMD as SYSTEM: psexec -i -s cmd.exe
- In the command box, execute: c:\cygwin64\home\install\tg\telegram -B
- Login in Telegram with your number.
- Quit.
- Copy sendmessage.bat to the PRTG installation folder\Notifications\EXE.
- Restart PRTG
- Create a notification with this Batch file. The first parameter must be the name of the group or user were you want to send the message to (spaces are converted to underscores).
Add comment