在 Line API 介接的程式放置於 $SPLUNK_HOME/bin/scripts
SPLUNK SNMP DATA WITH CACTI MIRAGE 試作 延伸而來.
其它參考資訊:
使用 Perl 建立 Line API 運用環境
http://xrcd2.blogspot.tw/2016/12/perl-line-api.html
Line API 使用小筆記
http://www.vlab.com.tw/index.php/forum/21/15572-line-api
http://xrcd2.blogspot.tw/2016/12/perl-line-api.html
Line API 使用小筆記
http://www.vlab.com.tw/index.php/forum/21/15572-line-api
[root@bbb scripts]# pwd
/opt/splunk/bin/scripts
[root@bbb scripts]# ll
total 12
-rwxr-xr-x 1 root root 659 Jan 9 14:30 line.pl
-r--r--r-- 1 splunk splunk 71 Oct 26 00:27 readme.txt
[root@bbb scripts]# cat line.pl
#!/usr/local/bin/perl
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;
$bot = LINE::Bot::API->new(
channel_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
channel_access_token => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);
$ToLineUid = "xxxxxxxxxxxxxxxxxxxxxxx";
$messages = LINE::Bot::API::Builder::SendMessage->new;
$messages->add_text( text => " Splunk $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] $ARGV[5] $ARGV[6] $ARGV[7] $ARGV[8] " );
$bot->push_message($ToLineUid, $messages->build);
[root@bbb scripts]#
Demo
沒有留言:
張貼留言