Zabbix 3.0.x 整合 Line Alert 圖解,下方有 Perl 的範例程式,可供參考,
使用其的慣用程式也行,至於 Line API 的使用方式可參考下面的其它參考資訊,
或見 https://github.com/line
Demo
其它參考資訊
http://xrcd2.blogspot.tw/2016/12/perl-line-api.html
http://xrcd2.blogspot.tw/2017/07/line-api-emoticons.html
Demo Perl Shell:
[root@CentOS73 shell]# pwd
/usr/local/zabbix/shell
[root@CentOS73 shell]# cat line.pl
#!/usr/local/perl-5.26/bin/perl
# Line
#recipient = sys.argv[1] $ARGV[0]
#subject = sys.argv[2] $ARGV[1]
#body = sys.argv[3] $ARGV[2]
$myid="$ARGV[0]";
$subj="$ARGV[1]";
$body="$ARGV[2]";
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;
$bot = LINE::Bot::API->new(
channel_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
channel_access_token => 'xxxxxxxxxxxxxxxxxxxxxx',
);
$messages = LINE::Bot::API::Builder::SendMessage->new;
$messages->add_text( text => "$subj \r\n \r\n $body " );
$bot->push_message($myid, $messages->build);
[root@CentOS73 shell]#
沒有留言:
張貼留言